I am trying to emulate an environment where two computers are connected to the same network using EC2 instances.
I tried creating a VPC with a public and private subnets. I connected a NAT gateway to the private subnet and then created an instance in private subnet and it doesn’t seem to have public ip. Is there another way to approach to create this environment
2
Answers
That’s correct. Instances in private subnets do not have public IP. However, they do access the internet through NAT which as a single public IP. This means that for any external API/service, the two instance will seem to have same IP address.
You can use a Load Balancer as the public interface and a auto scaling to scale to 2 instances of ec2