Reputation: 1968
I have a VPC with a public subnet and an internet gateway.
Route table is configured to route 0.0.0.0/0
with Internet Gateway. Currently instances has access to the internet and are accessible from the outside via instance public IP address.
What I am trying to achieve is :
I am aware that I could configure route table to use NAT for 0.0.0.0/0
and all outbound traffic will have a NAT's IP address, but in this case instances are not accessible from the outside via instance public IP.
Upvotes: 0
Views: 1388
Reputation: 2321
The normal way to achieve this is by deploying your EC2 instances in a private subnet behind a load balancer for ingress traffic and then to use a NAT Gateway for the egress traffic from the EC2 instances to the rest of the world.
Upvotes: 2