You can use a Cloud Storage bucket to store and serve files, such as movies or images or other static content. This document describes how to set up your environment to use the Google Cloud Storage client library.
For more information about Cloud Storage, see the Cloud Storage documentation.
Setting up your project
Follow the instructions in "Hello, World!" for Python on App Engine to set up your environment and project, and to understand how Python apps are structured in App Engine. Write down and save your project ID for use with your application.
Activating a Cloud Storage bucket
To use Cloud Storage, you'll need to activate at least one bucket. Typically, you might want to use the 5GB free default bucket, and upgrade this into a paid bucket if you need more storage. You can always activate and use other paid bucket if you want, but there is only one free default bucket per project. See Pricing, quotas, and limits for more details.
To activate the free, default Cloud Storage bucket for your app:
Click Create under Default Cloud Storage Bucket in the App Engine settings page for your project. Notice the name of this bucket: it is in the form
If you need more storage than the 5GB limit, you can increase this by enabling 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 under Creating a bucket to activate them.
Setting bucket and object permissions
By default, when you create a bucket for your project, your app has all the permissions required to read and write to it.
Downloading the client library
If you have Git installed, you can clone the Google Cloud Storage client library's GitHub repository as follows:
git clone https://github.com/GoogleCloudPlatform/appengine-gcs-client.git
If you have
installed, you can use
pip to download and install the Google Cloud
Storage client library as follows:
pip install GoogleAppEngineCloudStorageClient -t <your_app_directory/lib>
You can download a ZIP file containing the Google Cloud Storage client library from GitHub:
Using the client library with the development app server
You can use the client library with the development server.
Pricing, quotas, and limits
There are no bandwidth charges associated with making Google Cloud Storage client library calls to Cloud Storage. However, there are operations charges; because the calls count against your URL fetch quota, as the library uses the URL Fetch service to interact with Cloud Storage. And There are operations and storage charges, however,
Notice that Google Cloud Storage is a pay-to-use service; you will be charged according to the Cloud Storage price sheet.
Alternative ways to access Cloud Storage
Instead of using the client library, you could use the following:
- Cloud Storage REST API. This could be a good choice if you need a specific feature not provided in the client library. However, this isn't compatible with the development server.
- Cloud Storage Browser in the Google Cloud Platform Console. Useful for uploading objects quickly.
- gsutil. A command line tool.