amazon-web-servicescloudamazon-vpc

Enable auto-assign public IPv4 address in AWS


After creating a new VPC and creating a new subnet, In the subnet settings there is an 'Enable auto-assign public IPv4 address' option.

So if I create an instance in this subnet, will that instance doesn't have any public IP if its not Enabled? What does the option actually mean?


Solution

  • When you launch an instance in a subnet, it will receive a private IP address (for example something from the range of 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16). Optionally, you can have a public IP address as well attached to the network interface of the instance.

    The public IP can be received in two ways:

    If you enable auto-assign public IPv4 address, your instance will automatically receive a public IP address at launch. This IP address does not count as an Elastic IP, meaning that it wont decrease the number of available Elastic IP addresses for your region. Also, it will be automatically released if you stop, hibernate or terminate the instance (and in a few other cases, see the docs). Since this IP is not really allocated to you as a persistent IP address, it is not the best idea to rely on this IP address for any production usage (firewall whitelisting, DNS records, etc.).