How to Create AWS VPC in 10 steps, less than 10 min

  • Details definition of all related resources.
  • Implementation of all resources.
  • Integration between each resource.
  • In the end, you can find the cleanup activity.

Pre Requisites:

  • AWS Account.
  • You may have some knowledge about basic AWS services like EC2.
  • Networking knowledge is required (6-month Experience).

Virtual Private Cloud

Components of Amazon VPC

  • A Virtual Private Cloud: A logically isolated virtual network in the AWS cloud. You define a VPC’s IP address space from the ranges you select.
  • Subnet: A segment of a VPC’s IP address range where you can place groups of isolated resources.
  • Internet Gateway: The Amazon VPC side of a connection to the public Internet.
  • NAT Gateway: A highly available, managed Network Address Translation (NAT) service for your resources in a private subnet to access the Internet.
  • Route Table: A route table contains a set of rules, called routes, that are used to determine where network traffic from your subnet or gateway is directed.
  • DNS Hostname: The Amazon DNS server resolves a public DNS hostname to the public IPv4 address of the instance outside the network of the instance.
  • CIDR: Classless Inter-Domain Routing

Architecture / Block Diagram

Below are the 10 steps to Create and Verify your VPC

Let’s start the implementation.

Step 01. Create a VPC

  1. Login to your AWS Console.
  2. Create your VPC with Valid CIDR and name.

Step 02. Create 2 Public Subnet & Create 2 Private Subnet

  1. Click Subnet and create your Subnet with:
  2. Public Subnet 1 and Public Subnet 2 valid Name & VPC.
  3. Valid Subnet range which is valid IPv4 CIDR Block.
  4. Repeat steps 2 & 3, with Private Subnet too.

Step 03. Create IGW (Internet Gateway) & Attach to the VPC

  • Once IGW create, then attached this IGW in VPC

Step 04. Create Public and Private Route Table

Route table concepts

  • Main route table — The route table that automatically comes with your VPC. It controls the routing for all subnets that are not explicitly associated with any other route table.
  • Custom route table — A route table that you create for your VPC.
  • Edge association — A route table that you use to route inbound VPC traffic to an appliance. You associate a route table with the internet gateway or virtual private gateway, and specify the network interface of your appliance as the target for VPC traffic.
  • Route table association — The association between a route table and a subnet, internet gateway, or virtual private gateway.
  • Subnet route table — A route table that’s associated with a subnet.
  • Gateway route table — A route table that’s associated with an internet gateway or virtual private gateway.
  • Local gateway route table — A route table that’s associated with an Outposts local gateway. For information about local gateways, see Local Gateways in the AWS Outposts User Guide.
  • Destination — The range of IP addresses where you want traffic to go (destination CIDR). For example, an external corporate network with a 172.16.0.0/12 CIDR.
  • Target — The gateway, network interface, or connection through which to send the destination traffic; for example, an internet gateway.
  • Local route — A default route for communication within the VPC
  1. Create a Route table in the same VPC.
  2. Make sure you selected the right VPC and give a proper tag.

Step 05. Add IGW in Public Route table (0.0.0.0/0)

  • Click on the Public route table and click on the edit button.
  • Click on Add route from 0.0.0.0/0
  • Select Internet gateway from Target drop-down menu.
  • Click on save the routes.

Step 06. Add Public Subnet (1a & 1b) in Route table

  • Edit the Subnet Association.
  • Select the Public Subnet checkbox.
  • Click on the Save button.

Step 07. Create a NAT Gateway in Public Subnet

  • Select a Public Subnet
  • Create a new Elastic IP and associate
  • click on Create NAT Gateway

Step 08. Add NAT GW into the Private Route Table

  • Click on the Private route table and click on the edit button.
  • Click on Add route from 0.0.0.0/0
  • Select nat gateway from Target drop-down menu.
  • Click on save the routes.

Step 09. Add Private Subnet in Private Route Table

  • Edit the Subnet Association.
  • Select the PrivateSubnet checkbox.
  • Click on the Save button.

Step 10. Launch EC2 in this VPC & Validate your Connection

  • Download the putty & puttygen software to your windows server.
  • Change your pem file to ppk extension.
  • Connect from you putty
  • Connect with your MAC or Linux Machine with the below command.
chmod 400 file_name.pem
ssh - i file_name.pem ec2-user@your_pubilc_vm_ip
chmod 400 file_name.pem
ssh - i file_name.pem ec2-user@your_private_vm_ip
yum update -y

In case of any error, Add VPC CIDR Range in your Security Group.

Optional Steps:

Step 11. Edit DNS Resolution and Hostname

  1. Click on Action and Edit DNS hostname

Before ENABLE DNS HOSTNAME:

After Enable DNS HOSTNAME:

Step 12. Cleanup the VPC Resources

  1. Terminate EC2 instances, which will remove the network interface card (NIC), attached with Private or Public IP
  2. Remove Elastic IP
  3. Terminate NAT Gateway
  4. Dtattached Internet Gateway (IGW)
  5. Delete IGW
  6. At last, you can Delete your VPC, and this step will delete all the related VPC resources.

Part One: Please find the VPC Creation Video.

Part Two: Please fine the DNS Hostname & VPC Cleanup Video

  1. VPC Creation, Subnet Creation, IGW, NGW, Route table.
  2. Subnet association & IGW/NGW Attachment with Route Table.
  3. EC2 instance connectivity with the private and public subnet
  4. DNS Hostname Setup.
  5. VPC Clean up Activity.

--

--

--

AWS APN Ambassador | SME of DevOps DevSecOps | Cloud Architect & Trainer | Blogger | Youtuber |Chef

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GoReleaser And Software Supply Chain Security

KNIME for Supply Chain Management

From Data Lake to No Sql Table

The solution to the Firestore batched write limit

Tutorial | Step-by-Step Guide for Upgrading to the new imToken

Getting To The Root Of Sorting With Radix Sort

NFT Farm Event

Lining up Audio & Visual to Build Cutscenes in Unity

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

Varun Kumar Manik

AWS APN Ambassador | SME of DevOps DevSecOps | Cloud Architect & Trainer | Blogger | Youtuber |Chef

More from Medium

How to Get an Extra 30 Minutes on your AWS Exam

High level Benefits and Things to consider when considering to use Jenkins

Avoid Dangerous Cloud Migration Mistakes with these 4 Tips

Skills for becoming a DevOps Engineer