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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay