VPC Service Controls for a small team: is the perimeter worth it?

Most small teams should not start with a service perimeter. The organization prerequisite, the friction it adds, and when it pays for itself.

Published

Updated

Reading time

9 min

Most small teams should not start with VPC Service Controls. A service perimeter is a good control, and for the right data it is the best answer to a specific threat. But it comes with an organization-level prerequisite, a standing operational cost, and a rollout that touches CI, builds and every engineer's laptop, and for a team without dedicated security staff the same effort buys more risk reduction when spent on keyless identities, least privilege and project separation. The perimeter earns its place under a short list of conditions, given at the end. Until those hold, it is a distraction.

Here is what it does, why that is not the same as what IAM does, and where the friction actually lands.

What a perimeter does, and what it leaves alone#

IAM answers "is this identity allowed to call this API on this resource?". It says nothing about where the call comes from or where the data goes next. A leaked service account key, or a role granted too broadly, is allowed by IAM from any machine in the world. The VPC Service Controls overview describes a service perimeter as a security boundary around Google Cloud resources: traffic inside flows freely, and by default communication across it is blocked, whatever the caller's IAM permissions. The documentation names three risks it reduces:

  • Data exfiltration, by an outside actor or an insider, deliberate or accidental.
  • Stolen credentials, meaning requests made with stolen OAuth or service account credentials from outside the allowed environment.
  • Misconfigured IAM, where a policy exposes more than intended but the perimeter still denies access from unauthorised networks.

The same page states the limits, and they matter to the verdict:

  • It is not designed to enforce comprehensive controls on metadata movement. That is IAM's job.
  • It does not block calls to third-party or internet services.
  • Unsupported services should not be placed in a perimeter; restricting one with gcloud returns an error, and the documentation recommends running such services in projects outside the perimeter.
  • Data can still be processed, transformed and copied inside the perimeter. Someone inside can still read everything they are entitled to read.

At the time of writing there is no separate charge for the feature, per the pricing page. The cost is engineering time and operational friction, not a line on the bill.

The perimeter wraps the data and its users. Dashed arrows are blocked, or only logged during dry run, until a rule allows them.

The cheaper controls cover the common case#

The most common way a small team loses control of Google Cloud data is a long-lived credential in the wrong place. The perimeter does stop that, but so do cheaper controls:

ControlStolen key used from outsideCopy to another projectEffortRisk of breaking production
Keyless identities (no downloadable keys)There is no key to stealNoModerate, onceLow
IAM least privilegeNo: the key works from anywhereOnly if the identity lacks the roleOngoingLow
Organisation policy constraints, such as iam.disableServiceAccountKeyCreationPrevents the key from existingPartlyLowLow
Separate projects for sensitive data, narrow IAMLimits what a key reachesLimits itModerateLow
VPC Service Controls perimeterYes, if the caller is outside the allowed contextYes, unless an egress rule allows itHighReal, until tuned
Table 1— What each control stops, and what it costs a small team

The first rows remove the most likely incident before any perimeter exists. Workload Identity Federation for GitHub Actions is the keyless route for CI, and auditing a GCP IAM policy is the review that finds the over-broad roles. A perimeter placed on top of long-lived keys and wide roles is a safety net under a house with no walls.

The strongest argument for a perimeter#

The counter-argument deserves a real answer. Credentials do leak despite good hygiene: a token pasted into a ticket, a laptop compromised, a dependency that reads environment variables. IAM alone cannot help at that point, because the request is valid. A perimeter turns "valid credential" into "valid credential from an allowed context", and for data whose exfiltration would be a reportable event or a contract breach, that second condition is worth a lot.

I accept all of that, and the conclusion still holds for most small teams, for two reasons. The cheaper controls in the table shrink the same attack surface at a fraction of the effort, and a perimeter that is half-tuned or bypassed by a wide rule gives the feeling of protection without it. The argument for the perimeter becomes decisive only when the data is valuable enough, the services are supported, someone owns the rules, and the prerequisite below is already met.

The prerequisite that decides it for many teams#

A perimeter lives inside an access policy, and access policies belong to an organization. The documentation says an organization can have only one organization-level access policy, with scoped policies available for folders or projects, and that Compute Engine's perimeter guide requires a Google Cloud organization resource: if you have no Google Workspace or Cloud Identity account, you acquire one, and that creates the organization resource. Creating and changing perimeters then needs organization-level Access Context Manager permissions, held by a small group and not by everyone with project owner.

A team that runs a handful of projects under a personal account, with no organization, does not have a small gap to close. It has a migration to plan first: an organization resource, projects moved under it, and an administrator role to assign. That is worth doing for other reasons, but it is the first cost of the perimeter, and the one most "is it worth it" discussions skip.

Where the friction lands#

The recurring pains are all places where something legitimate calls an API from outside the perimeter.

  • Builds. The troubleshooting guidance for services inside perimeters says Cloud Build's worker VMs are outside the perimeter even when your project is inside it, so a build that needs perimeter resources requires the Cloud Build service account to be allowed in through an access level or an ingress rule. Per the supported-products page, perimeter protection for Cloud Build covers only builds on private pools, and Cloud Build Pub/Sub triggers are not supported.
  • Artifact Registry and Cloud Run. Services that read images, such as Cloud Run, belong in the same perimeter as the registry; Cloud Run's documentation says the registry must be in the same perimeter as the project you deploy to. For gcr.io repositories, ingress and egress rules must use the ANY_IDENTITY identity type; ANY_SERVICE_ACCOUNT and ANY_USER_ACCOUNT do not work.
  • CI outside Google Cloud. Hosted runners have no fixed addresses, so an access level based on IP ranges does not fit. The workable form is an identity-based ingress rule, shown below.
  • Engineers. Reaching resources inside a perimeter from the Cloud console needs an access level that permits specific IP ranges or particular user accounts. A query that used to run from a coffee shop stops working until the path is designed.
  • Third parties. A SaaS tool that reads your storage from its own cloud is blocked, and needs either an ingress rule or a different integration.
  • New APIs. Each new Google Cloud API a project starts using must be checked for whether it is supported and whether it needs a rule.

