SQS订阅SNS:如何在CloudFormation中指定多个TopicArns?
另一个团队创建了多个 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"
}
}
}
}
}
How can Ispecify multiple TopicArns in one "AWS::SNS::Subscription"以避免重复。
我尝试在参数中使用通配符
"Parameters" : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic*.fifo"
},
,但它错误地显示为无效 ARN。
A different team has created several SNS topics to work around the SNS quotas. The ARNs are
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
I am trying to subscribe an SQS to these topics. My CloudFormation looks like below, with lots of duplication:
{
"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"
}
}
}
}
}
How can I specify multiple TopicArns in one "AWS::SNS::Subscription" to avoid duplication.
I tried using wild cards in the parameters
"Parameters" : {
"SomeTopicArn" : {
"Type" : "String",
"Default" : "arn:aws:sns:us-west-1:xxxx:SomeTopic*.fifo"
},
but it errors out as invalid ARN.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除非您要开发自己的 自定义资源或模板宏为此。
There is no such way unless you are going to develop your own custom resource or template macro for that.