I'm using a YAML template of CloudFormation, to create two queues, one of them is a DLQ.
In the DLQ queue I'm attempting to add RedriveAllowPolicy with either of the below json lines, however it fails with the message mentioned below the json examples.
Embedding here also the full template (YAML) for reproduce purposes.
FYI, we're using region us-west-2 (Oregon)
RedriveAllowPolicy JSON examples:
RedriveAllowPolicy: !Sub '{"redrivePermission":"byQueue","sourceQueueArns":"arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:${EnvironmentType}-${MlResultsQueueName}"}'
or
RedriveAllowPolicy: !Join ['',['{"redrivePermission":"byQueue","sourceQueueArns":"', !GetAtt NevaDscvrMlResultsQueue.Arn, '"}']]
CloudFormation stack failure message on queue update
Resource handler returned message: "Invalid value for the parameter RedriveAllowPolicy. Reason: Amazon SQS can't create the redrive allow policy, as it?s in an unsupported format. (Service: Sqs, Status Code: 400, Request ID: edb2977c-9656-5c9b-a7bf-cdde4dd26492, Extended Request ID: null)" (RequestToken: 76823ad0-286b-ff35-ba3e-de300bac4c88, HandlerErrorCode: GeneralServiceException)
Full template:
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
EnvironmentType:
Type: String
Default: dev
Description: 'The name of the release environment.'
MlResultsQueueName:
Description: MlResultsQueue name
Type: String
Default: 'nevadscvr-ml-results'
MlResultsQueueDLQName:
Description: MlResultsQueueDLQ name
Type: String
Default: 'nevadscvr-ml-results-DLQ'
Resources:
NevaDscvrMlResultsQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub '${EnvironmentType}-${MlResultsQueueName}'
VisibilityTimeout: 60
MessageRetentionPeriod: 345600
DelaySeconds: 0
MaximumMessageSize: 262144
ReceiveMessageWaitTimeSeconds: 20
RedrivePolicy:
deadLetterTargetArn: !Sub 'arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:${EnvironmentType}-${MlResultsQueueDLQName}'
maxReceiveCount: 3
NevaDscvrMlResultsQueueDLQ:
Type: AWS::SQS::Queue
Properties:
QueueName: !Sub '${EnvironmentType}-${MlResultsQueueDLQName}'
VisibilityTimeout: 30
MessageRetentionPeriod: 345600
DelaySeconds: 0
MaximumMessageSize: 262144
ReceiveMessageWaitTimeSeconds: 0
RedriveAllowPolicy: !Sub '{"redrivePermission":"byQueue","sourceQueueArns":"arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:${EnvironmentType}-${MlResultsQueueName}"}'
Amazing!!! Thank you so much :-)