Restricting Resource Locations in GCP

Restricting resource locations in GCP means controlling which geographic regions your team is allowed to create resources in. Without this control, developers can deploy Cloud Storage buckets, BigQuery datasets, Compute Engine instances, and other services to any region GCP supports — including ones outside your approved territory. The primary tool for enforcing this is the gcp.resourceLocations Organisation Policy constraint.

When enforced, the constraint intercepts API calls that try to create resources in non-approved locations and rejects them immediately, before the resource exists. Teams see a policy violation error that names the blocking constraint and tells them what to change. This makes regional misconfigurations structurally impossible rather than relying on developers to remember the rules.

By the end of this page you will understand how the constraint works, which location values to use for different compliance requirements, how to configure and apply it at the right level in your resource hierarchy, and what else you need alongside it to meet a complete data residency obligation.

Simple explanation

Imagine your company’s compliance rule says all customer data must stay in the EU. Without any restrictions in GCP, any developer on any project can create a Cloud Storage bucket in the US or Asia-Pacific with no friction. The platform will not stop them.

The constraint is preventive, not corrective. It stops new violations from happening. It does not move or delete resources that already exist in non-approved locations. You need to audit and migrate those separately — more on that below.

How it works

gcp.resourceLocations is a list constraint in the Organisation Policy Service. List constraints work by checking whether a value — in this case a resource’s target location — appears in an approved list before resource creation proceeds.

When you enforce this constraint, here is the sequence:

  1. A developer runs an API call (or gcloud command) that specifies a location for a new resource

  2. The Organisation Policy Service checks the location against the allowedValues list in the effective policy

  3. If the location is on the list, the resource is created normally
  4. If it is not on the list, the request is rejected immediately with a policy violation error before anything is created

A few behaviours that matter in practice:

  • If an API call omits a location and the service would default to a non-approved region, the call still fails

  • The check happens at creation time only. It has no effect on resources that already exist

  • The constraint evaluates the location declared in the API call, not where data flows internally within GCP systems

  • The policy is inherited. A constraint set at the organisation level automatically applies to every folder and project below it

What values you can allow

Three types of values work in the allowedValues list:

Individual regions

Exact region names like europe-west2 (London), europe-west4 (Netherlands), or us-central1 (Iowa). These give precise control. If a region is not in your list, it is blocked. Individual region names do not use the in: prefix. They are listed directly.

Multi-regions

Values like eu (Cloud Storage European multi-region) or us (US multi-region). Used alongside individual regions when you want to allow Cloud Storage’s multi-region storage tier. These are also listed directly without a prefix.

Location groups with the in: prefix

Pre-defined collections maintained by GCP, such as in:eu-locations, in:europe-locations, and in:us-locations. The in: prefix tells the policy engine you are referencing a named group, not a literal region string. Groups automatically include new regions as GCP launches them, so your policy does not need updating when a new region opens within the group.

Common mistake

Writing in:europe-west2-locations when trying to allow the London region is not valid. The correct value is simply europe-west2, listed without any prefix. The in: prefix is only for named GCP location groups, not for individual regions.

EU vs Europe: which location group to use

The single most common configuration mistake with this constraint is confusing in:eu-locations and in:europe-locations. They sound similar but cover different territory.

in:eu-locationsin:europe-locations
CoverageEU member state regions onlyAll European regions including UK
Includes UK?No. UK left the EU.Yes
Includes europe-west2 (London)?NoYes
Typical use caseStrict EU data residencyEurope-wide hosting where UK is an approved territory
Common mistakeAssuming it includes the UKAssuming it equals EU-only

If your compliance obligation is GDPR data residency and your approved territory includes the UK (which has its own UK GDPR regime), use in:europe-locations. If your regulatory requirement specifies EU member state regions only, use in:eu-locations.

Getting this wrong causes real problems in either direction. Too narrow and you block UK workloads that were approved. Too broad and you allow UK storage when the requirement is EU-only. Confirm with your legal or compliance team before enforcing.

Other useful location groups:

  • in:us-locations — all GCP regions in the United States

  • in:northamerica-locations — all North American regions including Canada

  • in:asia-locations — all Asia-Pacific regions

