AWS::SQS::Queue - template fail to update queue RedriveAllowPolicy

0

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}"}'
1개 답변
0
수락된 답변

Hello,

I was able to reproduce this issue by using the provided template. To fix this issue, I passed the RedriveAllowPolicy as below which worked;

      RedriveAllowPolicy: !Sub >-
         {"redrivePermission":"byQueue","sourceQueueArns":["arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:${EnvironmentType}-${MlResultsQueueName}"]}

Passing the sourceQueueArns as a list fixed the issue.

AWS
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