satish8450 / Documents-AWS

Documents Listed her
0 stars 0 forks source link

VPC Setup #5

Open satish8450 opened 1 year ago

satish8450 commented 1 year ago

These are the following procedure to setup VPC Vpc is customized network to isolate the application

Step 1: First we need to create VPC with one public and private subnet Ex : VPC cidr block is 10.0.0.0/16 total 65,536 Ips will allocate subnet1 PUBLIC 10.0.0.0/24 total 256 ips will allocate subnet2 PRIVATE 10.0.1.0/24 total 256 ips will allocate Remaining Ips Will be future purpose

Step 2: IGW

Create INTERNETGATEWAY and attach to present VPC For Internet access

Create two Route tables for two Subnets, RT1 Should be associated with Subnet1(Public) and edit routes as 0.0.0.0 target as IGW for Internet access in Subnet1, Subent2 No need to edit

Step 3 : EC2 Creation

launch two Instances under VPC Public and Private subnets
We can able to access the Public subnet instance because this subnet associated with rotatable, we define route table rule as 0.0.0.0/0 target as IGW 
Private Subnet instance don't have rotatable but can connect through public instance by using pem key and ssh connection.

Below command we need to run in public server :

ssh -1 pem.key ec2-user@IPofPrivateserver

we need to create pem.key file copy the key from local

satish8450 commented 1 year ago

VPC-Peering Here we can establish connection between two VPC's which is there in two different AZ's or same AZ's

VPC-1 ( Create VPC-1 with some CIDR block) Subnet ( Create Subnet1 with in the CIDR block range) IGW ( Create IGW1 and Attach to VPC1 for internet Acces) Route Table ( Create Routetable1 ,Asociate RT1 to Subnet1 and we need to add route 0.0.0.0 target as IGW) Security Groups ( Create SG1 and rules as Allow All 0.0.0.0/0)

Launch the instance with above Infra

VPC ( Create VPC-2 with some CIDR block) Subnet ( Create Subnet2 with in the CIDR block range) IGW ( Create IGW2 and Attach to VPC2 for internet Acces) Route Table ( Create Routetable2 , Asociate RT2 to Subnet2 and we need to add route 0.0.0.0 target as IGW) Security Groups ( Create SG2 and rules as Allow All 0.0.0.0/0)

Launch the instance with above Infra

We have two server are up and running .

Go to Peering connection Create Peering connection VPC1 will be Requester, VPC-2 will be Accepter ( VPC1 <---> VPC2) Here connection's will established between vpc's not for Servers

For establishing connection between Servers we need to Edit RT1 routes with VPC2 CIDR block(Destination) Target ( Peering connection) as well Edit RT2 routes with VPC1 CIDR Block

Realtime we will use Private IPS Instead of CIDR block

Note : If we want to VPC peering with another Region, That vpc server should have same keypair then only we can able to communicate

  By Default all servers in different AZ's will connect automatically with in the same VPC (1a connect with 1b and 1c)
VPC Peering