How to Create VPC & Subnets on Amazon Web Service(AWS).

Amazon Virtual Private Cloud (Amazon VPC) is a service that lets you launch AWS resources in a logically isolated virtual network that you define. You can use both IPv4 and IPv6 for most resources in your virtual private cloud, helping to ensure secure and easy access to resources and applications.

A public subnet is a subnet that’s associated with a route table that has a route to an internet gateway. A private subnet with a size /24 IPv4 CIDR block. This connects the VPC to the internet and to other AWS services. Instances with private IPv4 addresses in the subnet range.

 

  • Login to aws portal.
  • Click on Services.

 

Fig 1

 

  • Under Networking & Content Delivery select VPC.

 

Fig 2

 

VPC(virtual private cloud)

  • Click on VPCs.

 

Fig. 3

 

  • Click on Create VPC.

 

Fig. 4

 

  • Provide VPC tag name.
  • Provide IPv4 CIDR block.
  • Select Tenancy :Dedicated or default. Dedicated tenancy ensures all EC2 instances that are launched in a VPC run on hardware that’s dedicated to a single customer instead, they can use the AWS CLI/SDK to ensure that all new instances in the VPC are launched with default tenancy.

 

Fig. 5

 

  • Click on Create VPC.

 

Fig. 6

 

  • After sometime VPC is ready.

 

Fig. 6

 

Subnets

  • Then click on Subnets.

 

Fig. 7

 

  • Click on Create subnet.

 

Fig. 8

 

  • Select existing VPC ID.

 

Fig 10

 

  • Then add a subnet.
  • Provide subnet tag name.
  • Select availability zone.
  • Provide IPv4 CIDR block.

 

Fig 10

 

  • We can add multiple subnets as per requirements.
  • Click on Create subnet.

 

Fig 11

 

  • After sometime Subnet is ready.

 

Fig 12

 

Create VPC & Subnet using Shell

To create a VPC

aws ec2 create-vpc –cidr-block 10.0.0.0/16

To create a VPC with dedicated tenancy

aws ec2 create-vpc –cidr-block 10.0.0.0/16 –instance-tenancy dedicated

To create a Subnet

aws ec2 create-subnet –vpc-id existing-vpc-id –cidr-block 10.0.1.0/24

Leave a Reply

Your email address will not be published.