Tech Junkie Blog - Real World Tutorials, Happy Coding!: Iaas With AWS: VPC With Public And Private Subnets, Create NAT Gateway For Private Subnet

Wednesday, September 1, 2021

Iaas With AWS: VPC With Public And Private Subnets, Create NAT Gateway For Private Subnet

 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.

Go to the VPC dashboard and click on "NAT Gateways" link, then select "Create NAT Gateway" button.

You can give it a name if you want, but you have to assign it a public subnet and click on the "Allocate Elastic IP" to assign an Elastic IP to the NAT Gateway which it needs, click on "Create NAT Gateway" button at the bottom when finished.d


A new NAT gateway is created, now we have to route it in the private subnet routing table.

Click on the "Route Tables" and select the private subnet routing table, click on the "Routes" tab and click on "Edit routes" button

 
Type 0.0.0.0.0 in the "Destination" field to allow all traffic in the private subnet and select the "Target" as the NAT Gateway


Click on "Save routes" button.  Now if you go back to the private instance in the private subnet you should be able to ping google.com meaning you can get to the internet. No package is lost!


Now you can run yum update on the instance in the private subnet, which is probably more useful then pinging google.com





12 comments:

  1. This was a great article. It is very helpful and informative. Thanks for sharing such kind of article.
    Keep up sharing such kind of article about DIgital Marketing.

    ReplyDelete
  2. This was a great article. It is very helpful and informative. Thanks for sharing such kind of article.
    Keep up sharing such kind of article about

    يلا شوت طلقة
    يلا شوت عربي
    ايجي ناو

    ReplyDelete
  3. Thank you for such amazing blog post.
    CBSE Schools in hinghanghat

    ReplyDelete
  4. Online job portal services made work easier for job providers. Recruiters are shifting towards an online platform to find a perfect candidate for their respective openings. The traditional medium of posting a job is more time-consuming as compared to an online job posting. Therefore, If recruiters are looking for mass hiring then an online job portal is the easiest way to reach a mass audience. Jobs are getting lesser day by day. It is very hard to approach door- door to find the right job. Opportunities are getting lesser day by day. This process of posting a job is more fruitful than any other way of advertisement for job providers and as well as for job seekers.

    https://www.jobsuraksha.in/
    Phone no. 0172-4803707
    E-mail ID:- SUPPORT@JOBSURAKSHA.IN

    ReplyDelete
  5. The best stickers, for durability, quality feel and attractiveness when printed, are vinyl stickers, and while you don’t necessarily need a special printer for stickers there are some good things to look for if you are going to buy a new printer anyway – luckily, as this often works, the best inkjet printer for printing stickers is usually the best printer overall for any artist or crafter best printer for making stickers.

    ReplyDelete

Search This Blog