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

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -