To define the services that can be accessed from a network inside your
service perimeter, use the *VPC accessible services* feature. The VPC accessible
services feature limits the set of services that are accessible from network
endpoints inside your service perimeter.

The VPC accessible services feature applies only to traffic from your
VPC network endpoints to Google APIs. Unlike service perimeters,
the VPC accessible services feature doesn't apply to communication between
Google APIs or to [tenancy units](https://cloud.google.com/service-infrastructure/docs/glossary#tenancy) networks, which are used to
implement certain Google Cloud services.

When configuring VPC accessible services for a perimeter, you can specify a
list of individual services. You can also include the `RESTRICTED-SERVICES`
value, which automatically includes all services protected by the perimeter.

To ensure that access to the expected services is limited, you must do the
following:

- Configure the perimeter to protect the same set of services that you want to make accessible.
- Restrict network access depending on whether you need to use unsupported services:
  - To restrict access to supported services, configure VPC networks to use the [restricted VIP](https://docs.cloud.google.com/vpc-service-controls/docs/set-up-private-connectivity.md.txt).
  - To restrict access to unsupported Google APIs, configure VPC networks to use the [private VIP](https://docs.cloud.google.com/vpc/docs/configure-private-google-access.md.txt#config-options) and configure [service patterns](https://docs.cloud.google.com/vpc-service-controls/docs/vpc-accessible-services.md.txt#service-patterns).
- Use VPC firewall rules to restrict traffic based on destination IP addresses.

## VPC network with Cloud Storage only

Assume you have a service perimeter, `my-authorized-perimeter`, that includes
two projects: `my-authorized-compute-project` and `my-authorized-gcs-project`.
The perimeter protects the Cloud Storage service.

`my-authorized-gcs-project` uses a number of services, including
Cloud Storage, Bigtable, and others.
`my-authorized-compute-project` hosts a VPC network.

Because the two projects share a perimeter, the VPC network in
`my-authorized-compute-project` has access to the resources of services in
`my-authorized-gcs-project`, regardless of whether the perimeter protects those
services. However, you want your VPC network to only have
access to Cloud Storage resources in `my-authorized-gcs-project`.

You are concerned that if the credentials for a VM in your VPC
network are stolen, an adversary could leverage that VM to exfiltrate data from
any available service in `my-authorized-gcs-project`.

You have already configured your VPC network to use the
restricted VIP, which limits access from your VPC network
only to APIs that are supported by VPC Service Controls. However, this
setting doesn't prevent your VPC network from accessing
supported services, such as the Bigtable resources in
`my-authorized-gcs-project`.

To limit the VPC network's access to only the storage service,
you enable VPC accessible services and set `storage.googleapis.com` as an
allowed service:

```bash
gcloud access-context-manager perimeters update my-authorized-perimeter \
  --enable-vpc-accessible-services \
  --add-vpc-allowed-services=storage.googleapis.com
```

Success! After running this command, the VPC network in
`my-authorized-compute-project` can only access Cloud Storage
resources. This restriction also applies to any projects and VPC
networks that you add to the perimeter later.

## VPC Service Controls service patterns

VPC Service Controls service patterns let you configure which Google APIs can be
accessed from VPC networks in a service perimeter when using the
private VIP. You can specify Google API URL patterns for unsupported services
that you want to allow access to and deny access to all other unsupported API
requests on the private VIP path.

You can use service patterns to attach HTTP headers (such as
`X-Goog-Allowed-Resources`) to API requests for unsupported services without
deploying a proxy. Doing so helps mitigate exfiltration risks by enforcing
tenant-based or domain-based restrictions.

To configure service patterns, see
[Limit access to Google APIs by using service patterns](https://docs.cloud.google.com/vpc-service-controls/docs/manage-service-perimeters.md.txt#service-patterns-cfg).

## What's next?

- [Use VPC accessible services.](https://docs.cloud.google.com/vpc-service-controls/docs/manage-service-perimeters.md.txt#accessible-services)
- [Optimize perimeters with recommender](https://docs.cloud.google.com/vpc-service-controls/docs/recommender.md.txt) ([Preview](https://cloud.google.com/products/#product-launch-stages)).