loyCossou
loyCossou

Reputation: 19

How to set the VPC up so that all the inside EC2 use the same EIP to communicate with exterior?

This is a basic question, please bear with me. I am trying to setup a vpc where all the EC2 instances will be able to communicate to the world via the same IP adress. Same like on a home network, all the computers will have the same Public IP. How to set that. NAT or Network Interface or ?

aws

Upvotes: 0

Views: 68

Answers (1)

James Dean
James Dean

Reputation: 4451

You can use NAT gateway. You can have two subnets in VPC, you can use one subnet(without IGW) to launch all the EC2 instances and you can have a second subnet (public with IGW) and add a NAT gateway to it. In the routing table attached to private subnet, add a route for 0.0.0.0/0 and point it to NAT gateway.

https://aws.amazon.com/premiumsupport/knowledge-center/nat-gateway-vpc-private-subnet/

NAT gateway only allows outbound traffic, if you would like to connect outside to inside, you need to use NAT gateway.

Upvotes: 1

Related Questions