A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/vpc-service-controls/docs/ingress-egress-rules below:

Ingress and egress rules | VPC Service Controls

Skip to main content Ingress and egress rules

Stay organized with collections Save and categorize content based on your preferences.

This page explains ingress and egress rules for VPC Service Controls. VPC Service Controls uses ingress and egress rules to allow access to and from the resources and clients protected by service perimeters.

The ingress and egress rule blocks specify the direction of allowed access to and from different identities and resources. Ingress and egress rules can replace and simplify use cases that previously required one or more perimeter bridges.

To learn how to apply ingress and egress policies to your service perimeter, see Configuring ingress and egress policies.

You can configure identity groups and third-party identities and IAM roles (Preview) in ingress and egress rules.

For a list of secure data exchange use cases and samples, see Secure data exchange with ingress and egress rules.

For a list of context-aware access use cases and samples, see Context-aware access with ingress rules.

Benefits of ingress and egress rules
  1. Ingress and egress rules allow you to privately and efficiently exchange data within and across organizations using Google Cloud service APIs.
  2. Ingress and egress rules allow you to grant access to Google Cloud resources in a perimeter based on the context of the API request:
    1. Constrain identity types or identities that can be used given a source network, IP address, or device.
    2. Constrain Google Cloud APIs and methods that can be accessed given the source network, IP address, device, and identity type.
  3. Minimize exfiltration risk by constraining the exact service, methods, Google Cloud projects, VPC networks, and identities used to execute the data exchange.
  4. Grant read-only access to external datasets and images that are not managed by you.
  5. Ensure that clients in less privileged segments do not have access to Google Cloud resources in more privileged segments; while allowing access in the other direction.
  6. Simplify configurations which have previously required one or more perimeter bridges.
Definition of ingress and egress

The definitions of ingress and egress are independent of the operation being invoked on the resource. Thus, the definitions refer to the direction of the request and not to the direction of data movement.

Note: VPC Service Controls allows access to a few Google-managed resources regardless of any restrictions enforced by ingress or egress policies. For example, Container Registry can access the read-only Google-managed gcr.io/cloud-dataflow repository irrespective of any restrictions enforced by the service perimeter. Policy model

An ingress or egress rule consists of from and to blocks where:

Multiple ingress and egress rules can be associated with a service perimeter. A Google Cloud service call is allowed or denied based on the following semantics:

Examples of API requests allowed by ingress rules Examples of API requests allowed by egress rules Note: In this example the same egress rule allows copying Cloud Storage objects in both directions. Ingress and egress rules are agnostic of the API request semantics and the data movement direction. Examples of API requests allowed by combination of ingress and egress rules Note: In this example, the egress rule must be created in the perimeter that contains the project containing the Cloud KMS key. The egress rule must allow access to the compute.googleapis.com service and the compute.v1.ImagesService.Insert method.

In the BigQuery and Compute Engine examples, an ingress rule is not sufficient, because the BigQuery job or the Compute Engine disk is outside the perimeter. An egress rule is required to allow an API request that involves a Google Cloud resource inside the perimeter (the BigQuery dataset or the Cloud KMS key) and a resource outside the perimeter (the BigQuery job or the Compute Engine disk).

API requests involving multiple service perimeters

When the accessed resources and/or the API client belong to different service perimeters, the policies of all the involved perimeters must allow the API request. For example, consider a Cloud Storage client and bucket a within a service perimeter A and a bucket b within a service perimeter B. In this example, for the Cloud Storage client to copy objects from the bucket a to bucket b and from the bucket b to bucket a, the following ingress and egress rules are required:

Ingress rules reference

Ingress rules can be configured using the Google Cloud console, a JSON file, or a YAML file. The following sample uses the .yaml format:

- ingressFrom:
    identityType: ANY_IDENTITY | ANY_USER_ACCOUNT | ANY_SERVICE_ACCOUNT
    *OR*
    identities:
    - PRINCIPAL_IDENTIFIER
    sources:
    - resource: RESOURCE
      *OR*
    - accessLevel: ACCESS_LEVEL
  ingressTo:
    operations:
    - serviceName: SERVICE
      methodSelectors:
      - method: METHOD
      *OR*
      - permission: PERMISSION
    *OR*
    roles:
    - ROLE_NAME
    resources:
    - projects/PROJECT
  title: TITLE

To make a functional ingress rule, you must specify the following attributes:

Note: To allow ingress to resources, VPC Service Controls evaluates sources and identityType attributes as an AND condition and evaluates accessLevel and resource attributes of the sources attribute as an OR condition. When an accessLevel or a resource for a source is set to a specific value instead of *, VPC Service Controls evaluates both sources and identityType attributes.

Once you have finished configuring your ingress policy file, see Updating ingress and egress policies for instructions on applying your ingress policy file to your service perimeter.

If you configure multiple ingress rules in a service perimeter, VPC Service Controls allows a request if it satisfies the conditions of any one of the ingress rules.

Egress rules reference

Egress rules can be configured using the Google Cloud console, a JSON file, or a YAML file. The following sample uses the .yaml format:

- egressTo:
    operations:
    - serviceName: SERVICE_NAME
      methodSelectors:
      - method: METHOD
      *OR*
      - permission: PERMISSION
    *OR*
    roles:
    - ROLE_NAME
    resources:
    - projects/PROJECT
    *OR*
    externalResources:
    - EXTERNAL_RESOURCE_PATH
  egressFrom:
    identityType: ANY_IDENTITY | ANY_USER_ACCOUNT | ANY_SERVICE_ACCOUNT
    *OR*
    identities:
    - PRINCIPAL_IDENTIFIER
    sources:
    - resource: RESOURCE
      *OR*
    - accessLevel: ACCESS_LEVEL
    sourceRestriction: RESTRICTION_STATUS
  title: TITLE

Once you have finished configuring your egress policy file, see Updating ingress and egress policies for instructions on applying your egress policy file to your service perimeter.

If you configure multiple egress rules in a service perimeter, VPC Service Controls allows a request if it satisfies the conditions of any one of the egress rules.

Using dry-run mode to test ingress/egress policies

When you don't want to grant access to all methods of a service, it can sometimes be difficult to determine the precise list of methods to allow. This can occur because a given method for a service can cause a different method to be invoked on a separate Google Cloud service. For example, BigQuery loading a table from a Cloud Storage bucket to run a query.

To determine the correct set of methods to allow, you can use the VPC Service Controls Dry-run mode. Do this by first enabling a perimeter in dry-run mode with no ingress or egress policies, and collect the list of methods invoked from the audit log. Then, progressively add these methods to ingress/egress policies in the dry-run mode until all violations have ceased. At that point, the configuration can be moved from dry-run mode to enforced mode.

Unsupported features

The following features are currently unsupported for ingress and egress rules:

  1. Identifying Google Cloud resources by labels instead of projects.
  2. Not all services support per-method ingress/egress rules. See Supported service method restrictions.
  3. ANY_SERVICE_ACCOUNT and ANY_USER_ACCOUNT identity types cannot be used to allow the following operations:
Limitations

For information about ingress and egress limits, see Quotas and limits.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-02 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4