NAT Gateways & Bastion Hosts
NAT Gateways and Bastion Hosts are essential components for secure VPC architectures. NAT Gateways enable outbound internet access for instances in private subnets, while Bastion Hosts provide secure access to private instances.
NAT Gateways
A NAT Gateway is a managed Network Address Translation service that allows instances in private subnets to access the internet for updates, downloads, or outbound connections, while preventing inbound internet access. NAT Gateways are highly available and automatically scale.
Bastion Hosts
A Bastion Host is a special-purpose EC2 instance in a public subnet that acts as a secure gateway to access instances in private subnets. You SSH into the bastion host first, then from there access your private instances. This eliminates the need to expose private instances directly to the internet.
Best Practices
Use NAT Gateways for outbound internet access from private subnets, use Bastion Hosts for secure access to private instances, implement proper security groups, and consider using AWS Systems Manager Session Manager as an alternative to SSH.