Count how many of these apply to you. If the list reads like a description of your daily workflow, the perimeter will be a daily cost.

If you go ahead: dry run first#

Perimeter resources are given as projects/PROJECT_NUMBER; project names and IDs are not accepted. Find the numeric policy name and the project numbers:

terminalbash
gcloud access-context-manager policies list --organization=ORGANIZATION_ID
 
gcloud projects describe my-data-project --format="value(projectNumber)"
gcloud projects describe my-app-project  --format="value(projectNumber)"

Create the perimeter as a dry run. The dry-run command takes the same settings as a regular perimeter with a --perimeter- prefix, per the create-perimeter documentation:

terminalbash
gcloud access-context-manager perimeters dry-run create data-perimeter \
  --perimeter-title="Data perimeter" \
  --perimeter-type=regular \
  --perimeter-resources=projects/111111111111,projects/222222222222 \
  --perimeter-restricted-services=storage.googleapis.com,bigquery.googleapis.com,secretmanager.googleapis.com \
  --policy=POLICY_ID

The project numbers are examples. Restrict the services that hold the data first; only products in the supported products table can be restricted. Requests that violate a dry-run perimeter are not denied, only logged, and they are not logged if the enforced configuration already denies them. The audit log marks them with metadata.dryRun set to true.

Violations appear in the audit logs of the project protected by the perimeter, under a log name ending in cloudaudit.googleapis.com%2Fpolicy. Entries carry a violationReason, for example NO_MATCHING_ACCESS_LEVEL, RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER or NETWORK_NOT_IN_SAME_SERVICE_PERIMETER:

terminalbash
gcloud logging read \
  'logName:"cloudaudit.googleapis.com%2Fpolicy"' \
  --project=my-data-project \
  --freshness=7d \
  --format="table(timestamp, protoPayload.authenticationInfo.principalEmail, protoPayload.serviceName, protoPayload.methodName)"

Group the results by principal, service and method. Each group is a legitimate flow you forgot (write a rule), an unexpected flow worth understanding (investigate first), or the thing you want blocked (leave it for enforcement). Keep the dry run going for a full cycle of deploys and scheduled jobs; the flow that breaks first is the one that runs once a month.

A rule for the hosted CI case, with example values. The deploy identity is a service account that impersonates through workload identity federation, and accessLevel: "*" allows the listed identity from any source, which fits runners without fixed addresses:

ingress-ci.yamlyaml
- title: "CI deployer: images and build outputs"
  ingressFrom:
    identities:
    - serviceAccount:ci-deployer@my-app-project.iam.gserviceaccount.com
    sources:
    - accessLevel: "*"
  ingressTo:
    operations:
    - serviceName: artifactregistry.googleapis.com
      methodSelectors:
      - method: "*"
    - serviceName: storage.googleapis.com
      methodSelectors:
      - permission: storage.objects.get
    resources:
    - projects/222222222222

Apply it to the dry-run configuration with --set-ingress-policies. Egress files use --set-egress-policies, and --add-resources and --add-restricted-services extend the other two lists:

terminalbash
gcloud access-context-manager perimeters dry-run update data-perimeter \
  --set-ingress-policies=ingress-ci.yaml \
  --policy=POLICY_ID

For an enforced perimeter the equivalent creation flags are --title, --resources, --restricted-services, --ingress-policies and --egress-policies. Keep each rule narrow: one identity, one service, one project. The tempting shortcut is identityType: ANY_SERVICE_ACCOUNT with serviceName: "*"; it passes the dry run quietly and removes most of the value of the perimeter.

When the dry-run log shows only violations you want blocked, promote it:

terminalbash
gcloud access-context-manager perimeters dry-run enforce data-perimeter \
  --policy=POLICY_ID

The command promotes the dry-run configuration to the enforced one and fails if no explicit dry-run configuration exists. Do it on a quiet weekday morning with the team present. Enforced violations are logged the same way, so the query above shows what is blocked now. Write down how to loosen or remove the perimeter before you need to.

The verdict#

Adopt a perimeter when all of these are true:

  1. You already have an organization resource, or you were going to create one anyway.
  2. The data is such that one leaked credential would be a reportable event or a contract breach, not just an annoying one.
  3. Every service that touches that data is on the supported-products list.
  4. Keyless identities are in place and the IAM audit is done, so the perimeter is the second line and not the only one.
  5. A named person owns the rules, reviews them on a schedule, and is reachable the week after enforcement.

If any of those is false, spend the effort on the cheaper controls in the table and revisit in a year. If most are true and one is missing, fix that one first: it is almost always the organization or the owner. A half-tuned perimeter that people route around with wide rules is worse than none, because it looks like protection.

Share
All articles →

A one-hour audit procedure for Google Cloud IAM: snapshot the policies, run eight targeted queries, triage what you find, and keep the result diffable.

13 min