|
1 |
| -# Google Cloud Storage (GCS) and the Google Java API Client library |
| 1 | +# Using Google Cloud Storage (GCS) with the S3 SDK |
2 | 2 |
|
3 |
| -Google Cloud Storage Service features a REST-based API that allows developers to store and access arbitrarily-large objects. These sample Java applications demonstrate how to access the Google Cloud Storage JSON API using the Google Java API Client Libraries. For more information, read the [Google Cloud Storage JSON API Overview][1]. |
| 3 | +[Google Cloud Storage][1] features APIs that allows developers to store and access arbitrarily-large |
| 4 | +objects. The [GCS XML API][5] provides support for AWS S3 API users that use S3 SDKs. |
| 5 | +Learn more about [Migrating to GCS][6]. |
4 | 6 |
|
5 |
| -## Quickstart |
| 7 | +## Prerequisites |
6 | 8 |
|
7 |
| -1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/), including the [gcloud tool](https://cloud.google.com/sdk/gcloud/). |
| 9 | +Install [Maven](http://maven.apache.org/). |
8 | 10 |
|
9 |
| -1. Setup the gcloud tool. |
10 |
| - |
11 |
| - ``` |
12 |
| - gcloud init |
13 |
| - ``` |
| 11 | +## Setup |
14 | 12 |
|
15 | 13 | 1. Clone this repo.
|
16 | 14 |
|
17 | 15 | ```
|
18 | 16 | git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
|
19 | 17 | ```
|
20 | 18 |
|
21 |
| -1. Install [Maven](http://maven.apache.org/). |
| 19 | +1. Change into this directory: |
| 20 | + |
| 21 | + ``` |
| 22 | + cd java-docs-samples/storage/s3-sdk |
| 23 | + ``` |
22 | 24 |
|
23 | 25 | 1. Build this project from this directory:
|
24 | 26 |
|
25 | 27 | ```
|
26 | 28 | mvn package
|
27 | 29 | ```
|
28 | 30 |
|
29 |
| -1. Run one of the sample apps by specifying its class name and a bucket name: |
| 31 | +1. Get your [Interoperable Storage Access Keys][3] and set the following environment variables: |
| 32 | + |
| 33 | + * AWS_ACCESS_KEY_ID=[ACCESS_KEY] |
| 34 | + * AWS_SECRET_ACCESS_KEY=[SECRET] |
30 | 35 |
|
31 |
| - ``` |
32 |
| - mvn exec:java -Dexec.mainClass=StorageSample \ |
33 |
| - -Dexec.args="ABucketName" |
34 |
| - ``` |
35 | 36 |
|
36 |
| -Note that if it's been a while, you may need to login with gcloud. |
| 37 | +## List GCS buckets using the AWS S3 SDK |
| 38 | + |
| 39 | +1. Run example using the following Maven command: |
37 | 40 |
|
38 | 41 | ```
|
39 |
| - gcloud auth application-default login |
| 42 | + mvn exec:java -Dexec.mainClass=S3Sdk |
40 | 43 | ```
|
41 | 44 |
|
42 | 45 | ## Products
|
43 | 46 | - [Google Cloud Storage][2]
|
44 | 47 |
|
45 | 48 | ## Language
|
46 |
| -- [Java][3] |
| 49 | +- [Java][2] |
47 | 50 |
|
48 | 51 | ## Dependencies
|
49 |
| -- [Google APIs Client Library for Java][4] |
50 |
| - |
51 |
| -[1]: https://cloud.google.com/storage/docs/json_api |
52 |
| -[2]: https://cloud.google.com/storage |
53 |
| -[3]: https://java.com |
54 |
| -[4]: http://code.google.com/p/google-api-java-client/ |
55 |
| - |
| 52 | +- [AWS S3 Java SDK][4] |
| 53 | + |
| 54 | +[1]: https://cloud.google.com/storage |
| 55 | +[2]: https://java.com |
| 56 | +[3]: https://cloud.google.com/storage/docs/migrating#keys |
| 57 | +[4]: https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 |
| 58 | +[5]: https://cloud.google.com/storage/docs/xml-api/overview |
| 59 | +[6]: https://cloud.google.com/storage/docs/migrating |
0 commit comments