Requester Pays

Setup

This page provides an overview of the Requester Pays feature for Cloud Storage.

Introduction

Whenever a user accesses a Cloud Storage resource such as a bucket or object, there are charges associated with making and executing the request.

Normally, the project owner of the resource is billed for these charges; however, if the requester provides a billing project with their request, the requester's project is billed instead. With Requester Pays enabled on your bucket, you can require requesters to include a billing project in their requests, thus billing the requester's project. Enabling Requester Pays is useful, for example, if you have a lot of data you want to make available to users, but you don't want to be charged for their access to that data.

Restrictions

The following restrictions apply when using Requester Pays:

  • You cannot use a bucket that has Requester Pays enabled for imports and exports from Cloud SQL.
  • You cannot use a bucket that has Requester Pays enabled for exports from Pub/Sub.

Use and access requirements

To enable Requester Pays on a bucket, enable the metadata flag on the bucket. Once enabled, only the following users can access the bucket or its contents:

  • Requesters who include a billing project in their request. The project used in the request must be in good standing, and the user must have a role in the project that contains the serviceusage.services.use permission. The Service Usage Consumer role contains the required permission.

  • Requesters who don't include a billing project but have resourcemanager.projects.createBillingAssignment permission for the project that contains the bucket. The Billing Project Manager role contains the required permission. Access charges associated with these requests are billed to the project that contains the bucket.

All other requests to the bucket fail with a 400 UserProjectMissing error.

In addition to these requirements, the requester must have sufficient permission to perform the requested action. For example, a user that provides a valid billing project in their request cannot upload objects to the bucket unless they also have explicit permission to do so, such as by having storage.objects.create permission for that bucket or the project that contains it.

When disabling Requester pays, you must include a billing project in your request, or have the resourcemanager.projects.createBillingAssignment permission.

Source-billed operations

Operations that have both a source bucket and a destination bucket, such as a copy or rewrite, charge to the project that contains the source bucket. In most cases, such as direct calls using the JSON and XML APIs, you only need to include a billing project if the source bucket has Requester Pays enabled.

In some cases, such as gcloud storage cp with a --no-clobber flag, you need to include a billing project if either the source bucket or destination bucket (or both) have Requester Pays enabled. This is because such operations make calls to both the source and destination buckets in the course of performing the action.

Multi-request operations

For operations that require multiple requests to complete, the use of billing projects in your requests have the following behaviors:

What's next