Setting up your MEAN (Node.js) website in AWS ElasticBeanstalk: Add a public internet gateway to your VPC
--
I walk through step by step how to get a Node.JS MEAN.JS that uses Grunt and Bower working on Amazon Web Services ElasticBeanstalk. In this section we’ll configure our AWS VPC’s public subnet Internet Gateway.
Go to parent article — Build a robust MEAN website in under an hour for less than $1/day
Go to previous article — Setting up your MEAN (Node.js) website in AWS ElasticBeanstalk: Setup your VPC
If you’ve already added your internet gateway then go to the next article— Setting up your MEAN (Node.js) website in AWS ElasticBeanstalk: Add a NAT gateway for your private subnet
Expose your public subnet using an Internet Gateway
In order for your “public” subnet to be public, you’ll need to create an Internet Gateway. Click on the left hand menu for “Internet Gateways”. Then click “Create Internet Gateway”. I named mine ebnodeigw.
Once the Internet Gateway is created, we’ll need to attach it to our VPC in order to enable communication. Check your new internet gateway and click “Attach to VPC”
Now we need to create a new route that will tell our public subnet to send all external traffic through the Internet Gateway. Click on the “Routes” menu on the left and then click “Create Route Table”. I called my route table ebnodeinternet. This is so I know that this is the route table that gives internet access, for security best practices, I’m going to leave my default route table alone. I don’t want my default route assignment to give internet access.
Select the new route table you’ve created and then on the bottom panel select the “Routes” tab.
Click “Add another route”. The destination will be 0.0.0.0/0. For the target you’ll select your new Internet Gateway from the autocomplete dropdown that appears. (Most likely starts with “igw”). Then click Save.
Now click on the “Subnet Associations” tab.
Click Edit and then select the subnet we created for the public subnet earlier. For me this was 10.0.5.0/24. After you’ve selected that subnet, click Save.
Your public subnet is now “public”. When ElasticBeanstalk creates machines on this subnet, you will be able to access them from the internet.
Go to parent article — Build a robust MEAN website in under an hour for less than $1/day
Go to previous article — Setting up your MEAN (Node.js) website in AWS ElasticBeanstalk: Setup your VPC
Go to next article — Setting up your MEAN (Node.js) website in AWS ElasticBeanstalk: Add a NAT gateway for your private subnet