How to Create a public VPC

VPC Name: MyVPC

CIDR : 10.0.0.0/16

Public Subnet: 10.0.1.0/24

Private Subnet: 10.0.2.0/24

  1. Create VPC
Image for post

Login to AWS management console and navigate to the VPC console. Select “Your VPCs” from the sidebar and click on “Create VPC”.

Note: There will be a VPC created by default, DO NOT delete it or make any changes to it

Enter VPC CIDR details as below name tag: MyVPC

Image for post

IPv4 CIDR block* : 10.0.0.0/16

Leave the remaining settings as it is and click “Yes, Create” button. Note that, upon creation of “MyVPC”, it will automatically create a default “Route table” and a “Network ACL” for “MyVPC”.

2. Create Public Subnet

Make sure to select “MyVPC” under “VPC” drop-down menu and enter 10.0.1.0/24 in “IPv4 CIDR block” for public subnet.

Image for post

3. Create Private Subnet

Now create Private subnet with CIDR 10.0.2.0/24

Image for post

4. Create and Attach “Internet Gateway”

Create and Attach “Internet Gateway” to our newly created VPC “MyVPC”.

Note: There will be a default Internet Gateway, DO NOT detach/delete it.

Once created, it will be in “detached” status. We need to attach it to “MyVPC”.

Now “MIG” status will turn into “attached”.

Image for post

5. Add a route to Public Subnet

To make the instances created in Public subnet internet accessible, we will create a new “Route table”, that will establish a connection between Public subnet and Internet Gateway.

Note: It is not recommended to modify the “main” route table that was created by default when “MyVPC” was launched.

Image for post

Create a new Route table with name “PublicRT”.

Image for post

Select “public”, click on “Routes” tab and “edit”.

Image for post

Add “0.0.0.0/0” as “Destination” and click on next box, it should list the “Internet Gateway” that we created before, select it and click on “Save”.

Image for post

Associate this “PublicRT” with Public subnet “PublicNet”.

Image for post

Select “PublicNet” and click “Save”

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