Access public data (original) (raw)
Some data stored in Cloud Storage is configured so that it's readable by anyone at any time. This public data can be accessed in several ways, depending on how you want to work with the data.
API Link
- Get the name of the public object and the bucket that stores the object.
- Use the following URI to access an object in the bucket:
https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME
For example, the Google public bucket gcp-public-data-landsat contains the Landsat public dataset. You can link to the publicly shared objectLC08/01/001/003/LC08_L1GT_001003_20140812_20170420_01_T2/LC08_L1GT_001003_20140812_20170420_01_T2_B3.TIFwith the link:
Console
- Get the name of the public object and the bucket that stores the object.
- Using a web browser, access the object with the following URI (you are asked to sign in if you are not already signed in):
https://console.cloud.google.com/storage/browser/_details/BUCKET_NAME/OBJECT_NAME - If the public has permission to list the bucket's contents, you can list all the objects in the bucket with the following URI:
https://console.cloud.google.com/storage/browser/BUCKET_NAME
For example, the Google public bucket gcp-public-data-landsat contains the Landsat public dataset. You can access the bucket with:
https://console.cloud.google.com/storage/browser/gcp-public-data-landsat
Command line
- If you don't have the gcloud CLI,follow these instructions to install it.
- When installing the gcloud CLI, if you don't want to authenticate, skip the step of running the command
gcloud init, and instead run the following command:
gcloud config set auth/disable_credentials True
- When installing the gcloud CLI, if you don't want to authenticate, skip the step of running the command
- Get the name of the public object and the bucket that stores the object.
- If permission to list the bucket's contents is granted to the public, you can list some or all of the objects contained in the bucket by using the ls command.
For example, the Google public bucketgcp-public-data-landsatcontains the Landsat public dataset. You can list objects with the prefixLC08/01/001/003/LCwith the following command:
gcloud storage ls --recursive gs://gcp-public-data-landsat/LC08/01/001/003/LC* - Download specific public objects contained in the bucket by using thecp command.
For example, the following command downloads a file from the bucketgcp-public-data-landsatto your local directory:
gcloud storage cp gs://gcp-public-data-landsat/LC08/01/001/003/LC08_L1GT_001003_20140812_20170420_01_T2/LC08_L1GT_001003_20140812_20170420_01_T2_B3.TIF .
Client libraries
C++
For more information, see theCloud Storage C++ API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
C#
For more information, see theCloud Storage C# API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
Go
For more information, see theCloud Storage Go API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
Java
For more information, see theCloud Storage Java API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
Node.js
For more information, see theCloud Storage Node.js API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
Python
For more information, see theCloud Storage Python API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.
Ruby
For more information, see theCloud Storage Ruby API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, seeSet up authentication for client libraries.