Create Custom VPC with the Public and Private Subnet

  1. How to create a New VPC?
  2. How to create an Internet Gateway and attach it to the newly created VPC?
  3. How to Create a Public route table and add the Internet Gateway route to Public Route Table?
  4. How to Create two public and two private subnets and associate public subnets to public RT and private subnets to private RT?
  5. How to create or modify a Private RT?
  6. How to create a NAT gateway, and add a NAT gateway route to Private RT?
  7. How to modify auto-assign IP settings for public subnets?
  8. How to associate public subnets with public RT?
  9. How to associate Private subnets with private RT?
  • VPC CIDR will be divided into four subnets and each subnet have 64 IP addresses.
  • First public subnet has CIDR 10.0.0.0/26 (for addresses 10.0.0.0–10.0.0.63)
  • Second public subnet has CIDR 10.0.0.64/26 (for addresses 10.0.0.64–10.0.0.127).
  • The third private subnet has CIDR 10.0.0.128/26 (for addresses 10.0.0.128–10.0.0.191).
  • Forth private subnet has CIDR 10.0.0.192/26 (for addresses 10.0.0.192–10.0.0.255).
Create VPC
VPC CIDR
  • Provide the Name tag: It is the name of the VPC that you give to your VPC. Suppose I have given the name “CustomVPC-A”.
  • We can also put the VPC naming convention such as ProjectName-VPC-ENV example MyProjectVPCProd or MyProject-vpc-prod.
  • IPv4 CIDR block: Provide the address block as 10.0.0.0/24.
  • Tenancy -We make it a Default, Shared tenancy is the default tenancy in a VPC.
VPC created
Create IG
Create IG
  • Name tag: It is the name of the Internet Gateway, I have given the name “CustomeIG”.
Attach to VPC
Internet Gateway Attachment to the VPC
Internet Gateway Attached to the VPC
Create a Public Route table
Create a Public Route table
Public Route created.
Add Internet gateway to the Public RT
Add Internet gateway to the Public route table
Added Internet gateway to the Public route table
publicsubnet-01
PublicSubnet-01
PublicSubnet-02
PublicSubnets
PrivateSubnet-01
PrivateSubnet-01
All subnets
PrivateRT
Nat Gateway
Nat Gateway configurations
Nat Gateway
Attach this NAT to the Private RT
Attach this NAT to the Private RT
Attached this NAT to the Private RT
Modify auto-assign IP settings
Enable auto-assign public IPv4 address
public subnets associations
public subnets associations
public subnets associated
private subnets associations
private subnets associations
private subnets associated
  • When you create a VPC, a default route table, Network Access Control List, and default security group are automatically created but It won’t create any subnets, nor it will create a default internet gateway.
  • We have not covered all VPC components in this post.
  • Us-east-2a in your AWS account can be completely different. I have chosen the Ohio region.
  • Amazon always reserves 5 IP addresses — the first four (4) IP addresses and the last one (1) IP address of every subnet for IP networking purposes.
  • You must keep only one internet gateway per VPC.
  • This VPC is recommended when there is no requirement for a private subnet and can be used for a small range of CIDR.
  • You can also read about the VPC’s Architecture and its components and Basic VPC CIDR posts.

--

--

--

DevOps Engineer

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

Recommended from Medium

Setup VPC peering connection in Google Cloud

How Unix File Permissions Work

How to use Selenium with Docker on Google Compute Engine

NodeJS Docker Deployment Process

Sports Data in Transition | NoSQL Databases in Sports — Part 2

Windows Server Monitoring using Prometheus and WMI Exporter

NLP and Streamlit on Heroku

How To Handle Two Versions of autoconf?

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
Bikram

Bikram

DevOps Engineer

More from Medium

Apache APISIX < 2.12.1 Remote Code Execution

Kubernetes SSL Certificate Issue: “certificate resource is not owned by this ingress.

All you need to know about GitOps

Jenkins Shared Library Configuration