*This page
applies to **Apigee** and **Apigee hybrid**.*


*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*
![](https://fonts.gstatic.com/s/i/googlematerialicons/help/v13/gm_grey-24dp/1x/gm_help_gm_grey_24dp.png)

> [!WARNING]
> **Note** : VPC Service Controls are not supported for the non-VPC peering Apigee setup. See also [Apigee networking options](https://docs.cloud.google.com/apigee/docs/api-platform/get-started/networking-options.md.txt).

Apigee integrates with [VPC Service
Controls](https://docs.cloud.google.com/vpc-service-controls/docs/overview), which let you isolate resources of your Google Cloud projects. This helps prevent
data leaks/exfiltration.

This section describes how to use VPC Service Controls with Apigee.

## Overview

VPC Service Controls defines a *service perimeter* that acts as a boundary between a project
and other services. Service perimeters are an organization-level method to protect Google Cloud
services in your projects in order to mitigate the risk of data exfiltration.

VPC Service Controls can also ensure that clients within a perimeter that have private access to
resources do not have access to unauthorized resources outside the perimeter.

For a detailed look at
the benefits of service perimeters, refer to the
[Overview of VPC Service Controls](https://docs.cloud.google.com/vpc-service-controls/docs/overview.md.txt).

When using VPC Service Controls, note that:

- Both the Google Cloud project and its associated runtime are included within that project's VPC Service Controls perimeter.
- Interaction among services inside a perimeter can be restricted using the [VPC network accessible services](https://docs.cloud.google.com/vpc-service-controls/docs/vpc-accessible-services.md.txt) feature.

Both Apigee and Apigee hybrid integrate with VPC Service Controls. For a
complete list of
products that integrate with VPC Service Controls, see
[Supported products](https://docs.cloud.google.com/vpc-service-controls/docs/supported-products.md.txt).

## Impact on internet connectivity


When VPC Service Controls are enabled, access to the internet is disabled: the Apigee runtime
will no longer communicate with any public internet target. You have to route traffic to your
VPC by establishing custom routes. See [Importing and exporting custom routes](https://docs.cloud.google.com/vpc/docs/vpc-peering.md.txt#importing-exporting-routes).

## Setting up VPC Service Controls with Apigee

The general process for setting up VPC Service Controls with Apigee is as follows:

1. Enable VPC Service Controls.
2. Create a new service perimeter.
3. Configure the service perimeter.

> [!NOTE]
> **Note:** For Apigee hybrid installations, there are [additional steps](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#hybrid) that you must execute to integrate with VPC Service Controls.

These steps are described in more detail below.

**To set up VPC Service Controls with Apigee:**

1. Enable VPC Service Controls for the peered connection from your network to Apigee by
   executing the following command:

   ```
   gcloud services vpc-peerings enable-vpc-service-controls \
     --network=SHARED_VPC_NETWORK --project=PROJECT_ID
   ```

   Where:
   - <var translate="no">SHARED_VPC_NETWORK</var> is the name of your shared VPC network.
   - <var translate="no">PROJECT_ID</var> is the name of the project hosting the shared VPC network; it is not the project used to create the Apigee organization.

   This command enables VPC Service Controls for your project. You can
   execute this command multiple times to enable VPC Service Controls for more than one
   project.
2. Create a new perimeter as described in the
   [the VPC Service Controls Quickstart](https://docs.cloud.google.com/vpc-service-controls/docs/set-up-service-perimeter.md.txt). When
   you create a perimeter, you choose which projects to add within that perimeter as well as which
   services to secure.

   For Apigee and Apigee hybrid, Google recommends that you secure all
   services when you create a perimeter, including the [Apigee API](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest.md.txt).

   For more information, see
   [Creating a service
   perimeter](https://docs.cloud.google.com/vpc-service-controls/docs/create-service-perimeters).
3. Configure the service perimeter, as described in [Service perimeter details and
   configuration](https://docs.cloud.google.com/vpc-service-controls/docs/service-perimeters).

To add an integrated portal within your perimeter, see [Adding an integrated
portal to the perimeter](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc#portal).

## Setting up VPC Service Controls with Apigee hybrid

Apigee hybrid supports VPC Service Controls, but there are additional steps that you must
perform. The general process for integrating Apigee hybrid with VPC Service Controls is as
follows:

1. Set up private connectivity.
2. Secure additional services within the perimeter.
3. Set up a *private repository*. (A private repository is one that is within the perimeter; it does not necessarily need to be a local repository as long as it is inside the perimeter.)
4. Push the Apigee images to your private repository.
5. Update overrides to use the private repository during the hybrid installation and configuration process.

Each of these steps are described in more detail in the following procedure.

**To set up VPC Service Controls with Apigee hybrid:**

1. Set up private IP addresses for your hybrid network hosts, as described in [Setting up private connectivity
   to Google APIs and services](https://docs.cloud.google.com/vpc-service-controls/docs/set-up-private-connectivity). This involves configuring routes, firewall rules, and DNS entries to let the Google APIs access those private IPs.
2. Follow the steps in [Setting up VPC Service Controls with
   Apigee](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc#setup-basic).

   During this process, you must be sure to secure the following services in addition to those
   specified for Apigee, within your perimeter:
   - Anthos Service Mesh
   - Cloud Monitoring (Stackdriver)
   - Google Kubernetes Engine (if you are running on GKE)
   - Google Container Registry (if you are using this as your local repository)

   To add these services to your perimeter, follow the instructions in
   [Service perimeter details and
   configuration](https://docs.cloud.google.com/vpc-service-controls/docs/service-perimeters).
3. Copy the Apigee images into your private repository:
   1. Download the signed Apigee images from Docker Hub as described
      [here](https://docs.cloud.google.com/apigee/docs/hybrid/v1.3/signed-docker-images.md.txt). Be sure to specify the
      latest version numbers.

      For example:

      ```
      docker pull google/apigee-installer:1.3.3
      docker pull google/apigee-authn-authz:1.3.3
      docker pull google/apigee-mart-server:1.3.3
      docker pull google/apigee-synchronizer:1.3.3
      docker pull google/apigee-runtime:1.3.3
      docker pull google/apigee-hybrid-cassandra-client:1.3.3
      docker pull google/apigee-hybrid-cassandra:1.3.3
      docker pull google/apigee-cassandra-backup-utility:1.3.3
      docker pull google/apigee-udca:1.3.3
      docker pull google/apigee-stackdriver-logging-agent:1.6.8
      docker pull google/apigee-prom-prometheus:v2.9.2
      docker pull google/apigee-stackdriver-prometheus-sidecar:0.7.5
      docker pull google/apigee-connect-agent:1.3.3
      docker pull google/apigee-watcher:1.3.3
      docker pull google/apigee-operators:1.3.3
      docker pull google/apigee-kube-rbac-proxy:v0.4.1
      ```
   2. Tag the images.

      The following example tags the images in a US-based GCR repo:

      ```
      docker tag google/apigee-installer:1.3.3 us.gcr.io/project_ID/apigee-installer:1.3.3
      docker tag google/apigee-authn-authz:1.3.3 us.gcr.io/project_ID/apigee-authn-authz:1.3.3
      docker tag google/apigee-mart-server:1.3.3 us.gcr.io/project_ID/apigee-mart-server:1.3.3
      docker tag google/apigee-synchronizer:1.3.3 us.gcr.io/project_ID/apigee-synchronizer:1.3.3
      docker tag google/apigee-runtime:1.3.3 us.gcr.io/project_ID/apigee-runtime:1.3.3
      docker tag google/apigee-hybrid-cassandra-client:1.3.3 us.gcr.io/project_ID/apigee-hybrid-cassandra-client:1.3.3
      docker tag google/apigee-hybrid-cassandra:1.3.3 us.gcr.io/project_ID/apigee-hybrid-cassandra:1.3.3
      docker tag google/apigee-cassandra-backup-utility:1.3.3 us.gcr.io/project_ID/apigee-cassandra-backup-utility:1.3.3
      docker tag google/apigee-udca:1.3.3 us.gcr.io/project_ID/apigee-udca:1.3.3
      docker tag google/apigee-stackdriver-logging-agent:1.6.8 us.gcr.io/project_ID/apigee-stackdriver-logging-agent:1.6.8
      docker tag google/apigee-prom-prometheus:v2.9.2 us.gcr.io/project_ID/apigee-prom-prometheus:v2.9.2
      docker tag google/apigee-stackdriver-prometheus-sidecar:0.7.5 us.gcr.io/project_ID/apigee-stackdriver-prometheus-sidecar:0.7.5
      docker tag google/apigee-connect-agent:1.3.3 us.gcr.io/project_ID/apigee-connect-agent:1.3.3
      docker tag google/apigee-watcher:1.3.3 us.gcr.io/project_ID/apigee-watcher:1.3.3
      docker tag google/apigee-operators:1.3.3 us.gcr.io/project_ID/apigee-operators:1.3.3
      docker tag google/apigee-kube-rbac-proxy:v0.4.1 us.gcr.io/project_ID/apigee-kube-rbac-proxy:v0.4.1
      ```

      While not required, Google recommends that you include the project ID or other
      identifying value in the repo path for each image.
   3. Push the images to your private repository.

      The following example pushes the images to a US-based GCR repo:

      ```
      docker push us.gcr.io/project_ID/apigee-installer:1.3.3
      docker push us.gcr.io/project_ID/apigee-authn-authz:1.3.3
      docker push us.gcr.io/project_ID/apigee-mart-server:1.3.3
      docker push us.gcr.io/project_ID/apigee-synchronizer:1.3.3
      docker push us.gcr.io/project_ID/apigee-runtime:1.3.3
      docker push us.gcr.io/project_ID/apigee-hybrid-cassandra-client:1.3.3
      docker push us.gcr.io/project_ID/apigee-hybrid-cassandra:1.3.3
      docker push us.gcr.io/project_ID/apigee-cassandra-backup-utility:1.3.3
      docker push us.gcr.io/project_ID/apigee-cassandra-backup-utility:1.3.3
      docker push us.gcr.io/project_ID/apigee-udca:1.3.3
      docker push us.gcr.io/project_ID/apigee-stackdriver-logging-agent:1.6.8
      docker push us.gcr.io/project_ID/apigee-prom-prometheus:v2.9.2
      docker push us.gcr.io/project_ID/apigee-stackdriver-prometheus-sidecar:0.7.5
      docker push us.gcr.io/project_ID/apigee-connect-agent1.3.3
      docker push us.gcr.io/project_ID/apigee-watcher1.3.3
      docker push us.gcr.io/project_ID/apigee-operators1.3.3
      docker push us.gcr.io/project_ID/apigee-kube-rbac-proxy:v0.4.1
      ```

      While not required, Google recommends that you include the project ID or other
      identifying value in the repo path for each image.
4. Update your overrides file to point the image URLs to your private repository,
   as described in [Specify
   configuration overrides](https://docs.cloud.google.com/apigee/docs/hybrid/latset/2-6-install-configure-cluster)

   You must change the image URLs for the following components:

   | Component Name (in overrides file) | Image URL |
   |---|---|
   | `ao` | `your_private_repo/apigee-operators` |
   | `authz` | `your_private_repo/apigee-authn-authz` |
   | `cassandra` | `your_private_repo/apigee-hybrid-cassandra auth: your_private_repo/apigee-hybrid-cassandra-client backup: your_private_repo/apigee-cassandra-backup-utility restore: your_private_repo/apigee-cassandra-backup-utility` |
   | `connectAgent` | `your_private_repo/apigee-connect-agent` |
   | `installer` | `your_private_repo/apigee-installer` |
   | `kubeRBACProxy` | `your_private_repo/apigee-kube-rbac-proxy` |
   | `logger` | `your_private_repo/apigee-stackdriver-logging-agent` |
   | `mart` | `your_private_repo/apigee-mart-server` |
   | `metrics` | `your_private_repo/apigee-prom-prometheus sdSidecar: your_private_repo/apigee-stackdriver-prometheus-sidecar` |
   | `runtime` | `your_private_repo/apigee-runtime` |
   | `synchronizer` | `your_private_repo/apigee-synchronizer` |
   | `udca` | `your_private_repo/apigee-udca fluentd: your_private_repo/apigee-stackdriver-logging-agent` |
   | `watcher` | `your_private_repo/apigee-watcher` |

5. Apply your changes using the new images in GCR, as described in [Apply
   the configuration to the cluster](https://docs.cloud.google.com/apigee/docs/hybrid/latest/2-7-install-hybrid-runtime#apply-the-configuration-to-the-cluster).

## Private Service Connect projects and perimeter boundaries

If you use [VPC Service Controls](https://docs.cloud.google.com/vpc-service-controls/docs/overview.md.txt) together with
[Private Service
Connect](https://docs.cloud.google.com/apigee/docs/api-platform/architecture/southbound-networking-patterns-endpoints), the service perimeters of your Apigee project and of the
Google Cloud project at the far end of the
Private Service Connect connection (the peer project) must allow
access between the two projects.

From January 15, 2027, Apigee evaluates the peer project as
an additional protected resource on the operations in the following list. The
check applies in both directions. If either project is in a service perimeter
that restricts `apigee.googleapis.com`, and that perimeter doesn't
allow access to the other project, those operations return
`PERMISSION_DENIED`. This is true even when your Apigee
project isn't in any perimeter.

### Affected operations

This requirement affects only the following control plane operations:

- Creating an instance (`organizations.instances.create`) or updating one (`organizations.instances.patch`), when the request sets the [consumer accept list](https://docs.cloud.google.com/apigee/docs/api-platform/architecture/southbound-networking-patterns-endpoints.md.txt). The projects in the consumer accept list are the peer projects.
- Creating an endpoint attachment (`organizations.endpointAttachments.create`). The project that owns the target service attachment is the peer project.

> [!NOTE]
> **Note:** API traffic isn't affected. Private Service Connect connections that already exist keep carrying traffic, and endpoint attachments that you've already created keep working. This change applies only when you create or update the preceding configurations.

### Check whether you are affected

To find out whether this change affects you, compare the perimeter of each
peer project with the perimeter of your Apigee project.

To complete these steps, you need permission to view the Apigee
instances and endpoint attachments in your organization, each peer project, and
the service perimeters in your access policy. For example, the following
predefined roles provide these permissions:

- [Apigee Read-only Admin role](https://docs.cloud.google.com/iam/docs/roles-permissions/apigee.md.txt#apigee.readOnlyAdmin) (`roles/apigee.readOnlyAdmin`) on your Apigee project.
- [Access Context Manager Reader role](https://docs.cloud.google.com/iam/docs/roles-permissions/accesscontextmanager.md.txt#accesscontextmanager.policyReader) (`roles/accesscontextmanager.policyReader`) on your organization.
- [Browser role](https://docs.cloud.google.com/iam/docs/roles-permissions/browser.md.txt#browser) (`roles/browser`) on each peer project, or on a folder or organization that contains it. For a peer project that's a Google-managed tenant project, you need this role on the project that owns it.

In the commands in this section, replace the following:

- `ORG_NAME`: the name of your Apigee organization.
- `PROJECT_ID`: the ID of a project.
- `PROJECT_NUMBER`: the number of a project.
- `POLICY_ID`: the ID of your organization's access policy.
- `PERIMETER_ID`: the ID of a service perimeter, which is the last part of the `name` field in the `list` output.

To check whether your peer projects are affected, complete the following
steps:

1. List the peer projects that you use with Private Service Connect:
   - **Inbound connections.** Call the
     [`organizations.instances.list`](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances/list.md.txt)
     or
     [`organizations.instances.get`](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances/get.md.txt)
     method. For example, list the instances in your organization:

     ```
     curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
         "https://apigee.googleapis.com/v1/organizations/ORG_NAME/instances"
     ```

     Each instance in the response has a
     `consumerAcceptList` field and a
     `serviceAttachment` field. Each entry in
     `consumerAcceptList` is a project ID or a project number. By
     default, the list includes the following two projects, which aren't peer
     projects:
     - Your Apigee project.
     - The Google-managed tenant project of your Apigee organization. Its ID ends in `-tp`, and it's the `PROJECT` part of the instance's `serviceAttachment` field, in the format `projects/PROJECT/regions/REGION/serviceAttachments/NAME`. Skip this entry. It shares the perimeter of your Apigee project. You don't have permission to view it, so the commands in the following steps return `PERMISSION_DENIED` for it.

     Every other entry is a peer project. A peer project can itself be a
     Google-managed tenant project. For more information, see the next
     step.
   - **Outbound connections.** Call the
     [`organizations.endpointAttachments.list` method](https://docs.cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.endpointAttachments/list.md.txt).
     For example, list the endpoint attachments in your organization:

     ```
     curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
         "https://apigee.googleapis.com/v1/organizations/ORG_NAME/endpointAttachments"
     ```

     Each endpoint attachment in the response has a
     `serviceAttachment` field in the format
     `projects/PROJECT/regions/REGION/serviceAttachments/NAME`.
     The `PROJECT` part is the peer project. A peer
     project can be a Google-managed tenant project. For more information,
     see the next step.

   Each list call returns up to 25 items. If the response has a
   `nextPageToken` field, repeat the call with the
   `pageToken` query parameter set to that value to get the next
   page.
2. Replace each peer project that's a Google-managed tenant project with the project that owns it. A peer project is a tenant project when, for example, an endpoint attachment targets a Google-managed service such as Memorystore, or when the peer project belongs to another Apigee organization. A tenant project ID usually ends in `-tp`, and some entries show only the project number. You can't view a tenant project, so `gcloud projects describe` and `gcloud access-context-manager lookup-configured-perimeter` return `PERMISSION_DENIED` for it. If you get this error for a peer project, the project is either a tenant project or a project that you don't have permission to view, such as a project in another organization.

   VPC Service Controls evaluates a Google-managed tenant project as the
   project that owns it. For an endpoint attachment, the owning project is the
   project that contains the managed service resource that publishes the target
   service attachment. For another Apigee organization, the owning
   project is the Apigee project of that organization. In the
   following steps, check the perimeter of the owning project. In perimeters,
   perimeter bridges, and ingress and egress rules, specify the owning project,
   not the tenant project.
3. Get the project number of your Apigee project and of each peer project. Service perimeters list projects by number. To get the number of a project from its ID, run the following command:

   ```
   gcloud projects describe PROJECT_ID --format="value(projectNumber)"
   ```

   If an entry is already a project number, you don't need to run this
   command, but check whether it's a tenant project as described in the
   previous step.
4. List the service perimeters in your access policy:

   ```
   gcloud access-context-manager perimeters list \
       --policy=POLICY_ID --format=list
   ```

   If you have
   [set a
   default access policy](https://docs.cloud.google.com/access-context-manager/docs/manage-access-policy#set-default), you can omit `--policy`.
5. For each perimeter, view its details:

   ```
   gcloud access-context-manager perimeters describe PERIMETER_ID \
       --policy=POLICY_ID
   ```

   In the `status` section, which is the enforced configuration,
   check whether `restrictedServices` includes
   `apigee.googleapis.com`, and note the projects and folders in
   `resources`.
6. For each peer project, find the perimeter of the peer project, or of its owning project for a tenant project, and the perimeter of your Apigee project. Compare them as described after these steps.

The `resources` field lists projects in the format
`projects/PROJECT_NUMBER`. A perimeter can also protect a
folder, in the format `folders/FOLDER_NUMBER`. A folder in
a perimeter protects the projects in it, unless a project is assigned to a
different perimeter. To find the perimeter that applies to a project, including
through a folder, run the following command:

```
gcloud access-context-manager lookup-configured-perimeter \
    --resource=projects/PROJECT_NUMBER
```

For more information, see
[Look up
configured perimeters for a resource](https://docs.cloud.google.com/vpc-service-controls/docs/configure-folder#lookup-perimeters).

A perimeter with `perimeterType: PERIMETER_TYPE_BRIDGE` is a
[perimeter bridge](https://docs.cloud.google.com/vpc-service-controls/docs/share-across-perimeters.md.txt).
A perimeter bridge has an empty `restrictedServices` field. Whether
`apigee.googleapis.com` is restricted for a project depends only on
the regular perimeter that the project belongs to.

You don't need to take action for a peer project if either of the following
is true:

- Neither your Apigee project nor the peer project is in a perimeter that restricts `apigee.googleapis.com`.
- Both projects are in the same perimeter, directly or through a folder.

Otherwise, the perimeters must allow the access that the following table
describes for the topology that matches your projects. In the table, the
*caller* is the identity and client that calls the affected
operation.

| Perimeters that restrict `apigee.googleapis.com` | Required access |
|---|---|
| Only the perimeter of your Apigee project | An egress rule in that perimeter that allows `apigee.googleapis.com` to the peer project. If the peer project is in a perimeter that doesn't restrict `apigee.googleapis.com`, a perimeter bridge that contains both projects also works. |
| Only the perimeter of the peer project | An egress rule in the peer project's perimeter that allows `apigee.googleapis.com` to your Apigee project. If your Apigee project is in a perimeter that doesn't restrict `apigee.googleapis.com`, a perimeter bridge that contains both projects also works. If the caller is outside the peer project's perimeter, you also need an ingress rule or an access level in that perimeter that allows the caller. |
| Both perimeters, when the two projects are in different perimeters | An egress rule in each perimeter that allows `apigee.googleapis.com` to the other project, or a perimeter bridge that contains both projects. If the caller is outside the peer project's perimeter, you also need an ingress rule or an access level in that perimeter that allows the caller. |

An ingress rule alone doesn't allow this access. Every perimeter that
restricts `apigee.googleapis.com` needs an egress rule to the other
project, or the two projects must share a perimeter bridge. For the rule format,
see [API
requests involving multiple service perimeters](https://docs.cloud.google.com/vpc-service-controls/docs/ingress-egress-rules#examples-multiple-perimeters).

If your perimeters don't allow the required access, the affected operations
fail for that peer project starting on or after January 15, 2027. To
resolve this issue, see the following section,
[Allow access between the projects](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#psc-perimeter-fix).

If a peer project, or the owning project of a tenant project, belongs to a
different Google Cloud organization, you might not have permission to view
the project or its perimeter, and the commands in this section return
`PERMISSION_DENIED`. Ask the owner of that project whether a
perimeter that restricts `apigee.googleapis.com` protects it.
Projects from different organizations can't share a perimeter or a perimeter
bridge, so only ingress and egress rules can allow this access. In those rules,
specify the owning project, not a tenant project.

> [!NOTE]
> **Note:** If a perimeter restricts `apigee.googleapis.com` only in its dry run configuration (the `spec` section of the `describe` output), the affected operations don't fail yet. They fail when you enforce that configuration. Before you enforce it, check your peer projects against the dry run configuration in the same way. For more information, see [Dry run mode for service
> perimeters](https://docs.cloud.google.com/vpc-service-controls/docs/dry-run-mode).

### Allow access between the projects

These options apply whichever project is in the restricting perimeter: your
Apigee project, the peer project, or both. Choose the option that
matches your security requirements:

- **Put both projects in the same perimeter.** Use this when both projects belong to the same trust boundary and the same organization. Add one project to the perimeter of the other project. A project can be in only one regular perimeter, so first remove that project from any perimeter that it's already in. See [Managing service perimeters](https://docs.cloud.google.com/vpc-service-controls/docs/manage-service-perimeters.md.txt).
- **Connect the projects with a perimeter bridge.** Use this when each project is in a perimeter in the same organization, and the table in [Check whether you are affected](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#psc-perimeter-check) lists a perimeter bridge for your topology. See [Sharing across
  perimeters with bridges](https://docs.cloud.google.com/vpc-service-controls/docs/share-across-perimeters).
- **Allow the access with ingress and egress rules.** Use this when the projects must stay in separate perimeters, or when only one of them is in a perimeter. Add the rules that the table in [Check whether you are affected](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#psc-perimeter-check) lists for your topology. See [Ingress and egress rules](https://docs.cloud.google.com/vpc-service-controls/docs/ingress-egress-rules.md.txt).
- **Remove the cross-perimeter reference.** Remove the peer project from the consumer accept list, or delete the endpoint attachment that points to the peer project.

Before you change a perimeter, you can use
[dry run mode](https://docs.cloud.google.com/vpc-service-controls/docs/dry-run-mode.md.txt) to see the effect of the
change without enforcing it.

## Granting integrated portals access to the perimeter

VPC-SC supports granting VPC-SC access levels to integrated portals, but this
process requires additional steps, as described in this section.

> [!NOTE]
> **Note:** Apigee with VPC-SC only supports granting access for *integrated* portals; it does *not* support granting access for *Drupal-based* portals.

If you do not grant an access level to integrated portals, then integrated portals are
unavailable for VPC-SC-enabled Apigee organizations.

Granting an access level to portals:

- Does not put integrated portals within the perimeter.
- Allows integrated portals to be accessed from outside the perimeter.
- Allows VPC-SC protected Apigee data (such as application data) exposure to portal users outside the VPC-SC perimeter.

For more information, see [Allowing access
to protected resources from outside a perimeter](https://docs.cloud.google.com/vpc-service-controls/docs/use-access-levels).

### Prerequisites

Before granting perimeter access to an integrated portal, you must enable the
`Access Context Manager API` for your project, if it is not already
enabled. You can do this in Cloud console or by using the [gcloud services enable](https://docs.cloud.google.com/sdk/gcloud/reference/services/enable) command.

To check if the API is enabled, examine the output of the [gcloud services list](https://docs.cloud.google.com/sdk/gcloud/reference/services/list) command, as
described in [Step 2: Enable Apigee APIs](https://docs.cloud.google.com/apigee/docs/api-platform/get-started/enable-apis.md.txt).

In addition, you must have the service account email address for the project that the portal is
used in. To get this, you need the Google Cloud project ID and project number. The following steps describe
how to get these values:

1. Get Google Cloud project details by using the [gcloud projects list](https://docs.cloud.google.com/sdk/gcloud/reference/projects/list) command, as the following example shows:

   ```
   gcloud projects list
   ```

   This command returns the project ID (in the `PROJECT_ID` column) and the
   project number (in the `PROJECT_NUMBER` column) for each project in your GCP
   organization.
2. Identify the Apigee service account email address. This is the same
   account that the Apigee installer created when you provisioned your organization in
   [Step 3: Create an organization](https://docs.cloud.google.com/apigee/docs/api-platform/get-started/create-org).

   > [!IMPORTANT]
   > **Terminology Note:** The term *service account* and *service agent* are used interchangeably.

   To get this email address, use the [`iam service-accounts list`](https://docs.cloud.google.com/sdk/gcloud/reference/iam/service-accounts/list) command, which uses
   the following syntax:

   ```
   gcloud iam service-accounts list --project GCP_PROJECT_ID
   ```

   For example:

       gcloud iam service-accounts list --project my-project

       DISPLAY NAME                              EMAIL                                                DISABLED
       Apigee default service account            service-8675309@gcp-sa-apigee.iam.gserviceaccount.com  False
       Compute Engine default service account     8675309-compute@developer.gserviceaccount.com          False

   The service account that you want is the one whose email address matches the following
   format:  
   `service-GCP_PROJECT_NUMBER@gcp-sa-apigee.iam.gserviceaccount.com`

   For example:  
   ``` ``service-`8675309`@gcp-sa-apigee.iam.gserviceaccount.com`` ```
3. Get the policy (or perimeter) ID by using the [`access-context-manager policies list`](https://docs.cloud.google.com/sdk/gcloud/reference/beta/access-context-manager/policies/list.md.txt) command. Pass the
   organization ID to this command, as the following example shows:

   ```
   gcloud access-context-manager policies list --organization=organizations/GCP_ORG_ID
   ```

   `gcloud` responds with a list of policies associated with the specified
   organization; for example:

       gcloud access-context-manager policies list --organization=organizations/2244340

       NAME          ORGANIZATION      TITLE                 ETAG
       04081981      2244340           Default policy        421924c5a97c0Icu8

   > [!IMPORTANT]
   > **Terminology Note:** The term *policy* in this context is synonymous with *perimeter*.

   VPC-SC's **policy ID** (also known as the *perimeter ID* ) is the ID of the
   VPC-SC *service perimeter* that acts as a boundary between your project and other
   services). It is the value in the `NAME` column.

### Steps to grant perimeter access to integrated portals

**To grant perimeter access to an integrated portal:**

1. Gather the service account email address and VPC-SC's policy ID, as described in [Prerequsites](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#prerequisites).
2. Create a conditions file on your admin machine that specifies the service account address
   that will grant the portal access through the perimeter.

   The file can be any name you want, but it must have a `*.yaml` extension. For
   example, `my-portal-access-rules.yaml`.
3. In the conditions file, add a `members` section that specifies the Apigee service
   account, as the following example shows:

       - members:
         - serviceAccount:service-`8675309`@gcp-sa-apigee.iam.gserviceaccount.com

   Note that adding a `members` section is sufficient; you do not need to add an
   access level section. For more information on creating a conditions file, see
   [Limit access by
   user or service account](https://docs.cloud.google.com/access-context-manager/docs/create-basic-access-level#members-example).
4. Create an access level with the [`access-context-manager levels create`](https://docs.cloud.google.com/sdk/gcloud/reference/beta/access-context-manager/levels/create.md.txt) command; for example:

   ```
   gcloud access-context-manager levels create ACCESS_LEVEL_ID \
     --title ACCESS_LEVEL_TITLE \
     --basic-level-spec PATH/TO/CONDITIONS_FILE.yaml \
     --policy=POLICY_ID
   ```

   Where:
   - <var translate="no">ACCESS_LEVEL_ID</var> is an identifier for the new access level that is being granted; for example, `my-portal-access-level`.
   - <var translate="no">ACCESS_LEVEL_TITLE</var> is a title for the access level. The title can be anything you want, but Google recommends that you give it a meaningful value so that you and other administrators will know what it applies to. For example, My Portal Access Level.
   - <var translate="no">CONDITIONS_FILE</var> is the path to the YAML file that you created in the previous step.
   - <var translate="no">POLICY_ID</var> is the policy or perimeter ID.

   For example:

       gcloud access-context-manager levels create my-portal-access-level \
         --title My Portal Access Level \
         --basic-level-spec ~/my-portal-access-rules.yaml \
         --policy=04081981

5. Update the perimeter with the new access level by using the [`access-context-manager perimeters update`](https://docs.cloud.google.com/sdk/gcloud/reference/beta/access-context-manager/perimeters/update.md.txt) command:

   ```
   gcloud access-context-manager perimeters update POLICY_ID \
     --add-access-levels=ACCESS_LEVEL_ID \
     --policy=POLICY_ID
   ```

   For example:

       gcloud access-context-manager perimeters update 04081981 \
         --add-access-levels=my-portal-access-level \
         --policy=04081981

### Troubleshooting

Check the following:

- If the Access Context Manager API is not enabled for your Google Cloud project, `gcloud` prompts you to enable it when you try to list or set policies.
- Make sure that you use the *Google Cloud* organization ID and not the *Apigee* organization ID when you get details about the organization.
- Some commands described in this section require elevated permissions; for example, to get details about service accounts for a project, you must be an owner of that project.
- To verify that the service account exists, execute the [`iam service-accounts describe`](https://docs.cloud.google.com/sdk/gcloud/reference/iam/service-accounts/describe)
  command, as the following example shows:

      gcloud iam service-accounts describe service-`8675309`@gcp-sa-apigee.iam.gserviceaccount.com

  `gcloud` responds with information about the service account, including the
  display name and project ID to which it belongs. If the service account doesn't exist,
  `gcloud` responds with a `NOT_FOUND` error.

## Regional endpoints with restricted network
egress

If you set
`networkEgressRestricted`
on your Apigee organization, the runtime reaches Google APIs only through the
[`restricted.googleapis.com`
virtual IP addresses](https://docs.cloud.google.com/vpc-service-controls/docs/set-up-private-connectivity). These addresses don't serve regional or multi-regional
endpoints, whose hostnames have the form
`SERVICE.LOCATION.rep.googleapis.com`. In this form,
<var translate="no">LOCATION</var> is a region, such as `us-central1`, or a multi-region, such
as `us` or `eu`. For example, connections to
`modelarmor.us-central1.rep.googleapis.com` and
`logging.us.rep.googleapis.com` fail during the TLS handshake because the
certificate doesn't match the hostname.

While network egress is restricted, Apigee doesn't support the following:

- The [SanitizeUserPrompt](https://docs.cloud.google.com/apigee/docs/api-platform/reference/policies/sanitize-user-prompt-policy.md.txt) and [SanitizeModelResponse](https://docs.cloud.google.com/apigee/docs/api-platform/reference/policies/sanitize-llm-response-policy.md.txt) policies, which call the regional Model Armor endpoint.
- Any other policy or target that calls a regional or multi-regional Google API endpoint, such as a ServiceCallout policy whose target is a `rep.googleapis.com` host.

To use these features, keep network egress unrestricted for the organization.

> [!WARNING]
> **Warning:** In an organization that uses [data residency](https://docs.cloud.google.com/apigee/docs/api-platform/get-started/drz-use-apigee.md.txt), distributed tracing with the `OPEN_TELEMETRY_CLOUD_TRACE` exporter sends trace data to a regional endpoint. If you restrict network egress, the runtime can't export these traces. After you set this exporter on an environment, you can't change or clear it with an update to the trace configuration. Before you restrict network egress, check the trace configuration of each environment. To stop trace export in an environment that already uses this exporter, set the sampler to `OFF`. For details, see [Disable
> the distributed tracing configuration](https://docs.cloud.google.com/apigee/docs/api-platform/develop/enabling-distributed-trace#disable-trace-config).

## Limitations

Apigee integrations with VPC Service Controls have the following limitations:

- Integrated portals require [additional steps](https://docs.cloud.google.com/apigee/docs/api-platform/security/vpc-sc.md.txt#portal) to configure.
- You must deploy Drupal portals within the service perimeter.