Using Cloud Storage

If your Go 1.11 app needs to read and write files during runtime, or serve files such as movies, images or other static content, we recommend you use a Cloud Storage bucket.

App Engine creates a default bucket when you create an app. This bucket provides the first 5GB of storage for free and includes a free quota for Cloud Storage I/O operations. You can create other Cloud Storage buckets, but only the default bucket includes the first 5GB of storage for free.

Using Cloud Storage with App Engine

To use a Cloud Storage bucket from an App Engine app:

  1. View the names of the existing buckets in your App Engine project. You'll specify these names when you upload or download data from Cloud Storage.

    We recommend that you store the names of your Cloud Storage buckets in your app's environment variables instead of hard coding them into your app.

  2. In your app, declare Cloud Storage as a dependency by using the go get command. Alternatively, you can declare dependencies in your app's go.mod file. Learn more about specifying dependencies.

  3. Use the Google Cloud Client Library to upload or download data from your buckets.

    For information about serving static content, see Storing and Serving Static Files.

Using the default bucket

When you create an app, App Engine creates a default bucket that provides the first 5GB of storage for free. The default bucket also includes a free quota for Cloud Storage I/O operations. See Pricing, quotas, and limits for details. You will be charged for storage over the 5GB limit.

The name of the default bucket is in the following format:

App Engine also creates a bucket that it uses for temporary storage when it deploys new versions of your app. This bucket, named, is for use by App Engine only. Apps can't interact with this bucket.

Setting bucket and object permissions

The default service account that's associated with your app has all of the permissions required to read and write to buckets in your project.

To manage these permissions, each App Engine app uses a default service account that gives full read and write access to Cloud Storage buckets in the same project as the app. You can change the permissions of the default service account, but your app may lose access unless you assign an IAM role with the required permissions.

For information about allowing other users, apps, or projects to access a bucket and its contents, see Setting bucket permissions and Setting object permissions.

Using Cloud Storage with the local development server

The App Engine local development server doesn't emulate Cloud Storage, so all Cloud Storage requests must be sent over the Internet to an actual Cloud Storage bucket.

Pricing, quotas, and limits

There are no bandwidth charges associated with Cloud Storage client library calls to Cloud Storage. However, there are operations charges. In addition, the calls count against your URL fetch quota as 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 Storage price sheet.