Discover
Get started
Create buckets
Access and manage buckets
Upload and download objects
Access and manage objects
Get insights on your stored data
Cache objects
Control data lifecycles
Make requests
Secure data
Monitor data and usage
Protection, backup, and recovery
Mount buckets with Cloud Storage FUSE
Work across products, Clouds, and platforms
Troubleshoot
Stay organized with collections Save and categorize content based on your preferences.
This page shows you how to download objects from your buckets in Cloud Storage to persistent storage. You can also download objects into memory.
Note: If you use customer-supplied encryption keys with your objects, see Using Customer-Supplied Encryption Keys for downloading instructions. Required rolesIn order to get the required permissions for downloading objects, ask your administrator to grant you the Storage Object Viewer (roles/storage.objectViewer
) role on the bucket. If you plan on using the Google Cloud console, ask your administrator to grant you the Storage Admin (roles/storage.admin
) role on the bucket instead.
These roles contain the permissions required to download objects. To see the exact permissions that are required, expand the Required permissions section:
Required permissionsstorage.buckets.list
storage.objects.get
storage.objects.list
You might also be able to get these permissions with other predefined roles or custom roles.
For instructions on granting roles on buckets, see Use IAM with buckets.
Download an object from a bucketComplete the following instructions to download an object from a bucket:
ConsoleIn the list of buckets, click the name of the bucket that contains the object you want to download.
The Bucket details page opens, with the Objects tab selected.
Navigate to the object, which may be located in a folder.
Click the Download icon associated with the object.
Your browser settings control the download location for the object.
To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, see Troubleshooting.
Command lineUse the gcloud storage cp
command:
gcloud storage cp gs://BUCKET_NAME/OBJECT_NAME SAVE_TO_LOCATION
Where:
BUCKET_NAME
is the name of the bucket containing the object you are downloading. For example, my-bucket
.
OBJECT_NAME
is the name of object you are downloading. For example, pets/dog.png
.
SAVE_TO_LOCATION
is the local path where you are saving your object. For example, Desktop/Images
.
If successful, the response looks like the following example:
Completed files 1/1 | 164.3kiB/164.3kiB
If your download is interrupted prior to completion, run the same cp
command to resume the download from where it left off.
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.
C#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.
GoFor 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.
JavaFor 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.
The following sample downloads an individual object:
The following sample downloads multiple objects using multiple processes:
The following sample downloads all objects with a common prefix using multiple processes:
Node.jsFor 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.
The following sample downloads an individual object:
The following sample downloads multiple objects using multiple processes:
The following sample downloads all objects with a common prefix using multiple processes:
PHPFor 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.
PythonFor 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.
The following sample downloads an individual object:
The following sample downloads multiple objects using multiple processes:
The following sample downloads all objects in a bucket using multiple processes:
RubyFor 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.
REST APIs JSON APIHave gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Use cURL
to call the JSON API with a GET
Object request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -o "SAVE_TO_LOCATION" \ "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/o/OBJECT_NAME?alt=media"
Where:
SAVE_TO_LOCATION
is the path to the location where you want to save your object. For example, Desktop/dog.png
.BUCKET_NAME
is the name of the bucket containing the object you are downloading. For example, my-bucket
.OBJECT_NAME
is the URL-encoded name of the object you are downloading. For example, pets/dog.png
, URL-encoded as pets%2Fdog.png
.Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Use cURL
to call the XML API with a GET
Object request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -o "SAVE_TO_LOCATION" \ "https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME"
Where:
SAVE_TO_LOCATION
is the path to the location where you want to save your object. For example, Desktop/dog.png
.BUCKET_NAME
is the name of the bucket containing the object you are downloading. For example, my-bucket
.OBJECT_NAME
is the URL-encoded name of the object you are downloading. For example, pets/dog.png
, URL-encoded as pets%2Fdog.png
.To more efficiently download all objects in a bucket or subdirectory, use the gcloud storage cp
command or a client library:
gcloud storage cp --recursive gs://BUCKET_NAME/FOLDER_NAME .Download a portion of an object
If your download gets interrupted, you can resume where you left off by requesting only the portion of the object that's left. Complete the following instructions to download a portion of an object.
ConsoleThe Google Cloud console does not support downloading portions of an object. Use the gcloud CLI instead.
Command lineThe Google Cloud CLI automatically attempts to resume interrupted downloads, except when performing streaming downloads. If your download gets interrupted, a partially downloaded temporary file becomes visible in the destination hierarchy. Run the same cp
command to resume the download where it left off.
When the download is complete, the temporary file is deleted and replaced with the downloaded contents. Temporary files are stored in a configurable location, which by default is in the user's home directory under .config/gcloud/surface_data/storage/tracker_files
. You can change or view the location that temporary files are stored by running gcloud config get storage/tracker_files_directory
.
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.
C#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.
GoFor 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.
JavaFor 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.
Node.jsFor 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.
PHPFor 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.
PythonFor 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.
RubyFor 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.
REST APIs JSON APIUse the Range
header in your request to download a portion of an object.
Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Use cURL
to call the JSON API with a GET
Object request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Range: bytes=FIRST_BYTE-LAST_BYTE" \ -o "SAVE_TO_LOCATION" \ "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/o/OBJECT_NAME?alt=media"
Where:
FIRST_BYTE
is the first byte in the range of bytes you want to download. For example, 1000
.LAST_BYTE
is the last byte in the range of bytes you want to download. For example, 1999
.SAVE_TO_LOCATION
is the path to the location where you want to save your object. For example, Desktop/dog.png
.BUCKET_NAME
is the name of the bucket containing the object you are downloading. For example, my-bucket
.OBJECT_NAME
is the URL-encoded name of the object you are downloading. For example, pets/dog.png
, URL-encoded as pets%2Fdog.png
.Range
header is silently ignored and the response instead serves the entire requested object. XML API
Use the Range
header in your request to download a portion of an object.
Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Use cURL
to call the XML API with a GET
Object request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Range: bytes=FIRST_BYTE-LAST_BYTE" \ -o "SAVE_TO_LOCATION" \ "https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME"
Where:
FIRST_BYTE
is the first byte in the range of bytes you want to download. For example, 1000
.LAST_BYTE
is the last byte in the range of bytes you want to download. For example, 1999
.SAVE_TO_LOCATION
is the path to the location where you want to save your object. For example, $HOME/Desktop/dog.png
.BUCKET_NAME
is the name of the bucket containing the object you are downloading. For example, my-bucket
.OBJECT_NAME
is the URL-encoded name of the object you are downloading. For example, pets/dog.png
, URL-encoded as pets%2Fdog.png
.Range
header is silently ignored and the response instead serves the entire requested object. What's next
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage freeExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4