AWS CloudFormation
2 min readFeb 22, 2021
This is part of a blog series giving a high level overview of the different services examined on the AWS Solution Architect Associate exam, to view the whole series click here.
CloudFormation Summary
- Allows you to provision AWS resources as code.
- Use templates to define the resources that you want to launch and their dependencies. These templates can either be in JSON or YAML format.
- You can think of templates as blue prints for creating resources.
- Can create stacks, which are collections of resources that you can manage in a single template and then you can create, update or delete the entire collection within its stack.
- If you want to update a stack, you can create a Change Set which can allow you to see how the changes will impact your running resources before implementing the change.
- CloudFormation overall simplifies infrastructure management and also makes it very easy to replicate infrastructure across different regions.
Template Sections
There are ten valid sections a CloudFormation template can contain, however they are not all required:
- Format Version — Version that the template conforms to (Optional)
- Description — Describes what the template is used for. This is optional, but if you use it, it needs to follow the Format Version.
- MetaData — any additional info about the template. (Optional)
- Parameters — Any values that you want to pass into your template at run time. (Optional)
- Rules — used to validate parameters passed into the stack (Optional)
- Mappings — mapping of key value pairs that can be used to specify conditions (Optional)
- Conditions — can control whether a resource is created or whether certain properties are assigned depending on a particular criteria. (Optional)
- Transform — used for serverless applications, allows you to specify the SAM version to use (Optional)
- Resources — specify the actual resources you want to create (REQUIRED)
- Outputs — values that are displayed when you check the stacks properties (Optional)
Serverless Application Model (SAM)
- Is an open-source framework that extends CloudFormation so that it is optimised for serverless applications (e.g. Lambdas, API’s, databases etc.)
- It supports anything CloudFormation supports.
- Also uses templates to define resources and these templates are in a YAML format.
- Can run serverless applications locally using docker.