VPC Peering :
Using a VPC peering connection, you can accelerate data transit. A networking connection between two VPCs known as a VPC peering relationship must be established in order to route traffic using private IPv4 or IPv6 addresses. Through the use of a VPC, instances can communicate with one another as if they were on the same network. A VPC in your own account or a VPC in another AWS account can be connected through a VPC peering arrangement. The VPCs could be found anywhere (also known as an inter-region VPC peering connection).
You can also utilize a VPC peering connection to give resources from one of your VPCs to other VPCs.
Inter-Region VPC peering is the process of establishing connections between VPCs in several AWS regions.
Each route is given a destination and a target in a table. For example, to enable your subnet to access the internet via an internet gateway, add the following route to your subnet route table. The end destination of the route is 0.0.0.0/0, which denotes all IPv4 addresses. The target is the internet gateway that is linked to your VPC.
As an internet gateway, you can use your personal computer to connect to an EC2 instance in AWS. An internet gateway is used as a target in your VPC route tables for traffic that can be routed via the internet. For IPv4 connections, the internet gateway also performs network address translation.
- Create 2 Vpc in the same region.
- Create 2 subnets in the same region.
- Create 2 INTERNET Gateways and attach them with your VPC.
- Create Route Table (Edit Route table and subnet for each of them).
Create 2 VPC for peering
Select a network for your vpc1 or vpc2; do not select the default one because the subnet will be modified automatically afterward. Also, TURN ON AUTO-ASSIGN PUBLIC IP and CREATE AN ECC2 INSTANCE.
Both produce the ideal Ping outcome.