Setting Up Google Cloud Storage Stay organized with collections Save and categorize content based on your preferences.
You can use a Cloud Storage bucketto store and serve files, such as movies or images or other static content. Thisdocument describes how to set up your environment to use the App Engine clientlibrary for Cloud Storage.
This API is supported for first-generation runtimes and can be used whenupgrading to corresponding second-generation runtimes. If you are updating to the App Engine Python 3 runtime, refer to themigration guide to learn about your migration options for legacy bundled services.Setting up your project
Create a Google Cloud project, and understand how Python 2 apps arestructured in App Engine. Write down and save your project ID for usewith your application.
Activating a Cloud Storage bucket
To use Cloud Storage, you'll need to activate at least one bucket.You might want to use the default bucket which provides the first 5GB ofstorage for free. You can activate and use another Cloud Storagebucket. The default bucket includesthe first 5GB of storage for free. The default bucketalso includes a free quota for Cloud Storage I/O operations. SeePricing, quotas, and limitsfor more details.
To activate the default Cloud Storage bucket for your app:
ClickCreate underDefault Cloud Storage Bucket in theApp Engine settings page for your project.Notice the name of this bucket: it is in the form
<project-id>.appspot.com.If you need more storage than the 5GB limit, you canincrease this byenabling billing for your project,making this a paid bucket. You will be charged for storage over the 5GB limit.
If you want to activate one or more paid buckets, follow the instructions underCreating a bucket to activatethem.
Note: When you create a default bucket, you also get a staging bucketwith the same name except thatstaging. is prepended to it. You can use thisstaging bucket for temporary files used for staging and test purposes; it alsohas a 5 GB limit, but it is automatically emptied on a weekly basis.Setting bucket and object permissions
You can find information on allowing your app's service account or other usersaccess the storage bucket and its contents inSetting bucket permissions andSetting object permissions.
Downloading the client library
You can download the App Engine client library for Cloud Storage using popular toolslikepip orGit. Alternatively, you can downloadthe library manually from GitHub. Choose your preferred method:
Git
If you have Git installed, you can clone the GitHub repository forApp Engine's Cloud Storage client library as follows:
gitclonehttps://github.com/googleapis/python-storage.gitpip
You can usepip to install the Cloud Storageclient library as follows:
pipinstallgoogle-cloud-storagepip command downloads and installs thePyPi distribution of the Cloud Storage client library. This distribution does notinclude demo or test code. To obtain these files, clone or download thelibrary's GitHub repository.Manual download
You can download a ZIP file containing the App Engine client library forCloud Storage from GitHub:
Install the library into the directory you are using for third-party libraries,such aslib. For more information, seeUsing third-partylibraries.
Using the client library with the development app server
You can use the client library with the development server. However becausethere is no local emulation of Cloud Storage, all requests to read and writefiles must be sent over the Internet to an actual Cloud Storage bucket.
To use the client library with the development app server:
Run
dev_appserver.pywith the flag--default_gcs_bucket_name [BUCKET_NAME],replacing[BUCKET_NAME]with the name of the Cloud Storage bucket you areusing.This flag controls the bucket that will be returned when your applicationcalls
file.DefaultBucketName(ctx).
Pricing, quotas, and limits
There are no bandwidth charges associated with making calls to Cloud Storage fromApp Engine's client library. However, there areoperations charges.In addition, the calls count against yourURL fetch quotaas the library uses the URL Fetch service to interact with Cloud Storage.
Notice that Cloud Storage is a pay-to-use service;you will be charged according to the Cloud Storageprice sheet.
Alternative ways to access Cloud Storage
Instead of using the client library, you could use the following:
- Cloud Storage Browser in theGoogle Cloud console, which is useful for uploading objects quickly.
- gsutil, which is a command-line tool for working withfiles in Cloud Storage.
What's next
- Visit theAPI Reference documentation.
- Learn how toread and write to Cloud Storagewith the App Engine client library for Cloud Storage.
- Review theApp Engine and Google Cloud Storage sample.
- View the complete set ofCloud Storage documentation,including additional samples and tutorials.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.