1️⃣ NAT Gateway¶
🔹 Definition¶

NAT Gateway provides outbound-only internet access for private subnets.
- No inbound traffic allowed
- Stable, static outbound IP
- More secure than public IPs on VMs
When to use¶
- Private VMs need to download updates
- Backend services calling external APIs
🔧 Azure CLI (Basic)¶
az network nat gateway create \
--resource-group rg-vnet-demo \
--name nat-gateway \
--public-ip-addresses nat-ip \
--idle-timeout 10
Attach to subnet:
az network vnet subnet update \
--resource-group rg-vnet-demo \
--vnet-name vnet-main \
--name subnet-private \
--nat-gateway nat-gateway
🖥️ Azure Portal Flow¶
📦 Example¶
✔ Outbound allowed ❌ Inbound blocked