This page describes how to enable and disable Requester Pays , as well as how to check to see if Requester Pays is enabled on a bucket.
Required roles
In order to get the required permissions for setting and managing Requester
Pays, ask your administrator to grant you the Storage Admin
( roles.storage.Admin
) role on the project that contains the bucket.
This role contains the permissions required to set and manage Requester Pays. To see the exact permissions that are required, expand the Required permissionssection:
Required permissions
-
storage.buckets.get
-
storage.buckets.update
-
resourcemanager.projects.createBillingAssignment
- This permission is only required if you don't have a billing account to use when disabling Requester Pays. For more information, see Use and access requirements .
You might also be able to get these permissions with other predefined roles or custom roles .
For instructions on granting roles on projects, see Grant or revoke a role .
Set Requester Pays
To enable or disable Requester Pays on a bucket:
Console
- In the Google Cloud console, go to the Cloud Storage Buckets
page.
-
In the list of buckets, find the bucket you want to set and locate the Requester payscolumn.
The value in the column indicates the current state of Requester Pays for that bucket.
-
Click the current state of Requester Pays for the bucket.
-
In the window that appears, click Turn onor Turn off, depending on the state you want to set for Requester Pays.
When enabled, a green bubble and Onappear in the Requester payscolumn for the bucket. When disabled, a gray bubble and Offappear in the column.
To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, see Troubleshooting .
Command line
Use the gcloud storage buckets update
command with the
appropriate flag:
gcloud storage buckets update gs:// BUCKET_NAME
FLAG
Where:
-
BUCKET_NAME
is the name of the relevant bucket. For example,my-bucket
. -
FLAG
is either--requester-pays
to enable Requester Pays or--no-requester-pays
to disable it.
If successful, the response looks similar to the following example:
Updating gs://my-bucket/... Completed 1
Client libraries
C++
For more information, see the Cloud Storage C++ API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
C#
For more information, see the Cloud Storage C# API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
Go
For more information, see the Cloud Storage Go API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
Java
For more information, see the Cloud Storage Java API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
Node.js
For more information, see the Cloud Storage Node.js API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
PHP
For more information, see the Cloud Storage PHP API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
Python
For more information, see the Cloud Storage Python API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket:
Ruby
For more information, see the Cloud Storage Ruby API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
The following sample enables Requester Pays on a bucket:
The following sample disables Requester Pays on a bucket: