Home > Mobile >  Creating two EC2 Instances with the same public IP
Creating two EC2 Instances with the same public IP

Time:02-02

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

CodePudding user response:

private subnet and it doesn't seem to have public ip.

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.

CodePudding user response:

You can use a Load Balancer as the public interface and a auto scaling to scale to 2 instances of ec2

  • Related