Get IP filtering rules

This page describes how to get the IP filtering rules on a bucket. For information about bucket IP filtering, see Bucket IP filtering.

Required roles

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

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

Required permissions

  • storage.buckets.get
  • storage.buckets.getIpFilter

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 for projects, see Manage access to projects.

Get bucket IP filtering rules

gcloud

To get the IP filtering rules on a bucket, 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 GET bucket request:

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

    Where:

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

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