This page provides an overview of the Requester Pays feature for Cloud Storage.
Whenever a user accesses a Cloud Storage resource such as a bucket or object, there are charges associated with making and executing the request. Such charges include:
Data processing charges for operations, replication, and data retrieval.
Network usage charges for reading the data.
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.
Charges not covered
Data storage charges, including early deletion charges, are always applied to the project that contains the bucket, even if Requester Pays is enabled.
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.
Use and access requirements
To make a bucket Requester Pays, enable the metadata flag on the desired 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.usepermission. The Service Usage Consumer role contains the required permission.
Requesters who don't include a billing project but have
resourcemanager.projects.createBillingAssignmentpermission 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
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
gsutil rewrite, 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.
For operations that require multiple requests to complete, the use of billing projects in your requests have the following behaviors:
For resumable uploads, only the first request needs to include a billing project, and it applies to the entire upload. Billing projects specified in subsequent requests are ignored.
For rewrites with the JSON API and XML API multipart uploads, each request can use a different billing project, and a billing project specified in an earlier request does not apply to subsequent requests.
Charges associated with including a billing project in your request do not
appear separately in your billing. For example, say you make several
downloads from a Requester Pays bucket, and you use the project
as the project to bill for the request. If
my-project also contains a bucket
from which you perform downloads, your bill only shows the total charges
for your combined downloads. It does not distinguish between the downloads
from your own bucket and those from the Requester Pays bucket.
If you wish to distinguish between charges from your own Cloud Storage resources and charges from including billing projects in your requests, you should create a project that contains no Cloud Storage resources: this project is thus dedicated to making requests to resources in other projects, such as Requester Pays buckets.
- Learn how to use Requester Pays.
- Make data publicly available.