Carova

Serverless AWS Create SQS Queue Template

Serverless template to create a SQS queue and SQS DLQ in AWS. The SQS queues reference each other and errored events will be sent to the SQS DLQ.

Add the following YAML to the resources section of your Serverless file.

1resources: 2 Resources: 3 CustomQueue: 4 Type: AWS::SQS::Queue 5 Properties: 6 QueueName: ${self:service}-${opt:stage, self:provider.stage}-CustomQueue 7 RedrivePolicy: 8 deadLetterTargetArn: { Fn::GetAtt: [CustomQueueDLQ, Arn] } 9 maxReceiveCount: 1 10 CustomQueueDLQ: 11 Type: AWS::SQS::Queue 12 Properties: 13 QueueName: ${self:service}-${opt:stage, self:provider.stage}-CustomQueueDLQ 14 MessageRetentionPeriod: 1209600 # 14 days in seconds