Disable bucket IP filtering

This page describes how to disable bucket IP filtering.

Deleting the bucket IP filtering rules disables IP filtering on a bucket, meaning you can remove the network-level access restrictions and enable requests from any IP address to access the bucket.

Required roles

To get the required permissions for disabling bucket IP filtering, ask your administrator to grant you the Storage Admin (roles/storage.admin) role on the bucket. This role contains the permissions required to disable bucket IP filtering.

To see the exact permissions that are required, expand the Required permissions section:

Required permissions

  • storage.buckets.update
  • storage.buckets.setIpFilter

You can also get these permissions with custom roles. You might be able to get these permissions with other predefined roles as well. To see which roles are associated with which permissions, refer to IAM roles for Cloud Storage.

For instructions on granting roles on buckets, see Use IAM with buckets.

Disable bucket IP filtering rules

Command line

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. To disable bucket IP filtering, run the gcloud alpha storage buckets update command in your development environment:

    gcloud alpha storage buckets update gs://BUCKET_NAME --clear-ip-filter

    Where:

    • BUCKET_NAME is the name of your bucket. For example, my-bucket.

REST APIs

JSON API

  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Create a JSON file that contains the settings for the bucket, which must include the name and the mode configuration fields for the bucket.

    {
      "name": "BUCKET_NAME"
      "ipFilter": {
        "mode": "Disabled",
        "publicNetworkSource": null
        "vpcNetworkSources": []
            }
          }
          

    Where:

    • BUCKET_NAME is the name of your bucket.
  3. Use cURL to call the JSON API with a PATCH bucket request:

    curl -X PATCH --data-binary @JSON_FILE_NAME \
     -H "Authorization: Bearer $(gcloud auth print-access-token)" \
     -H "Content-Type: application/json" \
     "https://storage.googleapis.com/storage/v1/b?project=PROJECT_IDENTIFIER&projection=full"

    Where:

    • JSON_FILE_NAME is name of the JSON file that contains the settings for the bucket.
    • PROJECT_IDENTIFIER is the ID or number of the project with which your bucket is associated. For example, my-project.

What's next

Try it for yourself

If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.

Try Cloud Storage free