Change public IP address of EC2 instance without stop/start or elastic IP

后端 未结 5 1730
广开言路
广开言路 2020-12-25 14:38

I\'m running an ubuntu AMI on EC2. Is it possible to assign/request a new public IP address for a running EC2 instance without terminating it and starting it again? Note tha

5条回答
  •  误落风尘
    2020-12-25 14:52

    Reboot does not change your IP

    If you reboot your instance from within the EC2 Ubuntu machine, e.g. typing

    $ reboot
    

    then your instance will keep the same internal and public IP.

    Stopping the instance does change your IP

    If you use your AWS EC2 management console and stop your machine (don't terminate it!), you give up the assigned IP addresses.

    stopping ec2 instance

    You will request a new address if you start the instance again.

    How to quickly check your IP

    You can check for your public and private IPs using CURL or Perl GET, install

    $ sudo apt-get install libwww-perl
    

    Now type for internal:

    $ GET http://169.254.169.254/latest/meta-data/local-ipv4; echo
    172.31.44.114
    

    Or for public:

    $ GET http://169.254.169.254/latest/meta-data/public-ipv4; echo
    54.72.253.107
    

    Read more.

提交回复
热议问题