This question is for AWS Engineers. I was reading about AWS VPC. It says VPC peering allows to connect 1 subnet to another subnet inside another VPC. Also it says, Instances on both subnet work as if they were in 1 subnet. So the question comes, "what happens if the IPs on both instances were identical?" Are they going to conflict? If not, how can I distinguish which one is which?
Thank you
This is an inaccurate description.
From VPC Peering:
A VPC peering connection is a networking connection between two VPCs that enables you to route traffic between them privately. Instances in either VPC can communicate with each other as if they are within the same network. You can create a VPC peering connection between your own VPCs, with a VPC in another AWS account, or with a VPC in a different AWS Region.
VPC Peering is a connection between two VPCs (not two Subnets). One of the rules for VPC peering is that the IP address ranges of the two VPCs cannot overlap. Thus, the situation described in the question cannot eventuate.
From Invalid VPC Peering Connection Configurations:
You cannot create a VPC peering connection between VPCs with matching or overlapping IPv4 CIDR blocks.
If the VPCs have multiple IPv4 CIDR blocks, you cannot create a VPC peering connection if any of the CIDR blocks overlap (regardless of whether you intend to use the VPC peering connection for communication between the non-overlapping CIDR blocks only).
Once a VPC Peering connection is established, the Route Tables need to be modified to route traffic across the VPC Peering connection. It is possible to modify only the route tables for a specific subnet, so this could be considered to be peering just a single subnet, but it would need to be specifically configured this way. (It is actually a common use-case, so that only a single subnet in each VPC is peered, acting as a type of DMZ for added security.)