This page shows you how get information on the metadata of your Cloud Storage buckets, excluding IAM policies and ACLs.
To learn how to get the IAM policy of your bucket, see View the IAM policy for a bucket.
Required roles
In order to get the required permissions for getting the metadata of a
Cloud Storage bucket, ask your administrator to grant you the Storage
Admin (roles/storage.admin) role on the bucket.
This role contains the permissions required to get the metadata of a bucket. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
storage.buckets.getstorage.buckets.list- This permission is only needed if you plan on using the Cloud de Confiance console to perform the task on this page.
You might also be able to get these permissions with other predefined roles or custom roles.
For instructions on granting roles on buckets, see Set and manage IAM policies on buckets.
Display a bucket's metadata
Console
- In the Cloud de Confiance console, go to the Cloud Storage Buckets page.
In the bucket list, click the name of the bucket whose metadata you want to view.
Click the Configuration tab to view bucket details such as the included regions, storage class, permissions, and replication type.
Command line
Use the gcloud storage buckets describe command:
gcloud storage buckets describe gs://BUCKET_NAME
Where:
BUCKET_NAMEis the name of the bucket whose metadata you want to view. For example,my-awesome-bucket.
If successful, the response looks similar to the following example:
defaultEventBasedHold: false
etag: CAE=
iamConfiguration:
bucketPolicyOnly:
enabled: true
...Client libraries
For more information, see the
Cloud Storage C++ API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage C# API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage Go API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage Java API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage Node.js API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage PHP API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage Python API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the
For more information, see the
Cloud Storage Ruby API
reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials.
For more information, see
Set up authentication for client libraries.
Before running code samples, set the C++
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
C#
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Go
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Java
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Node.js
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
PHP
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Python
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Ruby
GOOGLE_CLOUD_UNIVERSE_DOMAIN environment
variable to s3nsapis.fr.
Terraform
You can use a Terraform resource to view a bucket's metadata.
REST APIs
JSON API
Have gcloud CLI installed and initialized, which lets you generate an access token for the
Authorizationheader.Use
cURLto call the JSON API with aGETBucket request:curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.s3nsapis.fr/storage/v1/b/BUCKET_NAME"
Where
BUCKET_NAMEis the name of the relevant bucket. For example,my-bucket.Optionally, you can narrow down the metadata results by using the
fieldsquery string parameter. For example:curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.s3nsapis.fr/storage/v1/b/BUCKET_NAME?fields=FIELD1%2CFIELD2"
Where
FIELD#is a bucket property you want to include in the result. For example,projectNumberandstorageClass.
The response looks like the following example:
{ "projectNumber": "123456789012", "storageClass": "STANDARD" }
XML API
Have gcloud CLI installed and initialized, which lets you generate an access token for the
Authorizationheader.Use
cURLto call the XML API with aGETBucket request:curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.s3nsapis.fr/BUCKET_NAME?QUERY_PARAMETER"
Where:
BUCKET_NAMEis the name of the relevant bucket. For example,my-bucket.QUERY_PARAMETERis the metadata field you want to return. For example,storageClassfor getting the bucket's storage class. You can only use one query parameter at a time with the XML API. For a list of metadata fields supported by the XML API, see theGETBucket reference page.
The response looks like the following example:
<StorageClass>STANDARD</StorageClass>.