Configure custom VPC create 2 subnet one is private, and one is public.

1.11. Create VPC

2.  2. Create Subnet and attach with VPC (Ex: Web-Subnet, DB-Subnet)

3.  3. Create an Internet Gateway (Ex: igw-pTools)

4.  4. Create a Route Table and subnet associations.

5.       Route Table-- Define the Destination point (Word Wide Access ip 0.0.0.0/0)

6.  5. Create EC2 Server (Ex: Web-Server, DB-Server)- During creation attach VPC and Enable or Disable public access.

7.   6. Access EC2 -Web-Server with public key

8.       For Access Web server to DB Server internally (local)

9.   7. Create a pair key in Web-Server

             [root@ip-10-0-0-160 ec2-user]# vi pTools_Mumbai_Key.pem

                                                                      Put the Key Data in this file.

108. Provide permission Chmod 600

             [root@ip-10-0-0-160 ec2-user]# chmod 600 pTools_Mumbai_Key.pem

199.Access DB-Server from Web-Server

            [root@ip-10-0-0-160 ec2-user]# ssh ec2-user@10.0.1.151 -i pTools_Mumbai_Key.pem

      Check Internet Accessibility

              [root@ip-10-0-1-151 ec2-user]# ping 8.8.8.8

             We can’t Access from DB Server to Internet. Exit from DB-Server.

              [ec2-user@ip-10-0-1-151 ~]$ exit

1110.Access (ping) the internet from Web-Server

[root@ip-10-0-0-160 ec2-user]# ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_seq=1 ttl=51 time=1.75 ms

64 bytes from 8.8.8.8: icmp_seq=2 ttl=51 time=1.73 ms

^C

1311If we want to ping the internet from our DB-Server then it will not connect directly to the internet due to security reasons. So we will create NAT GateWay inside the Subnet (which is connected to the internet Ex: Web-Subnet).

1412. Create NAT GateWay inside Web-Subnet and assign Public Elastic IP.

1513.Create a route table for DB-Server under VPC. Ex-DB-RT

1614.Route table associate's subnet associations and then defines Destination path in route table i.e., internet path. Here use NAT Gateway as Target.

1715. Now internet ping from DB-Server

[ec2-user@ip-10-0-1-151 ~]$ ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.

64 bytes from 8.8.8.8: icmp_seq=1 ttl=50 time=1.67 ms


*****************Happy Learning****************

Comments

Popular posts from this blog