Conditional Resources
Explore how to implement conditional resources in AWS CloudFormation within your serverless applications. Understand setting up conditions to enable or disable resources like email subscriptions, helping reduce noise during deployments. Learn how to leverage error logging, dead letter queues, and SNS notifications for efficient event handling and troubleshooting in AWS Lambda.
We'll cover the following...
Email subscriptions are not the right solution for production deployments. Emailing after each individual event would most likely cause too much noise, and people will just start ignoring it. It would be much better to set up error logging in a different way completely. You can make the email subscription optional by adding a condition to your resource.
CloudFormation can activate or deactivate resources based on certain conditions, which you need to set up in a separate template section titled Conditions. I usually put this between parameters and resources. The following lines are added to your template as a top-level section, for example above Resources.
The previous listing creates a condition to ...