Create Public and Private Subnets in AWS

In this tutorial we will see how to create Public and Private Subnets on aws. In the era of Hybrid Infrastructure, its becomes necessary to have custom VPC for security purpose and also for compatibility with your existing on-prem infrastructure. We will create a custom VPC on aws from scratch.

Step 1: Login to aws console

https://console.aws.amazon.com

Step 2: Go to services and click on VPC under Networking & Content Delivery

public and private subnets

Step 3: There are two ways to create VPC

  1. You can click on Launch VPC wizard to create a VPC using wizard or you can click on VPCs to create it manually without using wizard. We will create it manually without using wizard.

2. Once we click on VPC below screen will appear, now click on Create VPC to create a new custom VPC

create vpc

Step 4: Now we will create our custom vpc

  1. We will name our vpc “my-vpc” under Name tag and select our CIDR block as 10.0.0.0/24.
  2. You can enter your desired CIDR in the IPv4 section.
  3. Under Tenancy section, there are two options ie Default and Dedicated, we will go with Default as of now as Dedicated Tenancy is chargeable.
  4. Under Tags, we will use Name tag and put value as my-vpc.
  5. Once all the VPC configuration details are in place, we can hit on Create VPC button to create our custom VPC.

As we can see our vpc is now created with the name my-vpc.

Step 5: Since our VPC is created, Now we need to create Public and Private subnets within our VPC

1.Click on VPC and select Subnets , Once we goto Subnets, we can see default subnets created by AWS.

2.Now we will create two Subnets in our VPC called Public Subnet and Private Subnet. Lets create Public Subnet by clicking on create Subnet button

3. For creating the Public Subnet, we will select our vpc called my-vpc and then we can name our subnet as Public-Subnet01 and define our subnet under IPv4 CIDR block as 10.0.0.1/25 and then we will click on Create Subnet.

Now our Public Subnet is created with required CIDR.

4. Now we will create our Private subnet named Private-Subnet01 and assign 10.0.0.128/25 CIDR

5. After providing the required values, click on Create subnet to create the Private Subnet. Now our both Public and Private subnets are created.

Conclusion:

We have successfully created a custom VPC and then we have created a Public and Private Subnets for our custom VPC.Now we can create resources under our VPC. To provide internet access to our instances which will be created under Public Subnets. We need to create a Internet Gateway for our VPC and attach the Public subnet to the same. We will cover the internet gateway configuration in our next session, so stay tuned.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments