How to find the IP address of an amazon EC2 instance on reboot

前端 未结 10 1323
长发绾君心
长发绾君心 2020-12-12 13:50

On reboot, the IP address of an amazon instance changes. How to find the new IP address using java API?

10条回答
  •  鱼传尺愫
    2020-12-12 14:11

    Assuming you don't want to assign an Elastic IP address (and there are reasons why this is not always a solution) then simply call DescribeInstances on the rebooted instance, which returns a bunch of information including Public IP Address.

    Here's the AWS EC2 Java API Documentation on the topic.

提交回复
热议问题