Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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