Skip to content

AWS CloudFormation

References:


Tools

awscli

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

bash-my-aws

$ git clone https://github.com/bash-my-aws/bash-my-aws.git ${BMA_HOME:-$HOME/.bash-my-aws}

Utilities:

pip install cfn-flip cfn-lint pydot

VSCode Extensions: - Create a AWS CloudFormation template using the AWS Toolkit for Visual Studio Code - AWS Toolkit for VS Code (docs.aws.amazon.com): - YAML - Visual Studio Marketplace (marketplace.visualstudio.com) - CloudFormation template: File has a .yaml or .yml extension. - The file has a top-level AWSTemplateFormatVersion or Resources node.

SAM Template
  • All of the criteria already described for CloudFormation

  • The file has a top-level Transform node, containing a value that begins with AWS::Serverless.

  • CloudFormation Linter: Popular

  • CloudFormation
    • Create new YAML doc
    • Type start
    • Start typing resource name and hit TAB

Cloudformation Templates

Simplest stack

# noop.yml
Resources:
  WaitConditionHandle:
    Type: AWS::CloudFormation::WaitConditionHandle

Create stack

stack-create simplest.yml

cfn-flip

drift

  • describe-stack-drift-detection-status
  • describe-stack-resource-drifts
  • detect-stack-drift
  • detect-stack-resource-drift
  • detect-stack-set-drift