Latest Posts
Wednesday, September 1, 2021
In the previous post we created a public and private subnet in our VPC. In this post we are going to create a NAT gateway so that our private instances can access the internet. That's useful when there's a need to update the instance. For example if we ping google.com right now there will be 100% package lost in our private instance because we cannot get to the internet. After we attach the instance to the NAT gateway we will be able to ping google.
It would go on for a while but eventually it would say the package is lost.
Now let's create our NAT Gateway, it is important that we delete the NAT Gateway if it's not in use because you have to pay for it.
Wednesday, August 18, 2021
In the previous post we associated our Elastic IP with an instance directly. In this post we are going to take another approach to assign our Elastic IP to our instance. In this approach we will create an Elastic Network Interface and associate it with our instance instead. In the first approach the Elastic IP replaces the public IP because we associate it directly to the instance. But if we create an Elastic Network Interface we are essentially adding a second interface in our instance with two IPs, eth0 is the main network interface and eth1 will be the second interface. It's like having two network interface in the physical world but this time it's virtualized in AWS.
Here are the steps to create a network interface:
1. Create an Elastic IP, follow this post if you don't know how.
If you look at the instance description you will see that there's no Elastic IP address assignment, so if you stop and start the instance you will get a new public IP, and there's only one network interface (eth0). By the time we are finish with this post the instance will have tow network interfaces and an Elastic IP.
Wednesday, August 11, 2021
When an instance is created in AWS a public and private IP is assigned to the instance. The private IP does not change, but the public IP address changes each time the instance reboot or is stopped. On reboot you might be lucky enough to grab the same public IP, but it's not guaranteed. But on stoppage you will definitely be assigned a new public IP.
That's probably not a good thing a real world situation, that's where an Elastic IP comes into play. An Elastic IP is a static IP that when assigned does not change. However, there's no free lunch so you will be charged for it. So only create one if you really need it. I would recommend that you use the public DNS instead when you are not in production. Say the development and test environment. You might want to spend some money on the staging environment to mirror production as close as possible.
In the following section I will show you how to create an Elastic IP and assign it to an instance. You probably want to delete it after you create it if you do not want to pay. Only keep it if you want to use it.