- Infrastructure as code. Free.
- You can schedule the destruction and re-creation of the environment
- The templates have to be uploaded in S3
- You can’t edit the current version, we need to re-upload a new version.
- When you upload a new template, you can see the changes in Change Sets.
- Cloudformation knows the right order for resource creation.
- If the update fails, the service is automatically rolled back to the previous working state.
- You need to enable it in stack creation options
Cloudformation Drift Detection
- Detects changes that happened manually on the resources!
- Stack actions -> Detect drift
- You create Stacks. They contain Events (creation events), Resources, Templates etc
- Nested stacks are stacks contained in other stacks.
- To create a nested stack, specify the AWS::CloudFormation::Stack
- StackSets help you update infrastructure in different regions and Accounts.
- Resources – Mandatory
- Define them in the Parameters section
- Use them with !Ref. This can be used to reference parameters or resources.
- Pseudo Parameters: Some default parameters like AWS::AccountId etc
- Hard-Coded variables
- Matches a key to a corresponding set of named values
- !FindInMap [MapName, TopLevelKey, SecondLevelKey]
- You can export output and import it into another stack
- You cannot delete a stack if it has referenced output to other stacks
- Export: to export it and !ImportValue to import an output
- !Equals [!Ref ParameterName, value]
- Used by the Condition: ConditionName
- !Ref – Reference parameters of resources. Returns the resources ids
- !GetAtt. Get parameter attributes. Unlike Ref, this can return any attribute of the resource, not only the id. Example: !GetAtt EC2Instance.AvailabilityZone
- !FindInMap[ MapName, TopLevelKey, SecondLevelKey ] – Return Mapping value
- !ImportValue – Import value that has been exported
- !Join – Joins a comma-separated list with “:”
- !Sub – Substitute values in strings
- Conditions – And , Equals, If, Not , Or