11.6 VPC Peering & ClassicLink
Last updated
Was this helpful?
Last updated
Was this helpful?
VPC Peering is simply a connection between two VPCs that enables you to route traffic between them using private IP addresses. Instances in either VPC can communicate with each other as if they are within the same network. Instances in different VPCs can communicate with each other use internal IP addresses spaces without having to go out through the Internet. You can create a VPC peering connection between your own VPCs, or with a VPC in another AWS account. The VPCs can be in different regions (also known as an inter-region VPC peering connection).
AWS uses the existing infrastructure of a VPC to create a VPC peering connection. It is neither a gateway nor a VPN connection, and doesn't rely on a separate piece of physical hardware. There is no single point of failure for communication or a bandwidth bottleneck.
A VPC peering example:
However, if we change the IP address range of VPC B,
Transitive Peering is NOT supported. Instances in VPC A cannot communicate with the instances in VPC C directly. You have to peer VPC A with VPC C. You've always got to have a one to one peering connection.
VPC Peering Limitations:
You can NOT create a VPC peering connection between VPCs that have matching or overlapping CIDR blocks.
VPC peering does NOT support transitive peering relationships.
Up until now, you learnt how to got a Virtual Private Cloud (VPC) which has lots of benefits and advantages, but the EC2 instances that were not running within a VPC (commonly known as EC2-Classic) had to use public IP addresses or tunneling to communicate with AWS resources in a VPC. They could not take advantage of the higher throughput and lower latency connectivity available for inter-instance communication. This model also resulted in additional bandwidth charges and has some undesirable security implications.
ClassicLink allows you to link your EC2-Classic instance to a VPC in your account, within the same region. This allows you to associate the VPC security groups with the EC2-Classic instance, enabling communication between your EC2-Classic instance and instances in your VPC using private IPv4 addresses. ClassicLink removes the need to make use of public IPv4 addresses or Elastic IP addresses to enable communication between instances in these platforms.
ClassicLink is available to all users with accounts that support the EC2-Classic platform, and can be used with any EC2-Classic instance. There is no additional charge for using ClassicLink. Standard charges for data transfer and instance usage apply. Go to VPC, select a VPC and right click, choose Enable ClassicLink.
It is not going to work because A, B got the same internal address range, so they share overlapping CIDR block. VPC A and VPC B are not able to peer, so they are not able to communicate with each other.