In this article, there is a nice explanation about CloudFormation.
If you don’t know CloudFormation, then it’s important to know that CloudFormation is the Infrastructure as Code (IaC) solution of AWS. It is in the same category of tools as Terraform (a very good comparison between CloudFormation and Terraform can be found here).
With CloudFormation you can declaratively specify the AWS infrastructure that you need for your cloud application in a YAML or JSON file, called a template, and then deploy this template. During the deployment, AWS automatically provisions all the resources that you specified in your template.
If you already deployed before and just made changes to your template, then AWS calculates a changeset and applies it, so that the state of your infrastructure matches your the specification (just like Kubernetes).
Imagine the following scenario:
- Create a new project and set up a CloudFormation template for this project.
- Successfully deployed this template.
- Then, change the code.
- Deploy it again.
In term of step4, how does CloudFormation know this stack has been created before, and just update it?
Is there a unique UUID in the template to identify all the resources relating to this template?