SQS订阅SNS:如何在CloudFormation中指定多个TopicArns?
SQS subscribing to SNS: How to specify multiple TopicArns in CloudFormation?
另一个团队创建了多个 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 or template macro。
另一个团队创建了多个 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 or template macro。