Skip to content

Instantly share code, notes, and snippets.

@TomTasche
Last active October 9, 2016 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomTasche/62a15a994251276d5aecd138db2719cf to your computer and use it in GitHub Desktop.
Save TomTasche/62a15a994251276d5aecd138db2719cf to your computer and use it in GitHub Desktop.
Compute compute = ComputeOptions.defaultInstance().service();
String instanceName = "bla";
String projectId = "blu";
String zone = "ble"; // e.g. europe-west1-d
InstanceId instanceId = InstanceId.of(projectId, zone, instanceName);
Instance instance = compute.getInstance(instanceId);
try {
Operation startOperation = instance.start();
startOperation.waitFor();
} catch (InterruptedException | TimeoutException e) {
LOGGER.log(Level.SEVERE, "could not start instance", e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment