AWS – CloudFormation (Infrastructure As Code)

You can manage all your AWS stuff using the AWS gui web console.  However everything that you can do using the gui console, can also be done by using either the:


You can find all my latest posts on medium.
  • AWS API, which are accessible via a choice of SDKs.
  • AWS CLI (Command Line Interface) – Linux or Powershell

CloudFormation on the other hand lets you document your entire AWS infrastructure (i.e. a vpc) in the form of a json file.

In other words,  CloudFormation is the AWS equivalent of writing a vagrantfile for vagrant. The only difference being that your are writing about aws stuff and it is written using json syntax.

You can then store this json file in github and quickly build/rebuild new vpc instances from it. The json file can specify only part of a vpc environment rather than a whole environment, e.g. it could document just a single EC2 instance.

Stack: this is an instance of a CF template. You can use the template to created multiple stacks, e.g. a dev stack and a prod stack. A stack is essentially a collection of resources (ec2 instances, rds instances,…etc).


A CF template can create these resources inside an existing VPC, in which case you need to add a parameter in your CF template for specifying the VPC’s ID, or you can write a CF template to create the entire VPC along with all the resources that goes inside it.

Anatomy of a template.