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}"}'
已提問 2 年前檢視次數 1573 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南