DEV Community

Roman
Roman

Posted on • Updated on

AWS CloudFormation Cheat Sheet

Terminology

Component Description
Templates The JSON or YAML text file that contains the instructions for building out the AWS environment
Stacks The entire environment described by the template and created, updated, and deleted as a single unit
StackSets AWS CloudFormation StackSets extends the functionality of stacks by enabling you to create, update, or delete stacks across multiple accounts and regions with a single operation
Change Sets A summary of proposed changes to your stack that will allow you to see how those changes might impact your existing resources before implementing them

Digest

  • A CloudFormation template will consist of a set of resources defined. These resources will be part of a single stack, once built. CloudFormation will treat all the resources as a collection of resources
  • CloudFormation supports JSON and YAM for its template languages.
  • All ID's are unique to each region, account, and VPC. It is best practice to not embed such IU's inside a CloudFormation template. Instead, define parameters, mappings and conditions to create a dynamic template that could be run across VP's, Regions or even accounts
  • Cloudformation stackset vs changeset vs nested stack
  • Nested stacks - stacks created as part of other stacks. You create a nested stack within another stack by using the AWS: CloudFormation:Stack resource. For example, assume that you have a load balancer configuration that you use for most of your stacks. Instead of copying and pasting the same configurations into your templates, you can create a dedicated template for the load balancer. Then, you just use the resource to reference that template from within other templates
  • Change Sets will produce a summary of changes and their impact on the resources.
  • StackSets is used for deploying or managing template resources across accounts and/or regions.
  • Sting, Number, List are supported data type in CFT
  • Including lambda function as zipfile parameter in CFT is the easiest way to deploy lambda function
  • If stack creation fails, AWS CloudFormation rolls back any changes by deleting the resources that it created.
  • Fn:FindInMap to perform a dynamic lookup in Cloud formation template
  • Transform section of Cloud formation specifies version of SAM model to use.
  • Two templates, one for Intra and one for App.

Top comments (0)