DEV Community

Baraa Mohamed
Baraa Mohamed

Posted on

1

What is the difference between NAT Gateway & Internet Gateway? 🤔

This is likely the first question that comes to mind when dealing with a VPC.

Let’s use the architecture in the image to simplify things further.

Image description


Internet Gateway:

The Internet Gateway is essentially the gateway to the external world for your VPC.

Without it, you won’t be able to access any server you deploy in the VPC, nor will the servers be able to access the internet.

Here’s what it allows you to do:

SSH into any public subnet's server, but only if it has a public IP.

Download tools you need onto that server by accessing outside internet.


NAT Gateway:

You could still ssh from your public subnet to the private subnet but what if you need that private subnet to access the outside world (internet)?

The NAT Gateway enables your private subnets to access the internet, but nothing from the internet can directly access your private servers.

IMPORTANT NOTE : NAT Gateway must be placed in public subnet itself for it to be able to access outside internet, because remember any thing inside private subnet can not access internet by default.

Here’s why this is useful:

Increased security ⬆️

✅ You can download tools from the internet onto your server in the private subnet.


Accessing Your Private Server:

To access a private server in this setup, you’ll follow these steps:

  1. SSH into your server in the public subnet (referred to as "Bastion" in the image).
  2. From the Bastion server, SSH again into your server in the private subnet (referred to as "Private App").

🤍 I'd love to connect with you on LinkedIn—let's grow our network and share ideas! here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay