Reputation: 613
How can I check (inside Java code) if a VM instance on google compute engine is running or not? Thank you in advance.
Upvotes: 0
Views: 164
Reputation: 40061
You can use this method get
and then check status
in the response.
NOTE The documentation page includes a way to "Try this API". If you have an existing project containing a VM instance, you can populate the form for your project and instance to see how it works.
See this example:
Although it doesn't use instances.get
, it does use instances.[insert|list|delete]
and it should give you a good template.
Upvotes: 2