Reputation: 81
Is it necessary to set public ip on ec2 instance behind ELB which is internet facing in AWS?
I saw many examples of instance in public subnet and the instance is enabled a public ip but I wonder why it's required if there is internet facing alb in front of a instance.
I think if there is internet facing ALB, it would be fine if I disable a public ip on ec2 instance in public subnet because a client get reach to alb and alb can route the request to a instance which have only private ip address.
Am I correct?
Upvotes: 2
Views: 434
Reputation: 928
You're correct. In fact the EC2 instance can even be on a private subnet and not a public subnet, as long as you allow traffic from the ALB's public subnet through the instance's security groups.
Upvotes: 1