When to use this

  • Enforcing data residency obligations. GDPR, sector-specific regulations, or contractual requirements that say customer data must remain in a specific region or country.

  • Government and public sector requirements. Rules that restrict data to a particular national territory, such as UK-only or Germany-only hosting.

  • Reducing accidental deployments. Developers who do not know the approved regions get a hard stop instead of a soft reminder. The policy removes the human error vector entirely.

  • Governance and audit readiness. Regional compliance becomes structurally enforced rather than process-dependent, which simplifies audit evidence collection.

  • Organisation-wide baseline. Set once at the organisation or folder level and all current and future projects inherit it automatically, including ones created next year.

  • Reducing unexpected costs. Prevents resource deployments in regions that attract higher charges or egress fees.

When this is not enough

Location restriction answers one question: where can resources be created? It does not cover encryption, access control, or network isolation. For most compliance frameworks, you need additional controls alongside it.

Encryption key ownership

Even if your data is stored in an EU region, GCP holds the encryption key by default. For full control over who can decrypt your data, use Customer-Managed Encryption Keys (CMEK). CMEK lets you generate, hold, and rotate keys in Cloud KMS so GCP cannot access plaintext without your key. CMEK is commonly required alongside location restrictions in strict compliance frameworks.

Data access visibility

Location control does not tell you who read or modified your data. Cloud Audit Logs record data access events. Enable Data Access audit logs on every service holding regulated data so you have a full record of who accessed what and when. Without this, a location-compliant bucket with unrestricted read access is still a compliance gap.

Network-level access

Location restricts where resources live, not which networks or identities can reach them across API boundaries. VPC Service Controls let you define a perimeter restricting which projects and identities can call your APIs, reducing the risk of data exfiltration even if a credential is compromised.

Contextual access control

IAM Conditions let you restrict role bindings by request context: time windows, resource names, or resource tags. They do not add location enforcement, but they complement it by limiting who can access resources that are already location-controlled.

The full picture

A mature data residency implementation typically uses location restriction, CMEK, audit logging, and VPC Service Controls together. Location restriction is usually enforced first because it is the clearest guardrail to configure and audit. But it is the start of the implementation, not the end.

Configuring and applying the constraint

Policies are written in YAML and applied with gcloud org-policies set-policy. The name field in the YAML determines where in the resource hierarchy the policy is set.

# Allow only two specific regions: London and Netherlands
name: organizations/ORG_ID/policies/gcp.resourceLocations
spec:
  rules:
    - values:
        allowedValues:
          - europe-west2
          - europe-west4
# Allow all EU member state regions (excludes UK)
name: organizations/ORG_ID/policies/gcp.resourceLocations
spec:
  rules:
    - values:
        allowedValues:
          - in:eu-locations
# Allow all European regions including UK, plus the EU multi-region storage tier
name: organizations/ORG_ID/policies/gcp.resourceLocations
spec:
  rules:
    - values:
        allowedValues:
          - in:europe-locations
          - eu
# Apply at folder level instead of org — change the name prefix
name: folders/FOLDER_ID/policies/gcp.resourceLocations
spec:
  rules:
    - values:
        allowedValues:
          - in:europe-locations
# Apply the policy from a YAML file
gcloud org-policies set-policy location-policy.yaml

# Verify the effective constraint on a specific project
gcloud org-policies describe gcp.resourceLocations \
  --project=my-app-prod

# List all org policies effective on a project, including inherited ones
gcloud org-policies list \
  --project=my-app-prod

# Test the constraint: try creating a resource in a blocked region
# A correctly enforced policy returns an error naming constraints/gcp.resourceLocations
gcloud storage buckets create gs://test-bucket \
  --location=us-central1 \
  --project=my-app-prod

After applying, test by attempting to create a resource in a disallowed location. A correctly enforced policy returns an error naming constraints/gcp.resourceLocations as the blocking constraint. If no error appears, verify the policy is set at the right level in the hierarchy and that no child override is allowing the location.

Where to set the constraint in the hierarchy

Apply location constraints at the organisation or folder level, not the project level. A project-level constraint only covers that one project. Any new project created later inherits nothing from it.

A practical structure for an organisation with strict EU data residency:

  • Set in:eu-locations at the organisation level as the baseline. All projects inherit it automatically.

  • For workloads that legitimately need non-EU infrastructure (CDN edge nodes, global load balancers), create a separate folder with a broader location policy and a documented business justification.

  • Document any project-level exceptions with the owning team, the reason, and a review date so they do not persist indefinitely.

Existing resources are not affected

The constraint only prevents new resource creation. Resources already deployed in non-approved regions continue to run. After enforcing, use Cloud Asset Inventory to identify existing out-of-compliance resources and plan migration separately. The constraint prevents the problem from growing but does not fix what already exists.

Before enforcing

