Reputation: 1572
In the AWS SDK, EC2 instances can be launched programmatically via the AmazonEC2Client. Does GCP in general or Compute Engine specifically just offer the CLI-based gcloud
command for the equivalent operation? Or can GCE instances be controlled from Java/Python/Go/etc as well? Which SDK exists for those languages and where are the examples & docs for this?
I am looking for the equivalent of this in the GCP world:
client = new AmazonEC2Client(credentials);
client.runInstances(new RunInstancesRequest())
Upvotes: 4
Views: 2419
Reputation: 48874
You're looking for the Google Cloud Client Libraries, of which gcloud-java
is the Java implementation. There are also Client Libraries in Go, Node.js, Python, and Ruby.
Under the covers everything in Google Cloud is available via an API, so even if there isn't a client library for what you're trying to accomplish, it can be done programmatically by calling the API directly.
The documentation on launching instances has an API tab that shows both Client Library and REST API examples.
Upvotes: 8
Reputation: 1572
Looks like this is still in alpha but it is available on Github: here and here. There is an example for starting GCE instances in the java-docs-samples project.
Upvotes: 0