aws vpc peering

Understanding AWS VPC Peering




So today, I ‘ve tried a new feature of AWS VPC  name “AWS VPC Peering”

Problem statement/Usecase : I have database server in a completely different VPC but now I want that the same database server is to be used by a new application which is deployed on other VPC.

Old outdated solution : I could’ve created a copy of database, launched a new database instance import the copy to it. Sounds straight forward, right!,  But Is it cost efficient?, How much will it take to spun up new database instance?, In-order to take a copy of database instance, what will be the down time?, How much will I’ve to pay more for it?, etc..


Well, best suited solution for this usecase scenario is AWS VPC Peering!

VPC Peering is feature where you can bridge two or more VPC’s, A VPC peering connection will allows you to route traffic between the peer VPC’s using private IP addresses; as if they are part of the same network.

VPC Peering can be between VPC’s of different account’s or same account internally. I order to enable VPC one has accept a “VPC peering request” first to initiate peering of VPC’s

Advantages :
  • Saves time as you don’t need to make backup’s and spun up a new database instance and restore those backup’s
  • Cost efficient, You’re not paying for an another database instance and VPC peering does not include any cost.
  • Easy to configure, You just have to make entries on each VPC’s routing tables and that’s it.
  • Reliable, As you don’t have to worry about connectivity issues as it will use AWS low latency network.
Limitations :
  • You cannot perform peering if both VPC have same CIDR, but you can perform VPC if you have a different CIDR.
  • You cannot edit the VPC peering connection once it is created.
  • You cannot attach or detach VPC peering connection
  • Once you’ve accepted VPC peering request you can’t change or deny it later.
  • VPC peering connection work in one-to-one scenario only. There will only two VPC’s in a VPC peering connection.
  • You can have multiple peering connection for a VPC, but it should’ve different Peered VPC. For eg : VPC “A” can be peered with VPC “B” but if you want to connect VPC “A” with VPC “C” then you will need to make a new peering connection which will include VPC “A” and VPC “C”.
  • You can have star,ring topology kind of structure between VPC‘s 

 

VPC’s can be peered in many scenarios :
  • Two VPCs Peered Together

vpc-scenario1

  • One VPC Peered With Two VPCs

vpc-peered-2

  • Three VPCs Peered Together

vpc-peered-3

  • One VPC Peered With Multiple VPCs

vpc-peered-many

 

Futher I’ll be posting steps to create a VPC peering!

Go to below link : http://bhargavamin.com/how-to-do/create-aws-vpc-peering-connection/

 

References :

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-peering.html

http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide/peering-configurations-full-access.html

http://docs.aws.amazon.com/AmazonVPC/latest/PeeringGuide/Welcome.html