Amazon web services 无法在同一cloudformation堆栈中创建具有死信队列的FIFO队列
我有一个cloudformation堆栈,其中包含一个FIFO队列及其关联的死信队列。以前这不是一个FIFO队列,它部署得很好,首先是死信队列依赖,然后是“源队列”。在切换到FIFO后,它不再工作。我得到这个错误:Amazon web services 无法在同一cloudformation堆栈中创建具有死信队列的FIFO队列,amazon-web-services,amazon-cloudformation,amazon-sqs,Amazon Web Services,Amazon Cloudformation,Amazon Sqs,我有一个cloudformation堆栈,其中包含一个FIFO队列及其关联的死信队列。以前这不是一个FIFO队列,它部署得很好,首先是死信队列依赖,然后是“源队列”。在切换到FIFO后,它不再工作。我得到这个错误: "Template error: SQSQueue https://sqs.us-east-1.amazonaws.com/1234/dev-assignments-dlq doesn't exist", 因此,似乎不再首先创建死信队列 AWSTemplateFormatVers
"Template error: SQSQueue https://sqs.us-east-1.amazonaws.com/1234/dev-assignments-dlq doesn't exist",
因此,似乎不再首先创建死信队列
AWSTemplateFormatVersion: "2010-09-09"
Resources:
SourceQueue:
Type: AWS::SQS::Queue
Properties:
FifoQueue: true
QueueName: 'dev-push-notifications.fifo'
RedrivePolicy:
deadLetterTargetArn:
Fn::GetAtt:
- 'DeadLetterQueue'
- 'Arn'
maxReceiveCount: 5
VisibilityTimeout: 30
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: 'dev-push-notifications-dlq'
这很奇怪,因为Cloudformation应该检测到依赖性,因为
GetAtt
。您可以尝试使用以下属性显式声明它:
AWSTemplateFormatVersion: "2010-09-09"
Resources:
SourceQueue:
Type: AWS::SQS::Queue
DependsOn: DeadLetterQueue
Properties:
# ...
结果表明,死信队列必须与其源的类型相同 将cloudformation堆栈更改为以下格式:
AWSTemplateFormatVersion: "2010-09-09"
Resources:
SourceQueue:
Type: AWS::SQS::Queue
Properties:
FifoQueue: true
QueueName: 'dev-push-notifications.fifo'
RedrivePolicy:
deadLetterTargetArn:
Fn::GetAtt:
- 'DeadLetterQueue'
- 'Arn'
maxReceiveCount: 5
VisibilityTimeout: 30
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
FifoQueue: true
QueueName: 'dev-push-notifications-dlq.fifo'
谢谢这最终并没有起作用,但通过强制首先创建dlq w/DependsOn,我得到了一条错误消息,揭示了真正的原因:“死信队列必须与源队列的类型相同”。看下面我的答案。酷!我很高兴这对我有帮助,也感谢你分享我的事业——我学到了一些新东西。