gpt4 book ai didi

amazon-web-services - SQS订阅SNS : How to specify multiple TopicArns in CloudFormation?

转载 作者:行者123 更新时间:2023-12-03 07:33:46 26 4
gpt4 key购买 nike

另一个团队创建了多个 SNS 主题来解决 SNS 配额问题。 ARN 是

arn:aws:sns:us-west-1:xxxx:SomeTopic.fifo
arn:aws:sns:us-west-1:xxxx:SomeTopic1.fifo
arn:aws:sns:us-west-1:xxxx:SomeTopic2.fifo
...
arn:aws:sns:us-west-1:xxxx:SomeTopicN.fifo

我正在尝试订阅这些主题的 SQS。我的 CloudFormation 如下所示,有很多重复内容:

{
"AWSTemplateFormatVersion" : "2010-09-09",
"Parameters" : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic.fifo"
},
"SomeTopicArn1" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic1.fifo"
}
},
"Resources" : {
"SomeQueue" : {
"Type" : "AWS::SQS::Queue",
"Properties" : {
"QueueName" : "SomeQueue.fifo",
"FifoQueue" : "true"
}
},
"SubscribeSomeQueueSqsToSomeTopic" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Protocol" : "sqs",
"Endpoint" : {
"Fn::GetAtt" : [
"SomeQueue",
"Arn"
]
},
"TopicArn" : {
"Ref" : "SomeTopicArn"
}
}
},
"SubscribeSomeQueueSqsToSomeTopic1" : {
"Type" : "AWS::SNS::Subscription",
"Properties" : {
"Protocol" : "sqs",
"Endpoint" : {
"Fn::GetAtt" : [
"SomeQueue",
"Arn"
]
},
"TopicArn" : {
"Ref" : "SomeTopicArn1"
}
}
}
}
}

如何在一个“AWS::SNS::Subscription”中指定多个 TopicArns 以避免重复。

我尝试在参数中使用通配符

"Parameters"               : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic*.fifo"
},

但它错误地显示为无效 ARN。

最佳答案

除非您要开发自己的custom resource,否则没有这样的方法。或template macro为此。

关于amazon-web-services - SQS订阅SNS : How to specify multiple TopicArns in CloudFormation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71475093/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com