A Virtual Private Cloud (VPC) is a dedicated, isolated virtual network within your AWS account where you can launch AWS resources.
A VPC Peering Connection links two VPCs, allowing them to route traffic privately using IPv4 or IPv6 addresses, enabling instances in both VPCs to communicate as if they are on the same network.
https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html
In VPC Peering, data is exchanged securely between two VPCs after the target VPC accepts a connection request. To establish this, navigate to the VPC service, select Peering Connection, and click Create VPC Peering. Provide a name, select the source and target VPCs, and initiate the connection. This setup enables controlled communication between isolated networks.
if the status shows “Pending,” to complete the peering connection, click on the peering connection, go to “Action,” and click on “Accept.” This step finalizes the connection between the VPC
After creating the connection, it won’t work immediately. You’ll need to configure the route tables. Go back to the route table associated with your subnets and add the necessary routes for the peered VPC. This ensures that the traffic is directed properly between the connected VPCs.
To enable “production peering” in the “test-route” table, select the “test-route,” go to “Route,” click on “Edit route,” add the “CIDR block” for the production VPC, set the target as “Peering Connection,” and then save the changes. This configuration allows traffic to flow between the test and production VPCs through the established peering connection
Similarly, in the production route table, repeat the process. Go to the production route table, navigate to “Route,” click on “Edit route,” add the “CIDR block” for the test VPC, set the target as “Peering Connection,” and save the changes. This ensures bidirectional communication between the test and production VPCs through the established peering connection
Now, go to the “EC2,” open the “test-server” security group (SG), go to “Edit Inbound Rule,” and add “ICMP.” This step ensures that the security group allows incoming ICMP traffic, facilitating the ping test between the test and production servers across the peered VPCs.
Repeat the process for the production server’s security group. Open the “prod-server” security group, go to “Edit Inbound Rule,” and add “ICMP.” This step ensures that both servers, in the test and production VPCs, allow incoming ICMP traffic, enabling the ping test between them through the established VPC peering connection
Conclusion:
VPC peering in AWS provides a secure and controlled means for interconnecting isolated Virtual Private Clouds. By establishing peering connections, resources in different VPCs can communicate seamlessly
Top comments (0)