CloudFormation Flashcards
What is CloudFormation?
- Infrastructure as Code
- Code that can be deployed and is written to create / update / delete infrastructure
Is there a cost for using CloudFormation?
No. Only the underlying services.
High Level - How does CloudFormation work?
- Templates have to be uploaded in S3 and then referenced in CloudFormation.
- To update a template, a new version must be uploaded to AWS (cannot edit existing one directly).
What are the 2 main ways to deploy CloudFormation templates?
- Manually
- Automated (recommended)
Describe manual deploys in CloudFormation
- Edit templates in the CloudFormation designer
- Use the console to input parameters etc.
Describe the high level overview of deploying CloudFormation through automation.
- Edit templates in a YAML file.
- Use the AWS CLI to deploy the templates.
- Recommended way in order to fully automate flow.
List the 6 main building blocks for CloudFormation.
- Resources (Required)
- Parameters
- Mappings
- Outputs
- Conditionals
- Metadata
The exam will not expect you to write CloudFormation templates, but it will expect you to be able to READ CloudFormation templates. What language should you be familar with so that you can read and understand CloudFormation?
YAML
Can Resources be dynamically created using CloudFormation?
No. Resources in the CloudFormation Template must be declared.
Is every AWS resource supported through CloudFormation.
No, but almost. Mostly smaller services that are not yet addressed and you can work around that using AWS Lambda Custom Resources.
What are CloudFormation parameters?
- Parameters are a way to provide inputs to your AWS CloudFormation templates.
- Parameters are extremely powerful, controlled, and can prevent errors from happening in your templates thats to types.
When should you use CloudFormation parameters?
- If the CloudFormation resource is likely to change in the future.
- By making a parameter you will not have to re-load a template to change its content.
How do you reference a parameter in CloudFormation?
- The Fn::Ref function can be leverage to reference parameters.
- The shorthand for this in YAML is !Ref
- Parameters can be referenced anywhere in the template.
How can you get the account ID using a CloudFormation template?
- CloudFormation has something called pseudo parameters.
- These can be used at anytime and are enabled by default.
- One of these pseudo parameters in AWS::AccountId
What are CloudFormation Mappings?
- Mapping are fixed variables with the CloudFormation template.
- Handy to differentiate between different environments (dev vs prod), regions, AMI types etc.
- All values are hardcoded in the template.