This template creates a source queue and a dead-letter queue for Amazon SQS. The source queue is configured with a redrive policy that specifies the dead-letter queue. The redrive policy determines the maximum number of times a message can be received from the source queue before being moved to the dead-letter queue. The template also outputs the URLs and ARNs of both the source and dead-letter queues.

CloudFormation Template

AWSTemplateFormatVersion: '2010-09-09'
Description: SQS Queue with a Dead-Letter Queue
Resources:
  MySourceQueue:
    Type: 'AWS::SQS::Queue'
    Properties:
      QueueName: undefined
      RedrivePolicy:
        deadLetterTargetArn: undefined
        maxReceiveCount: undefined
  MyDeadLetterQueue:
    Type: 'AWS::SQS::Queue'
    Properties:
      QueueName: undefined