我有一个包含FIFO队列及其相关的死信队列的cloudformation堆栈。以前这不是FIFO队列,并且部署良好,首先创建了死信队列依赖关系,然后才是“源队列”。将其切换到FIFO后,它将不再起作用。我收到此错误:
"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'
答案 0 :(得分:2)
这很奇怪,因为Cloudformation应该由于GetAtt
而检测到依赖性。您可以尝试使用DependsOn
属性明确声明它:
AWSTemplateFormatVersion: "2010-09-09"
Resources:
SourceQueue:
Type: AWS::SQS::Queue
DependsOn: DeadLetterQueue
Properties:
# ...
答案 1 :(得分:1)
结果证明,死信队列必须与源队列类型相同。
将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'