AWS CloudFormation is a JSON-templated document that allows you to define the resources you intend to create within Amazon Web Services, thereby allowing you to reproduce your infrastructure with minimal effort. This includes being able to deploy to a different environment or deploy it to another region.
Here are a few things to keep in mind while using CloudFormation:
Stack Updates: Do ‘em
Stack updates provide a way to perform incremental updates to your CloudFormation-controlled resources, such as adding a listening port on an ELB or changing out the AMI used in a launch configuration. When building out infrastructure using CloudFormation, it is important to perform stack updates and continue using CloudFormation when building new infrastructure. While it may be tempting to simply create resources using the AWS management console, it will also make tracking your changes more difficult. It’s also a best practice to use stack policies for preventing unwanted updates to resources.
Version Control: Use It
Versioning infrastructure with CloudFormation is part of managing infrastructure as code (IaC). It allows you to keep a historical record of the changes made to your infrastructure. Additionally, versioning eliminates guesswork when reverting changes. Because CloudFormation is written in JSON, you can easily maintain a versionable infrastructure.
Commit, and Commit Often
Using version control allows for greater communication between team members and provides a historical record to view updates to infrastructure in the same way you would with source code. Make changes subtly, if possible, and test and commit often.