I'm using AWS CloudFormation to build a stack for a microservice. My AWS CloudFormation template creates resources like: a Lambda function, an SNS topic and API Gateway.
This microservice does some work and publishes messages to the SNS topic. Other microservices subscribe to this topic.
The problem I'm facing is that when I upgrade my microservice's CloudFormation template (sometimes I need to redeploy it, and recreate all resources), the SNS topic changes its ARN
. Hence, all microservices that use this topic need to change as well.
I think I could create a separate CloudFormation template for the SNS topic (I have more than one per microservice).
- Will this be a good approach?
- If not, what's the recommended way?