[英]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.