简体   繁体   中英

What happens to the public IP if an EC2 AWS instance crashes?

https://aws.amazon.com/ec2/faqs/#Elastic_IP

The public address is associated exclusively with the instance until it is stopped, terminated or replaced with an Elastic IP address.

I know what Elastic_IPs are, but there are limits to their availability in a given region.

So if I create an EC2 instance in a given region, and it has not an Elastic IP, then according to the AWS SLAs of somewhere between 95% and 99.99% monthly percentage uptime I need to consider that the machine could be unavailable for some other reason (not initiated by us).

Let's call this scenario a "crash" (other scenarios like AWS maintenance or general region unavailability fall into this as well imho).

Will the instance keep its IP?

I don't care if it crashes or becomes unavailable. I can recover. I need to know if in that case I have the same IP.

If the instance stops and starts again (from the AWS API perspective) then yes the the public IP address will be added to the pool, with a new one being attached when the instance starts.

If you're trying to prevent DNS issues and elastic IP addresses are not supported in your region, then you should instead look at attaching your instance being a load balancer. Then add your instance as a target of this, with any DNS records set to the CNAME of the ELB.

This is depended upon the maintenance by AWS, Usually, Amazon EC2 maintenance is a live-update to minimize customer impact. Sometimes, however, a live-update is not possible , and therefore a scheduled maintenance event is needed.

A scheduled maintenance event might require your instance to undergo one of the following:

  • Stop or retire
  • Reboot
  • Lose network connectivity or power

In case of stop and restart either its schedule or manual you instance will release the public IP/DNS address.

Important : Stopping and restarting the instance changes the public IP address of your instance. It's a best practice to use an Elastic IP address instead of a public IP address when routing external traffic to your instance.

EC2 Stop_Start

In case of Reboot , it will preserve the public IP address.

An instance reboot is equivalent to an operating system reboot. In most cases, it takes only a few minutes to reboot your instance. When you reboot an instance, it keeps its public DNS name (IPv4), private IPv4 address, IPv6 address (if applicable), and any data on its instance store volumes.

ec2-instance-reboot

In case of Lose Network connectivity or power , have both chances if it required stop and restart then it will lose public IP, if required just reboot then it will preserve the IP adress.

During network maintenance, scheduled instances lose network connectivity for a brief period of time. Normal network connectivity to your instance is restored after maintenance is complete.

During power maintenance, scheduled instances are taken offline for a brief period, and then rebooted. When a reboot is performed, all of your instance's configuration settings are retained.

Lose network connectivity or power

For the use cane you can look into ec2-scheduled-maintenance-action

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM