I have created a VPC with CIDR 10.0.0.0/16. Then in that VPC, I wanted to create two public subnets. So I have created two subnets with CIDR 10.0.1.0/24 and 10.0.2.0/24. Now I have launched two EC2 instances on these subnets but I am not getting public IP of both the Instances. Please help me understand why I am not getting public IP of these instances and what should I do to get the public IP of these instances.
Asked
Active
Viewed 36 times
1 Answers
2
To get a public IP address you either
- specify a flag on the subnet (in cli it's MapPublicIpOnLaunch, in the console I don't recall where) you want a public address by default on the EC2 instances
- explicitly specify you want a public IP when launching an EC2 instance (on the screen you select the vpc and subnets)
- assign an elastic IP address to an instance
and do not forget to create a default routing on the subnet to the internet gateway

gusto2
- 11,210
- 2
- 17
- 36