Using Cloudformation to Create a Virtual Private Cloud in AWS

Creating your network infrastructure in AWS is simplified by a service called Cloudformation. Cloudformation allows you to specify your network subnets, groups, and other resources in a JSON file. When you submit that JSON file to AWS, the service will create the resources in your AWS account. This article demonstrates Cloudformation by creating a basic virtual private cloud (VPC) with an accompanying subnet and gateway. You will need an AWS account to test this out. Preferably you would also have read about using the command line AWS client.

A Cloudformation template is a JSON file that describes each resource in your network. Every resource has a specific set of attributes that you can define within this template. Amazon documents all resources and their attributes on its on site as well, so take a look at it for more complete details.

The general structure of a template is a basic map of resources within a “Resources” id. Each resource has a Type and various Properties. A VPC resource that defines a set of IP addresses in a 10.0.0.0/28 block, looks like this: