Conditional Resources
Understand how to implement conditional resources in AWS CloudFormation templates to control resource creation based on parameters. Learn to manage email subscriptions for event notifications, use conditions to optimize deployments, and handle error logging with dead letter queues for asynchronous Lambda functions.
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 check whether the ...