{"id":18146,"date":"2015-03-19T11:50:24","date_gmt":"2015-03-19T06:20:24","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=18146"},"modified":"2015-03-19T13:14:28","modified_gmt":"2015-03-19T07:44:28","slug":"vpc-peering-in-aws-cloud","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/vpc-peering-in-aws-cloud\/","title":{"rendered":"VPC Peering In AWS Cloud"},"content":{"rendered":"<p><span style=\"text-decoration: underline\"><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><span style=\"color: #000000\"><b>So what is AWS VPC Peering ?<\/b><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>A VPC peering connection is basically a networking connection between two VPCs that enables you to route traffic between them using private IP addresses.<\/p>\n<p style=\"text-align: left\"><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: large\"><span style=\"text-decoration: underline\"><b>Basics of VPC Peering<\/b><\/span><\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">So what does it take to make a VPC peering connection ?\u00a0Firstly the owner of the requester VPC sends a request to the owner of the VPC-II with which he wants to make the VPC peering connection. VPC peering connection is made at the CIDR block level, so you need to be clear about what CIDR is.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">After the request is accepted peering connection is made and AWS gives you a Peering Connection ID in for of &#8220;pcx12345678&#8221;.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Then what you need to do is simply update the routing tables at VPC level &amp; security groups at instance level according to your use.<\/span><\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-18148 aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc1.png\" alt=\"vpc1\" width=\"312\" height=\"186\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: left\"><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><strong><span style=\"color: #000000\"><span style=\"font-family: Georgia, 'Bitstream Charter', serif\"><span style=\"font-size: large\"><span style=\"text-decoration: underline\"><b>A Simple Scenario<\/b><\/span><\/span><\/span><\/span><\/strong><\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: Georgia, 'Bitstream Charter', serif\"><span style=\"font-size: medium\">In this scenario, you have two or more VPCs that you want to peer to enable full sharing of resources between.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Here are the VPCs that I have created in my account.<\/span><\/span><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18153\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc2.png\" alt=\"vpc2\" width=\"853\" height=\"149\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><img alt=\"\" align=\"left\" \/><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Subnets associated with each VPC.<\/span><\/span><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18154\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc3.png\" alt=\"vpc3\" width=\"956\" height=\"257\" \/><\/a><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><span style=\"text-decoration: underline\"><b>Note<\/b><\/span><b>:-<\/b> There is no need of any <strong>NAT instance<\/strong> here as VPC-Peering states that instances in different VPCs can communicate with each other by their private IP addresses as if they are in same VPC.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">You need to have one instance in public subnet of VPC-I and one in private subnet of VPC-II<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Now, create a\u00a0<\/span><\/span><\/span><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>VPC-Peering<\/b><\/span><\/span><\/span><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>connection<\/b><\/span><\/span><\/span><\/strong><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0.You will find \u201cPeering connections\u201d option in VPC console.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">After clicking on\u00a0<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>Peering connections<\/b><\/span><\/span><\/span><\/strong><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">, Go to \u201cCreate VPC Peering Connection\u201d<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Make a peering connection between VPC-I (VPC to Peer ) to VPC-II(VPC to peer with) . If you are making an\u00a0<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>inter-account VPC peering connection<\/b><\/span><\/span><\/span><\/strong><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0then select the option \u201cAnother account\u201d in peer with option .Then it will ask for the Account ID and VPC ID.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #444444\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Then click the \u201cCreate\u201d button and a request will be sent to the VPC-II.<\/span><\/span><\/span><br \/>\n<a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc6.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18157\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc6.png\" alt=\"vpc6\" width=\"914\" height=\"376\" \/><\/a><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">A request will appear like this in your AWS\u00a0console.<\/span><\/span><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc7.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18158\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc7.png\" alt=\"vpc7\" width=\"1062\" height=\"561\" \/><\/a><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Accept the Peering Connection.<\/span><\/span><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc8.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18159\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc8.png\" alt=\"vpc8\" width=\"918\" height=\"391\" \/><\/a>After accepting request the VPC-Peering connection will be active which will look like this.<\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc9.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18160\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc9.png\" alt=\"vpc9\" width=\"1052\" height=\"70\" \/><\/a><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Updating the <\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">routing tables<\/span><\/span><\/span><\/strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"> for each VPC.\u00a0In VPC 1&#8217;s route table add CIDR block of VPC-II in destination option of new line and in target option choose the VPC-Peering connection ID(pcx-5a46ba33) &amp; vice-versa.<br \/>\n<\/span><\/span><\/span><br \/>\n<a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc10.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-18161\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/vpc10.png\" alt=\"vpc10\" width=\"908\" height=\"244\" \/><\/a>\u00a0(pcx-54a46ba33 is the VPC peering connection ID which i got when peering connection was made)<\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>Save the settings<\/b>.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Now, all the <strong>configurations<\/strong> have been made<strong>. <\/strong>Your instances now can be connected inter-VPC by their private IPs.\u00a0The architecture will be<strong> :-<\/strong><\/span><\/span><\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/Untitled-Diagram-1.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-18269 alignnone\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/03\/Untitled-Diagram-1.jpg\" alt=\"Untitled Diagram (1)\" width=\"892\" height=\"451\" \/><\/a><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Finally, you can check whether you can login into your private instance in VPC-II directly by your private instance in VPC-I.<\/span><\/span><\/span><\/p>\n<p><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><span style=\"text-decoration: underline\"><b>Note<\/b><\/span><\/span><\/span><\/span><\/strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>:-\u00a0<\/b><\/span><\/span><\/span><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Keep your Credentials with you ( .Pem Files ) for login.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">Now, you will be able to login to your private servers in different VPCs. So\u00a0<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>VPC-Peering<\/b><\/span><\/span><\/span><\/strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0is<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0<\/span><\/span><\/span><\/strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">successfully<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0<\/span><\/span><\/span><\/strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">implemented.<\/span><\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">*<\/span><\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\">\u00a0<\/span><\/span><\/span><\/strong><strong><span style=\"color: #000000\"><span style=\"font-family: 'DejaVu Sans', sans-serif\"><span style=\"font-size: medium\"><b>I would like to thank my colleague Tarun Saxena without whom this post would not have been possible.<\/b><\/span><\/span><\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So what is AWS VPC Peering ? A VPC peering connection is basically a networking connection between two VPCs that enables you to route traffic between them using private IP addresses. Basics of VPC Peering So what does it take to make a VPC peering connection ?\u00a0Firstly the owner of the requester VPC sends a [&hellip;]<\/p>\n","protected":false},"author":174,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2},"categories":[1174],"tags":[248,1692,1693],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18146"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=18146"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18146\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=18146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=18146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=18146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}