Hello MyCloudFunners! It’s time to make your hands dirtier and create our first big resources in AWS. The foundation of every AWS environment is VPC which stands for Virtual Private Cloud. This service lets you provision a logically isolated section of the AWS Cloud where you can launch AWS resources (like EC2 instances, ECS, and many many more). As with traditional on-premises environments, the network is a fundamental of every IT system.

In our scenario, we will create the following setup:

access config Let’s describe in a brief some of the components of our VPC.

  1. VPC named “devops-vpc”, created with CIDR range in eu-west-1 region.
  2. Two public subnets created across two availability zones (eu-west-1a and eu-west-1b) to keep our solution high-available.
  3. Two private subnets created across two availability zones (eu-west-1a and eu-west-1b) to keep our solution high-available.
  4. Internet Gateway, named devops-ig attached to our VPC
  5. Two NAT Gateway, named “devops-ng-az-1” and “devops-ng-az-2” placed in corresponding public subnets
  6. Route table “main-public”, with default route to Internet Gateway. Two public subnets attached to it.
  7. Route tables “private-az-1” and “private-az-1” with default routes to corresponding NAT Gateways. Private subnets associated with them.

This is a typical solution, which you can find in many AWS setups.

AWS comes with really nice web console, which can easily help you to set up described VPC. However, in our scenario, we will use Terraform to provision this setup.

Terraform is a great tool to write, plan and create your infrastructure as a code (IaaC). AWS itself comes with their own service for this tasks called CloudFormation. The main advantage of Terraform over CloudFormation is that the first one is not limited to AWS solely. It can be used to provision the infrastructure for other cloud providers, like Google Cloud Platform or Azure.

For more information, go to the main Terraform webpage.

Before we begin to work on provisioning our infrastructure using Terraform, first we must install it. Below example shows the process of installation Terraform 0.11.8 under Ubuntu 16.04 LTS Linux

$ wget https://releases.hashicorp.com/terraform/0.11.8/terraform_0.11.8_linux_amd64.zip -O /tmp/
$ sudo unzip -o /tmp/terraform_0.11.8_linux_amd64.zip -d /usr/local/bin
$ rm -rf /tmp/terraform_0.11.8_linux_amd64.zip

Now you can check what exactly version has been installed as well as check what options are available in the current version

$ terraform --version
$ terraform --help

That’s all for now. In the next post, I’ll show you how to write the code to provision our VPC infrastructure.

Would be nice if you can comment my current work and advice in case of any mistakes :)