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





19 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. Thank you for sharing good knowledge and information it's very helpful and understanding.. as I have been looking for this information for a long time. Regards सटका मटका

    ReplyDelete
  3. 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
  4. I really got into this article. I found it to be interesting and loaded with unique points of interest. I like to read material that makes me think. Thank you for writing this great content

    Love back Solution Specialist
    Vashikaran specialist  
    Love Vashikaran Specialist
    Vashikaran Specialist in India  Vashikaran Specialist in Bangalore  Vashikaran Specialist in Mumbai  Love Vashikaran Specialist in MumbaiBlack magic specialist astrologer 

    ReplyDelete
  5. By purchasing a Windows product key, you will receive a 100% Original Microsoft product key license .
    That can be activated directly on the official Microsoft website. Our secure payment methods give you a total guarantee,
    and you will receive your software by email after a few minutes of purchase.
    https://microsoftprokey.com/

    ReplyDelete
  6. 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

Search This Blog