An IP address of EC2 instance gets changed after the restart

I am running an EC2 Linux instance. For some maintenance purposes I shutdown the instance and started it again. However, EC2 IP has changed now.

How to keep an IP address of Amazon EC2 instance unchanged after stop and start it again?

Answers 1

  • Actually, When you stop/start your instance, the IP address will change. If you reboot the instance, it will keep the same IP addresses. Unfortunately, it is not possible for us to reassign the address to your instance as that address would have been released back into the pool used by other EC2 instances.

    If you want to avoid this issue in the future, depending on your needs:

    • If you only need a fixed public IP address, you can assign an Elastic IP address to your instance.
    • If you need both public and private IP addresses to remain the same throughout the lifetime of the instance, you can launch your instance in VPC instead. The private IP address assigned to an instance in VPC remains with the instance through to termination.

    To learn more, see the aws documentation to assign elastic ip.


Related Articles