This page contains code samples for Cloud Storage. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.
Create a bucket with options
Create a Cloud Storage bucket with storage class and location parameters.
View in documentation
View in documentation
View in documentation
Get a bucket's metadata
Retrieve metadata from a Cloud Storage bucket.
View in documentation
Get an object's KMS key name
Get a resource's KMS key name that's used to encrypt an object.
View in documentation
Get an object's metadata
Retrieve metadata of an object in a Cloud Storage bucket.
List buckets using Amazon S3 SDKs
List Cloud Storage buckets that use Amazon Simple Storage Service (Amazon S3) SDKs by using the Cloud Storage XML API with HMAC credentials.
View in documentation
List files in a paginated manner
List objects in a bucket with no autopagination, showing how to move to the next set of objects.
List the objects in a bucket
List all the objects in a Cloud Storage bucket.
View in documentation
Make a bucket public
Make a bucket public by using a bucket-level IAM policy.
View in documentation
Move an object
Moving an object in Cloud Storage consists of two operations. First, you copy the object to a destination bucket and rename the moved object. Next, you delete the original object. Delete an object only when the old and new destinations are not equal.
View in documentation