Run gcloud services list —enabled —project=PROJECT_ID for each project to identify which services are in use. Then check GCP’s regional availability documentation for each service. Some services, particularly newer ML and AI services, are unavailable in certain regions. Enforcing a strict location policy without checking this first can block legitimate workloads.

Auditing for existing out-of-compliance resources

Location policy only prevents future violations. To find resources already outside your approved locations, Cloud Asset Inventory is the most practical tool:

# Find all Cloud Storage buckets and their locations across the org
gcloud asset search-all-resources \
  --scope=organizations/ORG_ID \
  --asset-types=storage.googleapis.com/Bucket \
  --format="table(name,location)"

# Find Compute Engine instances running in US zones
gcloud compute instances list \
  --project=my-app-prod \
  --filter="zone:us-*" \
  --format="table(name,zone,status)"

# Find BigQuery datasets and their locations
bq ls --format=prettyjson --project=my-app-prod | \
  python3 -c "import json,sys; [print(d['datasetReference']['datasetId'], d.get('location','unknown')) for d in json.load(sys.stdin)]"

Once you have the inventory, prioritise migration based on data sensitivity. Resources holding customer data or regulated information should be addressed before infrastructure-only resources.

Common mistakes

  1. Using in:eu-locations when the requirement includes the UK.

    The UK left the EU. If your approved territory includes the UK, use in:europe-locations instead. Confirming the correct group with your legal team before enforcing saves a painful rollback later.

  2. Adding the in: prefix to individual regions.

    Writing in:europe-west2-locations is not valid. The correct value is europe-west2 listed directly. Only named GCP location groups use the in: prefix.

  3. Applying the constraint at project level only. A project-level policy only protects that project. New projects created later inherit nothing from it. Apply at the folder or organisation level, and document exceptions at the project level for specific approved cases.

  4. Not checking service availability before enforcement. Some services are unavailable in certain regions. Enforcing a strict location policy without checking first can block legitimate deployments and require urgent policy rollbacks.

  5. Treating location restriction as complete compliance. Location is one component. Full data residency also requires encryption with customer-managed keys, audit logging via Cloud Audit Logs, and typically VPC Service Controls for network isolation. Location control satisfies only one part of most regulatory frameworks.

Frequently asked questions

How do I restrict which regions GCP resources can be created in?

Use the constraints/gcp.resourceLocations Organisation Policy constraint. Write a policy YAML with allowedValues listing specific regions or in: location groups, then apply it with gcloud org-policies set-policy. Apply at the organisation or folder level, not per-project, so future projects inherit it automatically. Resources already deployed are not retroactively deleted or moved — the policy only prevents new resource creation.

What is the difference between in:eu-locations and in:europe-locations?

in:europe-locations includes all GCP regions physically located in Europe, including UK regions such as europe-west2. in:eu-locations includes only regions in EU member states — the UK is excluded after Brexit. For compliance requirements where the approved territory includes the UK, use in:europe-locations. For strict EU-only data residency requirements, use in:eu-locations. Confirm with your legal team before enforcing, as choosing the wrong group either over-restricts or under-restricts your environment.

Does restricting resource locations affect existing resources?

No. The constraint is not retroactive. Resources already running in non-approved locations continue to operate. The policy only blocks new resource creation in restricted locations. After enforcing the constraint, audit existing resources with Cloud Asset Inventory to find out-of-compliance deployments, then plan migration separately.

What happens when a service I need is not available in my approved regions?

The location constraint will block deployment attempts and return a policy violation error. Before enforcing location restrictions, audit all services your workloads use with gcloud services list --enabled --project=PROJECT_ID and verify regional availability for each in GCP documentation. Some services — particularly newer ML and AI services — have limited regional availability and may need exemption projects or workarounds while regional expansion catches up.

Does gcp.resourceLocations provide full data residency compliance?

No. Location control is one layer. Full data residency typically also requires customer-managed encryption keys (CMEK) to control who holds the encryption keys, Cloud Audit Logs to record data access, and sometimes VPC Service Controls to restrict network-level access. Location restriction prevents resources being created in wrong regions, but does not govern who can access the data, how it is encrypted, or which networks can reach it.

Do individual region names use the in: prefix?

No. The in: prefix is only for GCP predefined location groups such as in:eu-locations, in:europe-locations, and in:us-locations. Individual region names like europe-west2 or us-central1 are listed directly in allowedValues without any prefix. Multi-region values like eu and us are also listed directly. Only named location groups use the in: prefix.

Last verified: 22 March 2026 Cloud services change frequently. Verify details against official documentation before making infrastructure decisions.