On reboot, the IP address of an amazon instance changes. How to find the new IP address using java API?
相关问题
- JQ: Select when attribute value exists in a bash a
- How to upgrade/install Upstart deamon version 1.5
- Connecting to Windows Server Service Bus on AWS
- how to get the available capacity of a zone in AWS
- Amazon S3: Grant anonymous access from IP (via buc
相关文章
- I cannot locate production log files on Elastic Be
- AWS - Configuring access to EC2 instance from Bean
- Error: “The security token included in the request
- Ansible Timeout (12s) waiting for privilege escala
- resource:memory error when trying to run an ECS ta
- Spark EC2 SSH connection error SSH return code 255
- GPU based algorithm on AWS Lambda
- AWS S3 access denied when getting image by url
In order to fetch the public IP of the instance you first need to get the instance id of that instance. You can get the instance id of the instance by using the following java code.
And now in order to get the public IP you can use the following java code.
You can use CLI CRUD aplication to AWS resources. AWS-CRUD-Manager
To find all ec2 instances
To find all of data for one ec2 instances (including IP priv and public)
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.
you Can Use This.
On reboot, the IP addresses of an EC2 instance do not change. They do generally change on stop/start of a non-VPC EBS boot instance.
See my answer to your related question here:
That said, you can find the private and public IP addresses through the API call for DescribeInstances in your particular language.
If you are on the instance itself, you can also find the IP addresses through the user-data API using simple HTTP:
For example,
Elastic IP addresses are recommended for keeping a consistent (static) externally facing IP address for a particular service or server. These need to be re-assigned to an instance after a stop/start (but not after a reboot).