List bucket IP filtering rules

This page describes how to list the bucket IP filtering rules. With the list bucket IP filtering rules operation, you can check if IP filtering is enabled or disabled on a bucket. If you need to view information about the specific network sources that are allowed, use the Get bucket IP filtering rules operation.

Required roles

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

You can also get this permission with custom roles. You might be able to get this permission 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 for projects, see Manage access to projects.

List 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 list the bucket IP filtering rules, run the command gcloud alpha storage buckets describe in your development environment:

    gcloud alpha storage buckets describe gs://BUCKET_NAME --format="default(ip_filter_config)"

    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. Use cURL to call the JSON API with a List bucket request:

    curl -X GET \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      "https://storage.googleapis.com/storage/v1/b?PROJECT_ID?projection=full"

    Where:

    PROJECT_ID is the ID or number of the project containing the buckets you want to list. For example, my-project.

    The response looks like the following example:

    {
      "kind": "storage#buckets",
      "items":
            {
            "kind": "storage#bucket",
            "selfLink": "https://www.googleapis.com/storage/v1/b/my-bucket1",
            "id": "my-bucket1",
            "name": "my-bucket1",
            "projectNumber": "123456789012",
            ...
             },
            "ipFilter": {
              "mode": "Disabled"
            }
            {
            "kind": "storage#bucket",
            "selfLink": "https://www.googleapis.com/storage/v1/b/my-bucket2",
            "id": "my-bucket2",
            "name": "my-bucket2",
            "projectNumber": "123456789013",
            ...
            },
            "ipFilter": {
              "mode": "Enabled"
            }
    },
    

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