- Newest
- Most votes
- Most comments
Are the instances in a private or public subnets? Do they have a public IP address or only a private IP address? If the instances are in a private subnet, then you route the traffic of that subnet to the NATGW and then to the IGW. https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html
The instances need to be in a private subnet where the route table attached to the private subnet has a route for your destination IP and a target of the NAT Gateway. The NAT Gateway needs to be in a public subnet where the route table attached to the public subnet has a route of all non-local destinations (0.0.0.0/0) has a target of the internet gateway.
To add, any instances that need direct internet access NOT via a NAT Gateway need to be in a Public Subnet with a Public IP Address with a route to an IGW
Relevant content
- asked 5 months ago
- Accepted Answerasked 10 months ago
- asked 4 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
The intention is a private subnet with local only addresses that route internet access via a NAT so all instances/ containers have a common source IP address. I have looked at the documentation above and I am none the wiser. I don't see how I can route to both a NAT and an IGW
Perhaps of assistance: https://repost.aws/questions/QUyzeERC9QQu6kjk662AluQw/how-does-a-private-subnet-know-how-to-route-to-a-nat-gateway-in-the-public-subnet