Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:16:18+00:00 2026-05-26T04:16:18+00:00

I have just started using Amazon EC2 API in Java. I have created instances

  • 0

I have just started using Amazon EC2 API in Java.

I have created instances using ec2.runInstances(runInstancesRequest);

But it will take some time for the instance to get launched (typically 1-2 mins).
I need to get the public DNS of the machine via Java EC2 API.

How do I know when the instances change from “pending” state to “processed” state, and How can I get the public DNS of the EC2 instance through the EC2 API.

Thanks in advance.
Kanna

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:16:18+00:00Added an answer on May 26, 2026 at 4:16 am

    There is no event model or other signal raised by the SDK to tell you when an EC2 object changes state – the only way to find out is to issue a DescribeXXXXXXXX call on the object on a repeated basis, say once every 30 seconds, until the state field changes.

    There’s a finite minimum time for the call to execute and respond, so you need to find an interval that doesn’t fire requests before the prior one has completed. Or simply wait for the response, and then wait another ‘n’ seconds before re-issuing the call. You also don’t want to spam the AWS API with rapid requests, even if they’re timed between responses. In my controller application, I set the interval at 30 seconds, issue the request, wait for the response, and then subtract the elapsed time from the interval and sleep that long. In a multithreaded model, I can thereby track state changes on many objects simultaneously without swamping either my local CPU or the API.

    Once the change of state has been detected (and assuming the new state is whet you expect – don’t forget to handle failure modes) you can get a wide variety of descriptive information, including public DNS address (in the case of instance objects) from the structure returned in the API response object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started using the AsyncController in my project to take care of
I have just started using and educating my self of Java spring. I now
I have just started using UIDatePicker in my iPad app, but is there a
I have just started using XML as I usually use php but I am
I have just started using the python-twitter API and it requires me to register
I have just started using NSIS . It works very well but I find
I have just started using Unity and the interception capabilities. I created a prototype
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have just started using silverlight 2 beta and cannot find how to or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.