Deploy Amazon VPC using Terraform

Posted: January 5, 2018 in Amazon Web Services (AWS), AWS, Linux, terraform

In previous post   we deployed EC2 instance, now we’ll add directives to file to deploy VPC/subnet

Creating VPC

Add following lines to


resource "aws_vpc" "my_vpc" {

tags {


This will create VPC named “my_vpc with IP address block

Creating subnet

Add following lines below VPC code:

resource "aws_subnet" "my-subnet" {

tags {


Code above will add subnet to VPC “my_vpc” named “my-subnet”

vpc_id=”${}” is reference to “my_vpc” VPC

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s