Reputation: 531
We have a Google Compute Engine with Google Storage and we want to upload and download Images to/from the engine with a java program and json. I searched throw all documentations of the compute engine api, but i didnt find a correct answer to achieve this. Whats the correct way to make this possible?
Upvotes: 1
Views: 599
Reputation: 38379
You can use Google Cloud Storage from within Google Compute Engine (GCE) the same way you can use it from outside of GCE. If you're writing a Java program and want an easy way to use the JSON API, you can use the Google APIs client for Java. It's available here: https://code.google.com/p/google-api-java-client/
Here's an example of the client in use to access Google Cloud Storage: https://code.google.com/p/google-api-java-client/source/browse/storage-cmdline-sample/src/main/java/com/google/api/services/samples/storage/cmdline/StorageSample.java?repo=samples
Also, for times when you want to do something ad-hoc, you should consider using teh gsutil command line tool, which is pre-installed and will by default act as the service account for the project the GCE instance is running under, meaning that you likely won't have to worry about credentials at all.
Upvotes: 2