AWS — Infrastructure as Code Tutorial — Step 1.1 — CloudFormation

  • Perform operations as code: In the cloud, you can apply the same engineering discipline that you use for application code to your entire environment. You can define your entire workload (applications, infrastructure, etc.) as code and update it with code. You can script your operations procedures and automate their execution by triggering them in response to events. By performing operations as code, you limit human error and enable consistent responses to events.
  • Make frequent, small, reversible changes: Design workloads to allow components to be updated regularly to increase the flow of beneficial changes into your workload. Make changes in small increments that can be reversed if they fail to aid in the identification and resolution of issues introduced to your environment (without affecting customers when possible).

Getting started .. with failure

  • Anything in Yaml is Key: Value
  • Indents are Important
  • Do not use TAB — use the same numbers of spaces for indentation
  • Some Keys contain subkeys, and are referred to as sections
  1. Stack will start running
  2. Stack will fail after sometime

CFN-LINT — avoiding a long wait in the line

  1. We had to upload the template 3 times
  2. Two times it failed, and we had to spend time watching the console


  • We now have some knowledge of Yaml syntax. — Read more about Yaml language syntax
  • We touched upon AWS CloudFormation template anatomy and learned about the only required section in template — Resources. — Read more about AWS CloudFormation template anatomy
  • We started to troubleshoot our template locally, which will save us time, before deploying template which is syntactically correct from the Yaml side, but violates AWS rules on allowed Resources values or limits. — Read more about cfn-lint.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store