microservices - SNS + CloudFormation -
i'm using aws cloudformation build stack microservice. aws cloudformation template creates resources like: lambda function, sns topic , api gateway.
this microservice work , publishes messages sns topic. other microservices subscribe topic.
the problem i'm facing when upgrade microservice's cloudformation template (sometimes need redeploy it, , recreate resources), sns topic changes arn
. hence, microservices use topic need change well.
i think create separate cloudformation template sns topic (i have more 1 per microservice).
- will approach?
- if not, what's recommended way?
as per aws cloudformation docs, there 3 properties available sns topic, , change third property (i.e. topicname
) lead replacement of sns resource (and leading generation of new arn).
since you're nuking resources in cloudformation stack , re-creating them (you mentioned that's how serverless framework you're using works), can preserve sns topic arn specifying topicname
attribute sns topic in template (it's when 1 doesn't specify topicname
when cloudformation comes , assigns random name, otherwise uses name user specifies).
that being said, scenario seem little unnatural me. if aren't managing subscriptions topic via cloudformation, i'd recommend doing that, , should automatically create sns subscriptions on replaced sns topic you, if @ sns topic arn changes.
ref: http://docs.aws.amazon.com/awscloudformation/latest/userguide/aws-properties-sns-topic.html
http://docs.aws.amazon.com/awscloudformation/latest/userguide/aws-resource-sns-subscription.html
Comments
Post a Comment