❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

AWS-VPC (Peering Connections)

By: Kannan
26 December 2023 at 17:46

A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them using private IPv4 addresses or IPv6 addresses. Instances in either VPC can communicate with each other as if they are within the same network.

  • VPC peering connections are limited on the number of active and pending peering connections that you can have per VPC.

  • VPC peering is a technique for securely connecting two or more virtual private clouds, or VPCs

Image description

Step-1. As per the above VPC Peering connection architect Create a VPC and subnet and Rout table.

Image description

Image description

Image description

  • Associate the subnet with the route table.

Image description

Step-2. Create the Internet Gateway and attach the VPC.

Image description

  • Edit and add the Internet Gateway in the route table.

Image description

Step-3. Create the EC2 Instance with VPC-A network settings and Publich IP enabled on the Subnet and Instance.

Image description

Step-4. As the above steps we have created another VPC, Subnet and Route table.

Image description

Image description

Image description

  • Associate the Subnet on the route table and create EC2 Instance.

Image description

Image description

Step-5. We need to copy the .pem key from local and paste in the Primary VPC-A to get SSH access for another VPC-B.

  • Not getting connect to the secondary VPC EC 2 Instance via SSH.

**Step-6. **Create a peering connection.

Image description

  • Accept the Peer Request.

Image description

Step-7. Add the Secondary IPV4 CIDR range and select the peering connection and save on the Primary Route table.

Image description
Step-8. Add the Primary IPV4 CIDR range and select the peering connection and save on the Secondary Route table.

Image description

Step-9. Now we able to access the Secondary VPC EC2 Instance through the Primary VPC EC2 Instance via Peering connection.

AWS-Virtual Private Cloud VPC(Subnet,Route table,Internet Gateway,NAT gateway)

By: Kannan
26 December 2023 at 15:22

A virtual private cloud (VPC) is a virtual network dedicated to your AWS account. It is logically isolated from other virtual networks in the AWS Cloud. You can specify an IP address range for the VPC, add subnets, add gateways, and associate security groups.

  • users can avoid underutilizing their resources during periods of low demand or overloading their infrastructure during peak periods. Overall, the advantages of using VPC for your infrastructure include improved security, greater flexibility, and scalability.

  • We are going to create a VPC on particular availability zone and differentiate with Public and private subnet/Route table as mentioned in the architect diagram.

Image description

Step-1. Create a VPC with tag of VPC-A

  • Select and make range for IPV4 CIDR, select the No IPV6 CIDR Block.

Image description

Step-2. Create a Subnet with the VPC ID we created.

  • verify the availability zone and IPV4 VPC CIDR and provide the range of subnet on IPV4 subnet CIDR to create the subnet.

Image description

Step-3.Create a Route table

  • select the VPC and create the route table
    Image description

  • Once route table created associate the subnet with the table. and enable the "Auto assign public IP"

Image description

Image description

Step-4. Create an Internet gateway and attach it with the VPC which we created.

Image description

Image description

  • Add the Internet gateway on the route table.

Image description

Image description

Step-5. Create an EC2 instance

  • On Network settings select the VPC,subnet,and public IP enable.

Image description

  • we are able to access the EC2 instance using public IP via SSH.

Step-6. Now we need to create the private subnet and route table, associate the private subnet on the route table.

Image description

Image description

Image description

Step-7. Create an EC2 instance

  • On Network settings select the VPC,private subnet.

Image description

  • Login to the Public VPC Instance and copy the .pem key from the local to get SSH access for the private instance.

  • We are able to login public Instance and get connected to Private Instance via Local gateway.

  • If we need to access internet on private instance to install any application need to create the NAT gateway.

Step-8.Create a NAT Gateway

  • select the public instance subnet range and allocate the "Elastic IP".

Image description

Step-9. Add the NAT gateway on the private Route table to get internet access on the private Instance.

Image description

Image description

  • We are successfully login to the public instance via SSH and from the public-EC2 we are able to login to private and access the internet.
kannan@kannan-PC:~$ ssh -i apache.pem ubuntu@13.201.97.155
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.2.0-1017-aws x86_64)

ubuntu@ip-192-168-1-99:~$ ssh -i apache.pem ubuntu@192.168.2.221
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.2.0-1017-aws x86_64)


ubuntu@ip-192-168-2-221:~$ 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.90 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=50 time=1.55 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=50 time=1.56 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 1.546/1.671/1.904/0.164 ms
ubuntu@ip-192-168-2-221:~$ ping www.google.com
PING www.google.com (142.251.42.4) 56(84) bytes of data.
64 bytes from bom12s19-in-f4.1e100.net (142.251.42.4): icmp_seq=1 ttl=109 time=1.79 ms
64 bytes from bom12s19-in-f4.1e100.net (142.251.42.4): icmp_seq=2 ttl=109 time=1.58 ms

❌
❌