简体   繁体   English

CloudFormation SQS队列Redrive策略依赖于创建的DLQ

[英]CloudFormation SQS Queue Redrive policy dependency on a DLQ created

I'm using a CloudFormation template to create a stack for SQS. 我正在使用CloudFormation模板为SQS创建堆栈。 I have one SQS queue set with a dependency to another SQS queue used as a DLQ. 我有一个SQS队列集与依赖于另一个用作DLQ的SQS队列。 When I create the stack I get this error: 当我创建堆栈时,我收到此错误:

Value {"deadLetterTargetArn":"arn:aws:sqs:eu-west-1:xxxxxxxxx:services-abc-dlq","maxReceiveCount":"10"} for parameter RedrivePolicy is invalid. Reason: Dead letter target does not exist.

How do I set a redrive policy to wait for DLQ to finish being created? 如何设置重新启动策略以等待DLQ完成创建?

Here's the pertinent information from my template: 以下是我的模板中的相关信息:

"Resources": {
    "queueservicesdlqevents": {
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "DelaySeconds": "0",
        "MaximumMessageSize": "262144",
        "MessageRetentionPeriod": "345600",
        "QueueName": "services-abc-dlq",
        "ReceiveMessageWaitTimeSeconds": "0",
        "VisibilityTimeout": "30"
      }
    },
    "queueservicesevents": {
      "Type": "AWS::SQS::Queue",
      "Properties": {
        "DelaySeconds": "0",
        "MaximumMessageSize": "262144",
        "MessageRetentionPeriod": "345600",
        "QueueName": "services-abc-events",
        "ReceiveMessageWaitTimeSeconds": "20",
        "VisibilityTimeout": "30",
        "RedrivePolicy": {
          "deadLetterTargetArn" : "arn:aws:sqs:eu-west-1:xxxxxx:services-abc-dlq",
          "maxReceiveCount" : 10
        }
      }
    },

Just to add, making a "Ref" to other queue doesn't work because dlqtargetArn expects a string. 只是要添加,对其他队列进行“Ref”不起作用,因为dlqtargetArn需要一个字符串。

Just to add, making a "Ref" to other queue doesn't work because dlqtargetArn expects a string. 只是要添加,对其他队列进行“Ref”不起作用,因为dlqtargetArn需要一个字符串。

Ref only provides the (default) value of an AWS CloudFormation resource, but you can get the value of other attributes of a resource by means of Fn::GetAtt as follows: Ref仅提供AWS CloudFormation资源的(默认)值,但您可以通过Fn :: GetAtt获取资源的其他属性的值,如下所示:

"Fn::GetAtt" : [ "logicalNameOfResource", "attributeName" ]

That is, as per section Return Values within AWS::SQS::Queue , the ARN of the dead letter queue at hand is available via: 也就是说,根据AWS :: SQS :: Queue中的 返回值部分,可以通过以下方式获取死信队列的ARN:

"Fn::GetAtt" : [ "queueservicesdlqevents", "Arn" ]

Once you reference the actual ARN from the dependent resource, CloudFormation will ensure that the dependency is created first so that the dead letter target queueservicesdlqevents already exists when you create the queueservicesevents queue. 从依赖资源引用实际ARN后,CloudFormation将确保首先创建依赖关系,以便在创建queueservicesevents队列时已存在死信目标queueservicesdlqevents

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为使用 for_each 创建的死信队列添加 SQS 重新驱动策略时如何修复错误消息 - How to fix error message when adding SQS redrive policy for deadletter queue created using for_each 如何解决为使用 for_each 创建的死信队列添加 SQS 重新驱动策略时的错误消息 - How to resolve the error message when adding SQS redrive policy for deadletter queue created using for_each AWS SQS重新驱动策略,请在队列的末尾进行混乱 - AWS SQS redrive policy, which end of the queue do messges go to AWS SQS 死信队列重新驱动策略 - AWS SQS dead-letter queue redrive policy 如何使用 Ansible 和 AWS 将重新驱动策略(死信队列/DLQ)添加到 SNS 订阅 - How to add a redrive policy (dead-letter queue / DLQ) to a SNS subscription, with Ansible and AWS 如何使用加密的 DLQ 将 Redrive 策略添加到 SNS - How to add a Redrive policy to an SNS with an encrypted DLQ SQS批次中的所有消息是否在达到最大redrive(Retry)策略数后都发送到Dead Letter Queue - Are all the messages in SQS batch sent to Dead Letter Queue after reaching the maximum redrive(Retry) policy number SQS Lambda - 重新驱动策略与 DeadLetterConfig - SQS Lambda - Redrive Policy vs DeadLetterConfig 通过 Cloudformation 创建 SQS 队列及其访问策略时出错 - Error in creating SQS Queue and its access policy through Cloudformation 如何使用 cloudformation/SAM 创建一个 SQS 队列,该队列与使用 SAM 创建的 lambda 一起使用? - How to create an SQS queue with cloudformation/SAM that works with lambdas created with SAM?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM