{"id":2669,"date":"2018-01-22T21:43:33","date_gmt":"2018-01-22T21:43:33","guid":{"rendered":"http:\/\/blog.paranoidprofessor.com\/?p=2669"},"modified":"2018-06-13T18:26:08","modified_gmt":"2018-06-13T18:26:08","slug":"aws-setting-up-a-vpc","status":"publish","type":"post","link":"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/01\/22\/aws-setting-up-a-vpc\/","title":{"rendered":"AWS &#8211; Setting up a VPC"},"content":{"rendered":"<p>I would rather talk about the actual compute engine (EC2) but that oddly enough you need a network before you can really create one.\u00a0 Rather than talking about the default VPC I will discuss about the networking a bit right now.<\/p>\n<h2>Amazon Web Services VPC<\/h2>\n<p>A virtual private cloud (VPC) is essentially all of the networking infrastructure you would need in a virtual environment.\u00a0 When creating a network at home you really don&#8217;t need very much.<\/p>\n<ul>\n<li>Internet gateway<\/li>\n<li>CIDR block<\/li>\n<\/ul>\n<p>In a home network this usually boils down to a router that is connected to the internet.\u00a0 The CIDR block is usually one of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Private_network\" target=\"_blank\" rel=\"noopener\">non-routable networks<\/a>.\u00a0 My home network is 192.168.178.0\/24.<\/p>\n<p>The process when creating a VPC on Amazon is pretty much the same.<\/p>\n<ul>\n<li>Create a VPC for a given CIDR block for entire network<\/li>\n<li>Create one or more subnets for the network<\/li>\n<li>Create a an internet gateway<\/li>\n<li>Attach gateway to my VPC<\/li>\n<li>Add route to from VPC to rest of internet<\/li>\n<li>Setup any special firewall rules<\/li>\n<li>Create a security group<\/li>\n<\/ul>\n<p>Before I cover all of the steps that are necessary for completely setting up a VPC it is important to note that Amazon makes it really easy to set all of this up with much less effort.\u00a0 It is possible to create a default VPC which will create everything that is necessary.<\/p>\n<h2>Create a VPC for a given CIDR block for entire network<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2670\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-vpc-create-vpc.png\" alt=\"\" width=\"704\" height=\"438\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-vpc-create-vpc.png 704w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-01-vpc-create-vpc-300x187.png 300w\" sizes=\"(max-width: 704px) 100vw, 704px\" \/><\/p>\n<p>All of the setup will be associated with samplevpc and the CIDR block 192.168.\u00a0 It is also possible to create a IPv6 network as well, but as IPv6 addresses are pretty horrible to look at I will leave that off.\u00a0 It is enough to know that Amazon does also provide support for that new(ish) standard.<\/p>\n<p>I question why Amazon didn&#8217;t add one more check box on the VPC creation dialog box that asked if the VPC should support DNS hostnames.\u00a0 You need this if you want to connect to your EC2 machine (setup later) either with ssh, http or really any protocol. Once you create your VPC you need to edit it to set this option.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2671 aligncenter\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-vpc-create-vpc-dns-hostnames.png\" alt=\"\" width=\"455\" height=\"199\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-vpc-create-vpc-dns-hostnames.png 455w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-02-vpc-create-vpc-dns-hostnames-300x131.png 300w\" sizes=\"(max-width: 455px) 100vw, 455px\" \/><\/p>\n<h2>Create one or more subnets for the network<\/h2>\n<p>This step, can actually be performed as many times as necessary depending on how many different subnets you want.\u00a0 This might be useful if you split up your setup into different logical networks.\u00a0 This might be because you put different applications into different subnets or perhaps to create firewalls to create different layers of permissions.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2672\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-vpc-create-subnet1.png\" alt=\"\" width=\"906\" height=\"486\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-vpc-create-subnet1.png 906w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-vpc-create-subnet1-300x161.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-03-vpc-create-subnet1-768x412.png 768w\" sizes=\"(max-width: 906px) 100vw, 906px\" \/><\/p>\n<p>My same criticism of the VPC creation dialog extends to the creation of subnets.\u00a0 It should have been possible to add a checkbox to the subnet dialog for the assignment of IPv4 addresses.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-04-vpc-modify-subnet1.png\" alt=\"\" width=\"757\" height=\"360\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-04-vpc-modify-subnet1.png 757w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-04-vpc-modify-subnet1-300x143.png 300w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2674\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-05-vpc-modify-subnet1-returncode.png\" alt=\"\" width=\"755\" height=\"193\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-05-vpc-modify-subnet1-returncode.png 755w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-05-vpc-modify-subnet1-returncode-300x77.png 300w\" sizes=\"(max-width: 755px) 100vw, 755px\" \/><\/p>\n<h2>Create a an internet gateway<\/h2>\n<p>Creating the internet gateway is really not much of a process.\u00a0 The only real control you have is the user friendly name for the gateway.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2675\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-06-vpc-internet-gw.png\" alt=\"\" width=\"706\" height=\"231\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-06-vpc-internet-gw.png 706w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-06-vpc-internet-gw-300x98.png 300w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/p>\n<p>However, once the gateway is created it is not automatically associated with anything.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2676 aligncenter\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-07-vpc-internet-gw-detatched.png\" alt=\"\" width=\"548\" height=\"441\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-07-vpc-internet-gw-detatched.png 548w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-07-vpc-internet-gw-detatched-300x241.png 300w\" sizes=\"(max-width: 548px) 100vw, 548px\" \/><\/p>\n<h2>Attach gateway to my VPC<\/h2>\n<p>Just select the VPC from the list that should be associated with this gateway.\u00a0 The process isn&#8217;t difficult and as it turns out, you can only associate one internet gateway with a network.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2677\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-08-vpc-internet-gw-attached.png\" alt=\"\" width=\"706\" height=\"248\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-08-vpc-internet-gw-attached.png 706w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-08-vpc-internet-gw-attached-300x105.png 300w\" sizes=\"(max-width: 706px) 100vw, 706px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2678\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-09-vpc-internet-gw-attached-view.png\" alt=\"\" width=\"860\" height=\"455\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-09-vpc-internet-gw-attached-view.png 860w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-09-vpc-internet-gw-attached-view-300x159.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-09-vpc-internet-gw-attached-view-768x406.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/p>\n<h2>Add route to from VPC to rest of internet<\/h2>\n<p>When first looking at the routing everything looks just fine.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2679\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-10-vpc-routing-before.png\" alt=\"\" width=\"727\" height=\"552\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-10-vpc-routing-before.png 727w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-10-vpc-routing-before-300x228.png 300w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/p>\n<p>The thing that might not be apparent from looking at this figure is that any virtual machine can talk to other virtual machines on its network segment.\u00a0 However, if the destination is to a machine outside of the local network then there is no route to pass that information out.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2680\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-11-vpc-routing-after.png\" alt=\"\" width=\"729\" height=\"596\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-11-vpc-routing-after.png 729w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-11-vpc-routing-after-300x245.png 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/p>\n<p>This small change allows us to both communicate with any virtual machines but also that they can communicate with us as well.<\/p>\n<h2>Setup any special firewall rules \/ <a href=\"https:\/\/en.wikipedia.org\/wiki\/Access_control_list\" target=\"_blank\" rel=\"noopener\">ACL<\/a><\/h2>\n<p>It is possible to set up the access control list which is essentially creating your own firewall.\u00a0 You determine which protocols can come in on which ports from which locations.<\/p>\n<div id=\"attachment_2681\" style=\"width: 814px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2681\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-2681 size-full\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-inbound.png\" alt=\"\" width=\"804\" height=\"594\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-inbound.png 804w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-inbound-300x222.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-inbound-768x567.png 768w\" sizes=\"(max-width: 804px) 100vw, 804px\" \/><p id=\"caption-attachment-2681\" class=\"wp-caption-text\">Input ACL<\/p><\/div>\n<p>&nbsp;<\/p>\n<div id=\"attachment_2682\" style=\"width: 837px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-2682\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-2682 size-full\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-outbound.png\" alt=\"\" width=\"827\" height=\"297\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-outbound.png 827w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-outbound-300x108.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-12-vpc-acl-outbound-768x276.png 768w\" sizes=\"(max-width: 827px) 100vw, 827px\" \/><p id=\"caption-attachment-2682\" class=\"wp-caption-text\">Output ACL<\/p><\/div>\n<p>&nbsp;<\/p>\n<h2>Create a security group<\/h2>\n<p>Actually the AWS security group is really not that much different from the access control list setup.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2688\" src=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-13-vpc-securitygrp.png\" alt=\"\" width=\"840\" height=\"458\" srcset=\"https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-13-vpc-securitygrp.png 840w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-13-vpc-securitygrp-300x164.png 300w, https:\/\/blog.paranoidprofessor.com\/wp-content\/uploads\/2017\/11\/aws-13-vpc-securitygrp-768x419.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>It is possible to user either the ACL or the security group for dealing with internal traffic and the other as the firewall to the actual internet.<\/p>\n<h2>Summary<\/h2>\n<p>All of this setup is required to create your own little network and attach it to the internet.\u00a0 It does seem like a lot of setup but it only takes a few minutes and it does give you the same control as setting up a router at home.<\/p>\n<p>I will be using this network setup with a virtual computer (EC2 ) in my next article.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would rather talk about the actual compute engine (EC2) but that oddly enough you need a network before you can really create one.\u00a0 Rather than talking about the default VPC I will discuss about the networking a bit right &hellip; <a href=\"https:\/\/blog.paranoidprofessor.com\/index.php\/2018\/01\/22\/aws-setting-up-a-vpc\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[95,90,85],"_links":{"self":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2669"}],"collection":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/comments?post=2669"}],"version-history":[{"count":10,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2669\/revisions"}],"predecessor-version":[{"id":2896,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/posts\/2669\/revisions\/2896"}],"wp:attachment":[{"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/media?parent=2669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/categories?post=2669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.paranoidprofessor.com\/index.php\/wp-json\/wp\/v2\/tags?post=2669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}