Skip to main content

CREATING EC2 UNDER NEW VPC AND SUBNET IN AWS

In this article we will create a new vpc and a subnet first.Then we will create a internet gateway and route the traffic through this gateway.



creation of VPC

From AWS dashboard Click VPC > Create VPC .




Give a name tag, ipv4 addresss and click Yes Create

creation of subnet 



 From VPC subnet > Click on subnet.Give subnet and select our vnet.Give necessery datails as follows and click yes create



 creation of internet-gateway
  From VPC dashboard > Internet gateways > Create Internet gateway.Give name and click create



Creating Routing table
Go to subnet Assosiation and attach ou subnet.Now go to routes and give Destination as 0.0.0.0/0 and target as internet gateway as follows








 Creation of ec2 instance
From dashboard > ec2 > Launch instance > Select the ami image we want(Here i selected amazon instance) > select size we want (t2.micro) > Now select number of instances,select our vpc and subnet  and click next > now specify size of root partition(default it comes with 8GB),Click Next  > Now give Name tag that we want and click next > Now select our security group(here i created new one),click next > click Launch > specify our key pair(tick on acknowledgement) and click Launch instance