3: Designing for security and compliance

    Designing for security. Considerations include

    A Google Cloud security design is the composition of:

    • identity decisions
    • hierarchy decisions
    • key and secret decisions
    • network perimeter decisions
    • access-path decisions

    None of those decisions stand alone. A permissive Identity and Access Management model invalidates an otherwise correct VPC Service Controls perimeter; a missing key separation invalidates an otherwise correct hierarchical firewall policy. The architect's job is to compose these controls so that no single misconfiguration produces a data exposure, and so that every control is testable through audit evidence.

    How it works

    The Google Cloud security model rests on three architectural commitments.

    • First, every action against a Google Cloud API is authenticated and authorized through IAM, including actions taken by service accounts on behalf of workloads.
    • Second, every resource lives under a parent in the resource hierarchy, which means policies set high in the hierarchy bind every resource beneath, with no escape.
    • Third, every API call produces an audit record, which means after-the-fact evidence is always available even when prevention failed.

    The architect's design must trust these commitments and build on them, not bypass them.

    Identity and Access Management (IAM)

    Cloud Identity and Access Management is the access control plane for every Google Cloud resource.

    An IAM policy is a list of role bindings, where each binding grants one or more principals one role on a specific resource. A principal can be:

    • a Google account
    • a Google group
    • a Cloud Identity or Workspace domain
    • a service account
    • a workload identity pool member
    • one of the special identifiers such as allAuthenticatedUsers or allUsers

    A role is a named bundle of permissions; granting a role grants all of its permissions, never a subset. Roles come in three flavors.

    Basic roles, namely roles/owner, roles/editor, and roles/viewer, are coarse, predate IAM's predefined catalog, and are forbidden in production designs because they grant permissions that span every service.

    Predefined roles, formatted as roles/<service>.<role_name>, are curated by Google per service and per job function, such as roles/bigquery.dataViewer or roles/storage.objectAdmin.

    Custom roles, defined at the organization or project level, let the architect compose an exact permission set when no predefined role fits the job function.

    The design choice between predefined and custom hinges on permission drift: predefined roles change as Google adds permissions to services, which is convenient when the role is meant to represent a job function but risky when the role is meant to grant a specific operation only. Group strategy is the multiplier that makes IAM tractable.

    Bind roles to Google Groups in Cloud Identity, never to individual users, and manage user membership in the identity provider.

    A typical pattern is to define functional groups such as gcp-billing-admins@acme-corp.example, gcp-network-admins@acme-corp.example, and gcp-data-platform-engineers@acme-corp.example, then bind each group to one role at the appropriate hierarchy level.

    This produces an IAM topology where adding or removing a user is a single group-membership change, which is essential for joiner/mover/leaver workflows and for audit defensibility.

    Service accounts are first-class principals and the dominant identity inside workloads. Two sub-types matter for design.

    • User-managed service accounts are created and named by the customer and represent workloads.
    • Google-managed service accounts are created by Google when a service is enabled, represent the service itself, and must not be modified.

    The user-managed service account pattern for workloads has shifted away from downloaded JSON keys toward keyless identity through Workload Identity Federation (for external workloads) or Workload Identity (for GKE workloads); downloaded keys remain valid only when an external system cannot federate, and they require explicit lifecycle controls.

    IAM Conditions extend a binding with an attribute expression that must evaluate to true for the binding to apply. Conditions take attributes from the request (such as request.time, request.auth.access_levels) and from the resource (resource.name, resource.type). Conditional bindings encode patterns such as "grant roles/storage.objectViewer on this bucket only between 09:00 and 18:00 in Europe/Berlin" or "grant access only if the access level corp_network_only is satisfied." Conditions do not let an architect grant additional permissions; they only narrow an existing grant.

    Policy Intelligence tools harden the IAM model after deployment.

    • IAM Recommender analyzes 90 days of access patterns and recommends role downgrades from broad roles to narrower predefined roles.
    • Policy Analyzer answers "who has access to what under what condition" by traversing every binding in the hierarchy.
    • Policy Troubleshooter answers the inverse: "why did principal P fail to access resource R."

    Each tool produces evidence usable in audit defense, and each is part of the design, not just operations.

    💡 Exam Trap: Basic roles (roles/owner, roles/editor, roles/viewer) appear as distractors for tasks like "grant a developer permission to deploy Cloud Run." The correct answer is always a predefined role such as roles/run.developer, with a service account user role bound to the appropriate service account on the side. If basic roles appear in a multi-option choice, they are almost never the correct answer in a Professional-tier scenario.

    💡 Exam Trap: A binding granted at the project level always includes that project's resources, even when a more restrictive binding exists at the resource level. IAM bindings are additive; a deny is not the absence of a grant. The deny semantics require IAM Deny Policies, which evaluate before allow policies and override them at the named permission level.

    ⚠️ Anti-Pattern: Granting roles/iam.serviceAccountUser at the project level so that every developer can act as every service account. The correct pattern is to grant roles/iam.serviceAccountUser on the specific service account resource for the specific principal, which mints a least-privilege relationship and produces audit evidence of who acted as whom.

    🎯 Scenario: A data engineering team needs to deploy Dataflow jobs that read from Cloud Storage and write to BigQuery. The team also includes contractors with rotating membership. The architect creates gcp-data-engineers@acme-corp.example and binds it to roles/dataflow.developer and roles/iam.serviceAccountUser on a dedicated dataflow-runner@acme-data-prj.iam.gserviceaccount.com service account, then grants the service account roles/storage.objectViewer on the source bucket and roles/bigquery.dataEditor on the destination dataset. Contractor onboarding becomes a single Cloud Identity group action.

    Decision Anchor: Choose a predefined role when a documented Google-curated role matches the job function and permission creep is acceptable (because the role represents a job, not a specific operation). Choose a custom role when the job is narrow enough that you want explicit permission control and you commit to maintaining the role as services evolve.

    Resource hierarchy (organizations, folders, and projects)

    The resource hierarchy is the structural backbone that makes policy inheritance, billing partitioning, and tenant isolation work. The hierarchy has four nodes.

    • The organization is the root and represents the Cloud Identity or Workspace domain.
    • Folders sit beneath the organization, can nest up to ten levels deep, and group projects by business unit, environment, or compliance scope.
    • Projects are the unit of resource ownership and billing, and every resource (except billing and folder objects) lives in exactly one project.
    • Resources are the lowest node, owned by a project.

    Hierarchy design starts with the business shape, not the technology shape. A common production pattern uses top-level folders by business unit (bu-retail, bu-payments, bu-corporate), then environment folders inside each (prod, nonprod, sandbox), then projects per workload.

    A separate top-level folder named shared or common holds platform projects such as the logging sink project, the network host project for Shared VPC, the artifact registry project, and the security operations project. The platform projects sit beside the business folders, not under them, because platform services are consumed by every business unit and must not inherit business-unit policies.

    Policy inheritance flows down.

    • An IAM binding at the organization applies to every folder, project, and resource beneath it.
    • An Organization Policy constraint applied at a folder applies to every project beneath that folder.

    This is the property that makes hierarchy design strategic: a control set once at the organization level binds every workload, including workloads created in the future. The corollary is that mistakes at the organization or folder level have a wide blast radius, which is why hierarchy changes are change-controlled and tested in a separate non-production organization where possible.

    Key points

    Project sprawl is a hierarchy problem disguised as an inventory problem. The Google Cloud design pattern is many small projects rather than few large projects.

    Per-workload projects produce strong blast-radius containment because IAM, networking, and quotas are project-scoped by default. Cross-project access patterns then use Shared VPC for networking, service account impersonation for compute, and explicit IAM grants for storage and data services.

    The cost of many projects is operational: the architect must invest in Infrastructure as Code, project factory tooling (such as the Cloud Foundation Toolkit's Project Factory module), and a project lifecycle policy.

    Project liens prevent accidental deletion of high-value projects. A lien at the project level blocks resourcemanager.projects.delete until removed by an authorized principal.

    Folders provide a similar protection through Organization Policy constraints on project moves. For shared production projects, applying both a lien and a deletion-prevention constraint produces defense-in-depth against operator error and against compromised credentials.

    Billing structure layers on top of the hierarchy. Billing accounts are not part of the resource hierarchy; they are separate objects linked to projects through the billing account ID.

    A common pattern uses one Cloud Billing account per legal entity, with chargeback driven by project labels and folder placement. Labels such as cost_center, application, data_classification, and owner are essential for cost allocation and for security filtering in audit pipelines, and they are best applied through the project factory.

    💡 Exam Trap: Organization-level IAM bindings cannot be overridden by lower-level Deny Policies in the sense of "removing access." Deny Policies block specific permissions; they do not retract role grants. If a scenario requires removing a role from one folder, the correct answer is to remove the binding at the higher level and re-grant it at the narrower level, or apply an IAM Deny Policy that targets the specific permission.

    💡 Exam Trap: The "App Engine application" creates an irreversible region binding at the project level. If a scenario plans to deploy App Engine in a region the architect later regrets, the project must be deleted and recreated. The same constraint applies to Cloud Storage default bucket location only at the bucket level, not at the project level.

    ⚠️ Anti-Pattern: Mixing environments within a single project (production and non-production resources in the same project ID). IAM is project-scoped by default, so production and non-production share their default service accounts, their default VPC, their default quotas, and their default audit log destination, which destroys blast-radius containment.

    📊 Limit: Folder nesting depth is 10 levels. A project can have up to 100 folders as ancestors only if folders are nested that deeply. Most production designs stay within 3-4 levels (org -> bu -> environment -> optional sub-grouping -> project).

    Decision Anchor: Choose folder-based environment separation (bu-x/prod, bu-x/nonprod) when business units share a platform team and policies. Choose top-level environment folders (prod, nonprod at the root) when environment policy uniformity across the entire estate is more important than business-unit autonomy.

    acme-corp.example (Organization)
    |-- folders/shared
    | |-- projects/acme-net-host-prj # Shared VPC host
    | |-- projects/acme-logging-sink-prj # Aggregated audit log sink
    | |-- projects/acme-artifact-registry-prj
    | `-- projects/acme-secops-prj
    |-- folders/bu-retail
    | |-- folders/prod
    | | |-- projects/acme-retail-web-prod
    | | `-- projects/acme-retail-data-prod
    | |-- folders/nonprod
    | | |-- projects/acme-retail-web-stg
    | | `-- projects/acme-retail-data-stg
    | `-- folders/sandbox
    | `-- projects/acme-retail-sandbox-001
    `-- folders/bu-payments
     |-- folders/prod # PCI DSS scope
     | `-- projects/acme-payments-pci-prod
     `-- folders/nonprod
     `-- projects/acme-payments-pci-stg
    

    Data security (key management, encryption, secret management)

    Data security in Google Cloud is built on three commitments.

    • Every customer data store is encrypted at rest by default with Google-managed encryption keys.
    • Every customer data store can be encrypted with customer-managed encryption keys through Cloud KMS when the regulator or internal policy demands customer control of key material.
    • Every Google Cloud network path between services carries data encrypted in transit, and customer-controlled paths can require TLS 1.2 or higher through Organization Policy.

    Encryption at rest has four options that the architect picks per workload.

    • Google-managed encryption keys (GMEK) is the default; Google generates, stores, and rotates the data encryption keys (DEKs) and key encryption keys (KEKs) inside Google-managed key hierarchies.
    • Customer-managed encryption keys (CMEK) puts the KEK in a Cloud KMS key ring under the customer's project; the DEK still wraps the data and the KEK still wraps the DEK, but the customer controls the KEK's IAM policy, rotation period, and destruction.
    • Customer-supplied encryption keys (CSEK) lets the customer supply the raw key material with each request to Cloud Storage or to Compute Engine; Google holds the material only for the duration of the operation.
    • Cloud External Key Manager (Cloud EKM) puts the KEK outside Google entirely, in a partner key manager such as Fortanix, Thales, Equinix SmartKey, or Futurex, and Cloud KMS calls out to the external manager for each wrap and unwrap.

    Encryption in transit splits into three zones.

    • Inside a Google Cloud region, traffic between Google Cloud services is authenticated and encrypted at the network layer through Application Layer Transport Security (ALTS).
    • Across Google's private backbone between regions, traffic is encrypted by default.
    • Across the public internet between a client and a Google Cloud endpoint, the customer is responsible for choosing TLS, and the architect uses Cloud Load Balancing TLS termination, mTLS where supported (such as on regional internal Application Load Balancers and Cloud Service Mesh), and Cloud Armor TLS policies.

    Secret management is the discipline of getting secret material into workloads without ever writing it to disk in plaintext or committing it to source control. Secret Manager is the Google Cloud managed offering.

    A secret is a named resource in a project; each version of the secret is immutable and carries one payload, with optional CMEK encryption. Workloads read secrets through the Secret Manager API at runtime, with IAM controlling who can access which version.

    Secret Manager supports automatic rotation triggered by a Pub/Sub message, replication policies (automatic for global redundancy or user-managed for regional pinning), and Cloud Audit Logs entries on every access.

    # Create a regional, user-managed-replication secret with CMEK
    gcloud secrets create db-password \
     --project=acme-payments-pci-prod \
     --replication-policy=user-managed \
     --locations=europe-west4 \
     --topics="projects/acme-payments-pci-prod/topics/secret-rotation" \
     --kms-key-name="projects/acme-payments-pci-prod/locations/europe-west4/keyRings/secrets-kr/cryptoKeys/secrets-kek"
    
    # Add a new version
    echo -n "S3cret!Value" | gcloud secrets versions add db-password \
     --data-file=- \
     --project=acme-payments-pci-prod
    
    # Grant read access to a service account on the secret resource
    gcloud secrets add-iam-policy-binding db-password \
     --member="serviceAccount:payments-api@acme-payments-pci-prod.iam.gserviceaccount.com" \
     --role="roles/secretmanager.secretAccessor" \
     --project=acme-payments-pci-prod
    

    Sensitive Data Protection (the Google Cloud product family that includes the Cloud Data Loss Prevention API and the discovery features) is the data-aware layer of the security model.

    It inspects unstructured and structured content for over 150 infoType detectors (credit card numbers, PAN, IBAN, US SSN, passport numbers, custom regex patterns), and applies transformations (redaction, masking, format-preserving encryption, cryptographic hashing, date shifting).

    • For data warehouses, the discovery feature continuously profiles BigQuery and Cloud SQL data and surfaces findings as security findings.
    • For application data flows, the inspection API runs inline in Cloud Run or Cloud Functions to scrub PII before it lands in a downstream system.

    💡 Exam Trap: CSEK is supported only on Cloud Storage and Compute Engine persistent disks. It is not supported on BigQuery, Cloud SQL, Spanner, or Vertex AI; those services that support customer control use CMEK or Cloud EKM. If a scenario asks about "customer-supplied key material" for BigQuery, the answer is Cloud EKM (which holds the material outside Google), not CSEK.

    💡 Exam Trap: The Secret Manager automatic replication policy stores the secret across multiple regions globally and cannot be combined with a regional CMEK key. To use CMEK, the secret must use user-managed replication and a key in each chosen location.

    ⚠️ Anti-Pattern: Storing application secrets as environment variables baked into a Compute Engine instance template or a Cloud Run service revision. Environment variables appear in Cloud Logging during deployment, in gcloud describe output, and in audit logs that include the resource state. Secret Manager references injected at runtime (such as Cloud Run's --update-secrets=DB_PASSWORD=db-password:latest) keep secret material off the resource definition.

    📊 Limit: Secret Manager supports up to 65,536 bytes per secret payload, up to a default of 100 secret versions kept active per secret, and a default 200 versions retained including disabled and destroyed ones (configurable via version aliases and lifecycle rules).

    Decision Anchor: Choose GMEK when no regulator requires customer control of key material and operational simplicity is the priority. Choose CMEK when the regulator requires the customer to control rotation, destruction, and IAM on the KEK, but accepts that the KEK lives inside Google's infrastructure (FIPS 140-2 Level 3 HSMs are available with the hsm protection level).

    Choose Cloud EKM when the regulator requires the KEK material to be outside Google's infrastructure entirely.

    Separation of duties

    Separation of duties is a control objective, not a single product.

    The objective is that no single principal can both perform a sensitive action and erase the evidence of having performed it, and that no single principal can complete a high-impact change unilaterally.

    Google Cloud supports this objective through:

    • Role partitioning
    • Identity partitioning
    • Change-control partitioning
    • The dedicated Access Approval workflow that gates Google support access.

    Role partitioning splits sensitive roles across distinct principal groups.

    The classic Cloud KMS pattern grants roles/cloudkms.admin (key creation and IAM management) to a key administration group and roles/cloudkms.cryptoKeyEncrypterDecrypter (key usage) to workload service accounts.

    A key administrator can rotate or disable a key but cannot use it to decrypt data.

    A workload can decrypt data but cannot disable the key or change its IAM.

    The two roles must never be granted to the same principal in production. The same pattern applies to:

    • Billing (roles/billing.admin versus roles/billing.user)
    • Networking (roles/compute.networkAdmin versus roles/compute.securityAdmin)
    • Logging (roles/logging.configWriter for sink configuration versus roles/logging.viewer for read)

    Identity partitioning separates human identities from workload identities.

    Humans authenticate through Cloud Identity or Workspace, with mandatory multi-factor authentication enforced by an Organization Policy constraint that requires 2-step verification (constraints/iam.allowedPolicyMemberDomains and the related policies).

    Workloads authenticate through service accounts, with no human in the loop after deployment.

    The architect explicitly forbids human use of workload service accounts through IAM Conditions that block iam.serviceAccountUser outside an approved CI/CD pipeline identity, and through Cloud Audit Logs alerts that flag interactive use of service account tokens.

    Change-control partitioning uses the deployer/approver split inherent to CI/CD pipelines.

    • The deployer is a service account that holds the permissions to mutate infrastructure (such as roles/compute.admin in a specific project).
    • The approver is the human pull-request reviewer who approves the merge that triggers the pipeline.

    The human never holds the deployer's permissions directly; the human's only privilege is to approve a merge in the source-control system, and that act of approval is itself audited. Binary Authorization extends this pattern to container images by requiring signed attestations from a build authority before a deployment can occur.

    Access Approval gates Google support access to customer data. When enabled at the organization or project level, any access by Google support engineers that would touch customer data first emits an Access Approval request to designated customer approvers, who must approve before the access proceeds. Combined with Access Transparency (which produces audit logs of Google administrative access), the customer gets a non-repudiable record of every Google touch on the environment. Access Approval is not enabled by default; it is an explicit opt-in and is required for many high-regulation industries.

    Break-glass accounts close the residual gap. Even with strict separation of duties, there are scenarios where the lone Organization Administrator becomes unreachable. A break-glass account is a dedicated identity (often two, held by separate executives) granted roles/resourcemanager.organizationAdmin only when an incident commander activates it. The account credentials are stored in a tamper-evident vault, use a hardware security key for the second factor, and emit a high-severity alert on use through Cloud Logging routing to the security operations channel.

    💡 Exam Trap: Granting roles/owner to a CI/CD pipeline service account is the most common separation-of-duties failure in Professional-tier scenarios. The correct pattern is to grant the pipeline only the specific service-level admin roles (roles/compute.admin, roles/cloudsql.admin, roles/secretmanager.admin) it needs for the project, and to deny billing and IAM organization-level roles through IAM Conditions or Deny Policies.

    💡 Exam Trap: Access Approval and Access Transparency are different products. Access Transparency produces audit logs of Google administrative access after the fact. Access Approval requires customer approval before that access occurs. A scenario that says "the customer must approve before Google support touches data" calls for Access Approval; "the customer needs a record of when Google support touched data" calls for Access Transparency.

    ⚠️ Anti-Pattern: Using a single Organization Administrator account held by one person. If that person is unavailable during an incident or leaves the company, recovery requires Google Cloud customer support engagement. The correct pattern is at least two break-glass accounts held by separate executives, plus mandatory periodic rotation drills.

    🎯 Scenario: A financial services architect must demonstrate to an internal auditor that no production database engineer can both alter the production schema and delete the corresponding audit logs. The design grants the database engineering group roles/cloudsql.admin on the production data project, grants a separate security operations group roles/logging.admin on the dedicated logging sink project, and routes Cloud SQL admin activity logs into an aggregated sink that the data engineering group cannot read or modify. The auditor's "who can erase evidence" test passes.

    Decision Anchor: Choose IAM role partitioning at the project level when the workload is small and well-scoped. Choose Organization Policy constraints plus IAM Deny Policies at the folder level when the partition must apply uniformly across many projects and the constraint must survive future project creation.

    Security controls (e.g., auditing, VPC Service Controls, context aware access, organization policy, and hierarchical firewall policy)

    Security controls in Google Cloud form a defense-in-depth stack.

    • At the top, Organization Policy constrains what can be built.
    • Just below, IAM (with conditions) constrains who can build it.
    • Below that, VPC Service Controls and context-aware access constrain where and from what device the API call can originate.
    • At the network layer, hierarchical firewall policies and Cloud Next Generation Firewall constrain network traffic.
    • Throughout, Cloud Audit Logs and Cloud Logging produce the evidence trail. No single control suffices; the architect composes them.

    Cloud Audit Logs has four streams.

    • Admin Activity logs record administrative actions and are always on and free of charge.
    • Data Access logs record read access (and, by configuration, write access) to user data and are off by default for most services because of volume; the architect must explicitly enable them per service.
    • System Event logs record Google-initiated administrative actions.
    • Policy Denied logs record API requests denied by VPC Service Controls or by Cloud IAM Conditions, and are off by default; turning them on is part of a defensible VPC Service Controls implementation. All four streams flow through Cloud Logging and can be routed to Cloud Storage, BigQuery, Pub/Sub, or external SIEMs through aggregated sinks at the organization level.

    VPC Service Controls (VPC-SC) is a data exfiltration control plane that draws a virtual perimeter around supported Google Cloud services. Inside a perimeter, an API call to a protected service (such as BigQuery, Cloud Storage, Vertex AI, Cloud KMS) is allowed only if the caller, the resource, and the network all sit inside the perimeter, or if explicit ingress and egress rules permit the cross-perimeter call. Crucially, VPC-SC operates at the service control plane, not at the network layer; it prevents a compromised internal identity from copying data to a Cloud Storage bucket in an attacker-controlled project even when IAM would have allowed the operation. Access Context Manager defines the access levels (such as "from corporate IP range and corporate device") that the perimeter's ingress rules can reference.

    Context-aware access combines Access Context Manager access levels with IAM Conditions and with Identity-Aware Proxy. An access level is a named condition over request attributes:

    • source IP range
    • source region or country
    • device policy (corporate-managed, OS version, screen lock, encryption status)
    • user identity attributes

    IAM Conditions reference the access level in the binding (request.auth.access_levels). IAP, when fronting a Compute Engine, GKE, or App Engine workload, enforces the access level on the HTTPS request before the request reaches the backend. The composition produces "this group can call this API from this device on this network at this time," with audit evidence on every grant.

    Organization Policy is the preventive control plane. It expresses constraints that the resource manager evaluates at create-or-update time. Constraints fall into two families.

    • List constraints enumerate allowed or denied values for an attribute (such as allowed locations for Cloud Storage buckets, allowed VM external IP usage).
    • Boolean constraints flip a feature on or off (such as iam.disableServiceAccountKeyCreation, compute.requireOsLogin, sql.restrictPublicIp).

    Custom constraints let the architect express constraints not in the predefined catalog, using CEL expressions over resource attributes. Constraints inherit down the hierarchy and can be overridden at lower levels only when the constraint policy allows override.

    Hierarchical firewall policy and Cloud Next Generation Firewall provide network-layer control with hierarchy inheritance. A hierarchical firewall policy attaches to the organization or to a folder and contains a list of ordered rules with actions ALLOW, DENY, GOTO_NEXT, or APPLY_SECURITY_PROFILE_GROUP. The GOTO_NEXT action passes evaluation to the next policy in the hierarchy, which is how higher policies set guardrails that lower policies refine. Cloud Next Generation Firewall adds layer-7 inspection through:

    • firewall endpoints
    • FQDN-based rules
    • geo-based rules
    • threat intelligence-based rules
    # Hierarchical firewall policy attached to folders/bu-payments/prod
    # Denies egress to non-Google-Cloud IP space except a small allowlist
    rules:
     - priority: 100
     direction: EGRESS
     match:
     destIpRanges: ["199.36.153.8/30"] # private.googleapis.com
     action: ALLOW
     description: Allow Private Google Access for protected workloads
     - priority: 200
     direction: EGRESS
     match:
     destFqdns: ["pci-clearing.example.com"]
     action: ALLOW
     description: Allow PCI clearing house
     - priority: 1000
     direction: EGRESS
     match:
     destIpRanges: ["0.0.0.0/0"]
     action: DENY
     description: Default deny to public internet
     - priority: 65534
     direction: INGRESS
     match:
     srcIpRanges: ["10.0.0.0/8"]
     action: GOTO_NEXT
     description: Defer corporate-range traffic to project-level firewall
    

    💡 Exam Trap: A common scenario asks how to prevent a data exfiltration where a user with roles/storage.objectViewer on a sensitive bucket downloads the data and uploads it to a personal Cloud Storage bucket. IAM cannot solve this; the user has the read permission by design. VPC Service Controls is the right answer because it blocks the cross-perimeter upload at the service control plane.

    💡 Exam Trap: Organization Policy constraints are evaluated at resource create or update time. They do not remediate existing non-compliant resources. A scenario that asks "how do we make all existing buckets compliant" calls for an inventory sweep through Cloud Asset Inventory plus a remediation workflow; Organization Policy only prevents new violations.

    ⚠️ Anti-Pattern: Treating VPC-SC and IAM as redundant. They protect against different threats. IAM prevents an unauthorized principal from making a call. VPC-SC prevents an authorized principal from making a call from outside the perimeter or to an out-of-perimeter destination. Removing one because the other exists creates an exposure that audit will find.

    📊 Limit: A VPC Service Controls policy supports up to 100 regular service perimeters per organization and up to 500 access levels per access policy. A single perimeter can contain up to 1000 projects.

    Decision Anchor: Choose IAM Conditions when the access decision depends only on attributes the IAM engine evaluates (time, access level reference) and the call is service-by-service. Choose VPC Service Controls when the decision is "this data must not leave this set of projects regardless of IAM," and accept the operational complexity of perimeter ingress and egress rules.

    Managing customer-managed encryption keys with Cloud Key Management Service (Cloud KMS)

    Cloud KMS is the managed service that lets the customer hold and operate the KEKs that wrap data in CMEK-supported services. A KMS resource hierarchy has three levels:

    • The key ring (a regional or multi-regional container)
    • The key (a named cryptographic key with a purpose such as ENCRYPT_DECRYPT, ASYMMETRIC_SIGN, ASYMMETRIC_DECRYPT, or MAC)
    • The key version (the actual cryptographic material)

    A key has a primary version that is used for encryption; older versions remain available for decryption until they are destroyed.

    Key locations match the data they protect. A CMEK key used to encrypt a regional Cloud Storage bucket in europe-west4 must live in europe-west4 or be a multi-regional key for the matching multi-region. A CMEK key used to encrypt a BigQuery dataset in EU must live in EU. Cross-region usage is forbidden by the service to preserve the regional locality guarantee. The architect's location strategy is the first KMS design decision, and it follows the workload's regulatory and latency constraints.

    Protection levels offer four choices.

    • SOFTWARE keys are stored in Google's software-backed key store.
    • HSM keys are stored in FIPS 140-2 Level 3 certified hardware security modules.
    • EXTERNAL keys reference key material in a partner key manager through Cloud EKM via the internet.
    • EXTERNAL_VPC keys reference key material in a partner key manager reachable through a VPC, removing the public internet from the path.

    Higher protection levels carry higher per-operation cost and higher latency; the choice is regulator-driven.

    Key rotation is the lifecycle event that keeps the cryptographic posture defensible.

    Cloud KMS supports automatic rotation on a configurable schedule (default 90 days, minimum 1 day, maximum 100 years) for symmetric ENCRYPT_DECRYPT keys.

    Rotation creates a new primary version; old versions remain available for decryption of data wrapped under them.

    Manual rotation is available for asymmetric keys and for keys the architect wants to rotate on demand.

    Rotation does not re-encrypt existing data; that re-encryption is triggered separately by the service that holds the data:

    • for Cloud Storage, a bucket-level "rewrite" operation
    • for BigQuery, an explicit copy of the table
    • for Compute Engine persistent disks, a disk snapshot and restore
    # Create a key ring, then a CMEK key with HSM protection and 90-day rotation
    gcloud kms keyrings create payments-kr \
     --location=europe-west4 \
     --project=acme-payments-pci-prod
    
    gcloud kms keys create payments-bq-kek \
     --location=europe-west4 \
     --keyring=payments-kr \
     --purpose=encryption \
     --protection-level=hsm \
     --rotation-period=90d \
     --next-rotation-time="$(date -u -d '+90 days' '+%Y-%m-%dT%H:%M:%SZ')" \
     --project=acme-payments-pci-prod
    
    # Grant the BigQuery service account on the project the right to use the key
    gcloud kms keys add-iam-policy-binding payments-bq-kek \
     --location=europe-west4 \
     --keyring=payments-kr \
     --member="serviceAccount:bq-$(gcloud projects describe acme-payments-pci-prod --format='value(projectNumber)')@bigquery-encryption.iam.gserviceaccount.com" \
     --role="roles/cloudkms.cryptoKeyEncrypterDecrypter" \
     --project=acme-payments-pci-prod
    

    Key destruction is asynchronous and reversible by default. Scheduling a key version for destruction puts it in the DESTROY_SCHEDULED state for a default duration of 24 hours (configurable per key from 24 hours to 120 days); during that window the version can be restored. After the duration elapses, the version moves to DESTROYED and the material is unrecoverable. Workloads that wrapped data under the destroyed version lose access to the data permanently, which is the desired outcome for cryptographic erasure but a catastrophic outcome if applied to the wrong key. Key destruction is best gated by IAM Deny Policies, Access Approval where appropriate, and an immutable retention review.

    CMEK-supported services include:

    • Cloud Storage
    • BigQuery
    • Cloud SQL
    • Spanner
    • AlloyDB
    • Bigtable
    • Firestore
    • Persistent Disk
    • Hyperdisk
    • Cloud Logging buckets
    • Secret Manager
    • Pub/Sub
    • Dataflow
    • Composer
    • Vertex AI models and datasets
    • and many more.

    The list grows over time; the architect's design check is "does the CMEK-supported service list include every data store this workload uses." A workload that uses a service without CMEK support cannot meet a "customer-controlled key" regulatory requirement on that service's data, regardless of how the rest of the architecture is built.

    Cloud HSM and Cloud EKM extend the model. Cloud HSM is the HSM protection level above, and it is the right default for any production CMEK key. Cloud EKM with EXTERNAL or EXTERNAL_VPC protection lets the customer hold the key material in a partner system; the trade-off is the partner's availability and latency, since Cloud EKM calls the partner for each wrap and unwrap. A failed partner availability call breaks the workload's read and write path, and that risk must be reflected in the service-level objective.

    💡 Exam Trap: Asymmetric keys (ASYMMETRIC_SIGN, ASYMMETRIC_DECRYPT) do not support automatic rotation. The architect must script a periodic rotation that creates a new key version and re-distributes the public key to verifiers, then schedule destruction of the old version once verifier traffic has drained.

    💡 Exam Trap: Granting roles/cloudkms.admin does not grant the right to use a key for encryption or decryption. The encrypter/decrypter operation requires roles/cloudkms.cryptoKeyEncrypterDecrypter (or one of the asymmetric variants). The separation is the heart of the KMS separation-of-duties pattern; do not collapse the two roles onto the same principal.

    ⚠️ Anti-Pattern: Setting a key destruction scheduled duration to 24 hours and relying on monitoring alerts to catch an erroneous destruction. A misclick at 18:00 on a Friday produces an irreversible data loss before the on-call rotation reviews the alert. Production keys use the maximum scheduled duration (120 days) and gate destruction through Access Approval or an IAM Deny Policy.

    📊 Limit: A Cloud KMS key supports up to 100,000 versions per key (active plus destroyed). Symmetric keys produce a new version per rotation event; an annual production key under monthly rotation produces 12 versions per year, which is well under the limit.

    Decision Anchor: Choose Cloud KMS with SOFTWARE protection when the regulator accepts software-backed keys and cost is a constraint. Choose Cloud KMS with HSM protection when the regulator requires FIPS 140-2 Level 3. Choose Cloud EKM when the regulator requires the key material outside Google.

    Secure remote access (e.g., Identity-Aware Proxy, service account impersonation, Chrome Enterprise Premium, and Workload Identity Federation)

    Secure remote access is the discipline of getting humans and external workloads into the Google Cloud estate without VPNs that grant flat network access, without downloaded service account keys, and without trusting the source network alone.

    Google Cloud's BeyondCorp design pattern centers on identity and context as the perimeter, with the network as a secondary signal.

    Identity-Aware Proxy (IAP) puts an authenticating reverse proxy in front of HTTPS workloads (Compute Engine instances behind a load balancer, GKE backends, App Engine, Cloud Run with the IAP integration) and in front of TCP-based admin services (SSH to Compute Engine, RDP, database ports).

    For HTTPS, IAP terminates the user request, authenticates the user against Cloud Identity or an external IdP via OIDC, evaluates IAM with the optional access level, and forwards an authenticated request to the backend with a signed header carrying the user's identity.

    For TCP, IAP TCP forwarding tunnels the connection over an authenticated WebSocket, producing zero exposure of the underlying port to the internet. The backend has no public IP; the entry point is IAP.

    # Enable IAP TCP forwarding to SSH into a Compute Engine VM with no public IP
    gcloud compute ssh acme-bastion-001 \
     --zone=europe-west4-a \
     --tunnel-through-iap \
     --project=acme-shared-bastion-prj
    
    # Grant a group access to SSH through IAP on the bastion
    gcloud projects add-iam-policy-binding acme-shared-bastion-prj \
     --member="group:gcp-prod-ops@acme-corp.example" \
     --role="roles/iap.tunnelResourceAccessor" \
     --condition='expression=request.time < timestamp("2099-12-31T23:59:59Z") && "accessPolicies/123/accessLevels/corp_device" in request.auth.access_levels,title=corp_device_only'
    

    Service account impersonation is the keyless pattern for granting humans (or other service accounts) the ability to perform an action under a workload identity, without ever holding the workload's credentials. The principal holds roles/iam.serviceAccountTokenCreator on the target service account and calls the generateAccessToken API to mint a short-lived token.

    The token carries the service account's permissions, not the principal's, for the duration. The pattern produces an audit trail that records both who impersonated (the principal) and what action was taken (under the service account), which is the basis for separation-of-duties evidence.

    Service account impersonation replaces downloaded service account keys for almost every interactive use case.

    Chrome Enterprise Premium is the BeyondCorp Enterprise productization that combines Chrome browser policies, device state attestation, and IAP-driven access into a managed access experience. The browser reports device posture (OS, encryption, screen lock, patch level, managed status), which feeds an Access Context Manager access level.

    IAP then enforces "only from a Chrome Enterprise Premium managed device" for high-value applications, including SaaS apps fronted by IAP for on-prem and partner-managed identity providers. The architect uses Chrome Enterprise Premium when the goal is a corporate desktop-style trust model without a VPN.

    Workload Identity Federation lets external identities (AWS, Azure, on-prem OIDC providers, GitHub Actions, GitLab CI, CircleCI, Terraform Cloud) call Google Cloud APIs without a downloaded service account key. The architect creates a workload identity pool, configures one or more providers that establish trust with the external IdP (verifying the issuer and the audience), and then maps external identities to Google Cloud principals through attribute conditions.

    The external identity authenticates to its own IdP, presents the resulting token to the federation endpoint, and exchanges it for a short-lived Google Cloud access token. The pattern eliminates the most common credential leak in IT, which is a service account key checked into a code repository.

    # Workload Identity Federation: trust GitHub Actions in acme-corp/payments
    # Create the pool and the OIDC provider
    workloadIdentityPool: gh-actions-pool
    provider:
     id: github-provider
     oidc:
     issuerUri: https://token.actions.githubusercontent.com
     allowedAudiences:
     - https://github.com/acme-corp
     attributeMapping:
     google.subject: assertion.sub
     attribute.repository: assertion.repository
     attribute.ref: assertion.ref
     attributeCondition: |
     attribute.repository == "acme-corp/payments" &&
     attribute.ref == "refs/heads/main"
    
    # Bind the external identity to a deployer service account
    member: principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/gh-actions-pool/attribute.repository/acme-corp/payments
    role: roles/iam.workloadIdentityUser
    on: payments-deployer@acme-payments-pci-prod.iam.gserviceaccount.com
    

    The remote access stack composes.

    A Cloud Identity user authenticates through a SAML or OIDC IdP, lands on a context-aware portal, and from there can reach the bastion through IAP TCP forwarding under an access level that requires a managed Chrome device.

    From the bastion, the user impersonates a service account to perform an administrative action against a Cloud SQL instance, with VPC Service Controls confirming that the call originates inside the perimeter. Every step produces audit evidence. There is no flat VPN tunnel and no downloaded key.

    💡 Exam Trap: IAP is for HTTPS and TCP forwarding (SSH, RDP, database admin). It does not front UDP traffic and it does not protect raw IP connections to non-load-balanced VMs. If a scenario asks about securing UDP-based protocols, the answer is a different pattern (such as a hardened bastion accessed through IAP TCP, plus controlled outbound traffic).

    💡 Exam Trap: Workload Identity Federation and GKE Workload Identity are different products. Workload Identity Federation maps external IdP identities to service accounts. GKE Workload Identity maps Kubernetes service accounts inside a GKE cluster to Google Cloud service accounts. A scenario about authenticating GitHub Actions to Google Cloud calls for Workload Identity Federation; a scenario about a pod calling BigQuery calls for GKE Workload Identity.

    ⚠️ Anti-Pattern: Allowing the legacy GCE metadata server's default service account to be the source of credentials for workloads inside a GKE pod. The pod inherits node-level permissions that span the cluster. The fix is to disable the default service account (--no-service-account at VM create, or node pool --service-account and --scopes=cloud-platform combined with GKE Workload Identity bindings per pod) and to grant per-workload service accounts.

    🎯 Scenario: A SaaS company runs its CI/CD on GitHub Actions and must deploy to Google Cloud without storing service account keys in GitHub secrets. The architect creates a Workload Identity Pool, configures the GitHub OIDC provider with attributeCondition constraining the repository and the branch, and grants the external principal roles/iam.workloadIdentityUser on a per-environment deployer service account. The GitHub Actions workflow runs gcloud auth login --cred-file= against a federation config and the deployment proceeds with no long-lived secret on either side.

    Decision Anchor: Choose IAP TCP forwarding when humans need administrative shell or database access and the network must remain closed to the public internet. Choose Workload Identity Federation when external systems need to call Google Cloud APIs without holding a long-lived key. Combine both behind Cloud Identity and an access level when the workload is high-value.

    Securing software supply chain

    Software supply chain security is the discipline of producing trust evidence at every stage from source code to runtime, then refusing to run artifacts that lack that evidence. The Software Delivery Shield product family bundles the Google Cloud services that produce the evidence: Cloud Source Repositories or external Git, Cloud Build, Artifact Registry, Artifact Analysis, Binary Authorization, and the Assured Open Source Software service.

    The architect's design uses each one for a specific link in the chain.

    Source integrity starts with the Git host. Whether the repository is in Cloud Source Repositories, GitHub, or GitLab, the architect enforces signed commits, mandatory pull-request review, branch protection on main, and a CODEOWNERS policy that maps directories to required reviewers.

    Cloud Build supports signed commit verification through provider triggers that fail if the commit is not signed. The repository becomes the first link of evidence: every change to the codebase carries an identity and an approver.

    Build integrity is Cloud Build's domain. A Cloud Build trigger fires on a Git event, runs the build inside a Google-managed worker (or a customer-managed private pool for VPC-bound source access), and produces an image plus the SLSA build provenance attestation.

    The attestation records the source repository, the commit SHA, the build configuration, the build steps, and the resulting digest, signed by Cloud Build. The architect treats the attestation as the receipt that the artifact was built by an authorized pipeline from authorized source, not by a developer's laptop.

    Cloud Build supports SLSA level 3 builds for container images built in private pools.

    Artifact Registry stores the produced images and other artifacts (Maven, npm, Python, Helm charts, Go modules, OS packages).

    Registry repositories carry IAM, CMEK encryption, location pinning, and remote and virtual repository types.

    Artifact Analysis (the successor to Container Analysis) scans every container image on push and on a recurring schedule for known vulnerabilities sourced from OS vendor advisories, Google's vulnerability database, and language-specific databases.

    Findings appear as Grafeas occurrences and feed Cloud Security Command Center and Binary Authorization.

    In practice

    Binary Authorization is the deploy-time gate.

    A Binary Authorization policy binds to GKE clusters, Cloud Run services, Cloud Run jobs, and Anthos Service Mesh; it requires that every image deployed to those workloads carries one or more named attestations signed by named attestor keys. A typical policy requires three attestations:

    • one from Cloud Build (proving provenance)
    • one from the vulnerability scanner (proving no critical vulnerabilities)
    • one from a human approver (proving review)

    Images without all three attestations are blocked at admission. The policy supports break-glass exemptions logged to Cloud Audit Logs.

    # Binary Authorization policy: require Cloud Build, vuln-scan, and approver attestations
    defaultAdmissionRule:
     evaluationMode: REQUIRE_ATTESTATION
     enforcementMode: ENFORCED_BLOCK_AND_AUDIT_LOG
     requireAttestationsBy:
     - projects/acme-secops-prj/attestors/built-by-cloud-build
     - projects/acme-secops-prj/attestors/passed-vuln-scan
     - projects/acme-secops-prj/attestors/approved-by-secops
    clusterAdmissionRules:
     europe-west4.acme-payments-pci-gke:
     evaluationMode: REQUIRE_ATTESTATION
     enforcementMode: ENFORCED_BLOCK_AND_AUDIT_LOG
     requireAttestationsBy:
     - projects/acme-secops-prj/attestors/built-by-cloud-build
     - projects/acme-secops-prj/attestors/passed-vuln-scan
     - projects/acme-secops-prj/attestors/approved-by-secops
    admissionWhitelistPatterns:
     - namePattern: gcr.io/cloud-builders/*
    

    Assured Open Source Software provides Google-curated, signed, and vulnerability-scanned versions of common open source packages (Java and Python ecosystems).

    When a workload depends on a transitive library with a critical vulnerability, the customer can swap the registry source to the Assured OSS feed without changing the dependency declaration, and the build then pulls the Google-vetted artifact.

    Combined with the Software Delivery Shield insights dashboard, the customer gets a continuous view of supply chain risk from source to runtime. Runtime supply chain integrity continues in the workload.

    • GKE Sandbox (gVisor) isolates untrusted container workloads.
    • GKE Confidential nodes encrypt VM memory under a hardware key.
    • Cloud Run supports binary authorization at admission and Confidential Cloud Run for hardware-isolated memory.
    • Cloud Asset Inventory plus Security Command Center then continuously inventory the running images and flag drift between what was attested and what is running.

    💡 Exam Trap: Binary Authorization in DRYRUN_AUDIT_LOG_ONLY mode does not block non-compliant deployments; it only writes audit log entries. A scenario that says "the deployment of an unattested image succeeded but produced an audit log entry" is describing dry-run mode. Production policies use ENFORCED_BLOCK_AND_AUDIT_LOG.

    💡 Exam Trap: Artifact Analysis vulnerability scanning is included for container images in Artifact Registry. Scanning for non-container artifact types (Maven, npm, Python, Go) is part of the broader Artifact Analysis offering and is billed separately when enabled. If a scenario asks about scanning a Java JAR, the answer is Artifact Analysis for Maven, not Container Analysis.

    ⚠️ Anti-Pattern: Treating image vulnerability scanning as a one-time event at build. A vulnerability disclosed after the image is built but before it is replaced still affects every running pod. Continuous on-push and scheduled scanning, with alerts that trigger an automated rebuild via the build pipeline, is the operating pattern.

    📊 Limit: Binary Authorization supports up to 100 attestors per project and up to 250 admission rules per policy. A typical production policy uses 3-5 attestors per cluster and a small number of cluster-level overrides.

    Decision Anchor: Choose Binary Authorization in ENFORCED_BLOCK_AND_AUDIT_LOG mode for production GKE and Cloud Run workloads where any unattested image must be refused. Choose DRYRUN_AUDIT_LOG_ONLY mode only as an interim step during initial rollout, with a defined timeline to enforcement.

    Securing AI (e.g., Model Armor, Sensitive Data Protection, and secure model deployment)

    Securing AI workloads on Google Cloud is a superset of securing data workloads, because AI workloads consume data, produce data, and expose new attack surfaces in prompts, model outputs, and model weights. The architect's design covers three layers:

    • The input layer (prompts and grounding data)
    • The model layer (the deployed model and its endpoint)
    • The output layer (the generated content and any downstream actions)

    Model Armor is a managed prompt and response protection service for generative AI workloads. It sits in front of a model endpoint (Vertex AI, third-party, or self-hosted) and screens inputs and outputs against configurable security policies:

    • prompt injection detection
    • jailbreak detection
    • malicious URL detection
    • PII detection
    • sensitive data detection
    • customer-defined deny lists

    A Model Armor template attaches to an endpoint or to an application via the Model Armor API; the application calls Model Armor with the prompt, gets a verdict, and proceeds only if the verdict is "safe." Templates support different policies per environment, which means staging prompts can use a permissive policy while production uses strict policy.

    Sensitive Data Protection plays a dual role in AI security. On the input side, it inspects and redacts PII from prompts before they reach the model, which prevents customer-supplied PII from being logged in model usage history or used as grounding input that subsequently leaks.

    On the grounding side, it inspects and de-identifies the corpora the model retrieves from (Vertex AI Search indexes, Cloud Storage buckets used as RAG sources), which makes the model unable to leak PII it never saw. The de-identification can be format-preserving (so a tokenized credit-card-shaped string still passes downstream validators) or destructive (full redaction).

    Secure model deployment on Vertex AI has several layers.

    The model artifact itself sits in a Cloud Storage bucket or in Vertex AI Model Registry, encrypted with CMEK and access-controlled with IAM.

    The Vertex AI endpoint is created in a specific region and project, with private endpoint configuration that places the endpoint inside a customer VPC through Private Service Connect; the model is not reachable from the public internet.

    The endpoint sits inside a VPC Service Controls perimeter so that prompts and responses cannot be exfiltrated cross-perimeter.

    The serving service account is least-privileged: it has roles/aiplatform.user on the endpoint and no permissions on data outside the endpoint.

    The model deployment policy refuses image deployment without attestations from Binary Authorization, applied to the Vertex AI custom container path.

    # Vertex AI: deploy a model to a private endpoint with CMEK and PSC
    from google.cloud import aiplatform
    
    aiplatform.init(
     project="acme-ai-prod",
     location="europe-west4",
     encryption_spec_key_name=(
     "projects/acme-ai-prod/locations/europe-west4/"
     "keyRings/ai-kr/cryptoKeys/vertex-kek"
     ),
    )
    
    endpoint = aiplatform.PrivateEndpoint.create(
     display_name="acme-claims-classifier-private",
     network="projects/acme-net-host-prj/global/networks/acme-prod-vpc",
     encryption_spec_key_name=(
     "projects/acme-ai-prod/locations/europe-west4/"
     "keyRings/ai-kr/cryptoKeys/vertex-kek"
     ),
     enable_private_service_connect=True,
     project_allowlist=["acme-ai-prod", "acme-claims-app-prod"],
    )
    
    model = aiplatform.Model.upload(
     display_name="claims-classifier-v3",
     artifact_uri="gs://acme-ai-prod-models/claims-classifier/v3/",
     serving_container_image_uri=(
     "europe-west4-docker.pkg.dev/acme-ai-prod/models/"
     "claims-classifier:v3@sha256:abc123..."
     ),
    )
    
    endpoint.deploy(
     model=model,
     machine_type="n1-standard-8",
     service_account="claims-classifier-sa@acme-ai-prod.iam.gserviceaccount.com",
     min_replica_count=2,
     max_replica_count=10,
    )
    

    Data exfiltration through the model is a distinct threat. A user with legitimate access to a model that has been fine-tuned on sensitive training data can, in some cases, extract training data through cleverly crafted prompts. The mitigations are layered:

    • de-identify training data with Sensitive Data Protection before fine-tuning;
    • apply differential privacy where the framework supports it;
    • constrain the model's output through Model Armor response policies that block patterns matching sensitive identifiers;
    • log every prompt and response to a CMEK-encrypted Cloud Logging bucket for post-hoc forensic review;
    • audit fine-tuning jobs to confirm that the training set is the de-identified copy.

    Agent and tool-using AI introduces a new attack surface where the model can issue actions against backend systems. The architect's pattern requires that the agent's tool-calling identity be a least-privileged service account separate from the agent itself; the agent calls a controller that authenticates the agent and authorizes the proposed action against an allow list of operations. Vertex AI Agent Builder supports this pattern through Agent-managed credentials and explicit tool definitions; the architect refuses any pattern in which the agent holds long-lived credentials to backend systems.

    Model supply chain integrity is the AI corollary of software supply chain integrity. Open-source model weights downloaded from a public hub can carry malicious payloads in pickle files or in custom layers. The Vertex AI Model Garden pattern provides Google-curated and signed model artifacts; the architect prefers Model Garden sources over arbitrary public hubs for production.

    When a public model is required, the artifact is:

    • downloaded into a Cloud Storage staging bucket inside the perimeter,
    • scanned with the model file format validator,
    • re-uploaded to Vertex AI Model Registry under CMEK before deployment.

    💡 Exam Trap: Vertex AI online prediction endpoints support both PublicEndpoint and PrivateEndpoint modes. A PublicEndpoint is reachable from the public internet by default and protected only by IAM; a PrivateEndpoint is reachable only through Private Service Connect from approved VPCs. A high-regulation scenario calls for PrivateEndpoint; using PublicEndpoint with IAM alone is not equivalent.

    💡 Exam Trap: Sensitive Data Protection (the Cloud DLP product family) is licensed and billed per inspected byte or per profiled storage. Treating it as a free, always-on layer in front of every API call produces a cost surprise. The architect designs the deployment so that Sensitive Data Protection runs once at ingest and once at egress, not on every internal call.

    ⚠️ Anti-Pattern: Fine-tuning a foundation model on raw production PII, then deploying the fine-tuned model to a public endpoint. Even with IAM in front, the model can leak training data through prompt-based extraction attacks. The de-identification step before fine-tuning is the control, and skipping it cannot be remedied by access controls alone.

    🎯 Scenario: An insurance company deploys a claims-classifier model that processes claim descriptions including policyholder names and policy numbers. The architect routes incoming claims through a Cloud Run service that calls Sensitive Data Protection to tokenize policyholder names and policy numbers, calls Model Armor to screen the prompt for injection and PII leakage, then calls the private Vertex AI endpoint. The response goes back through Model Armor to confirm no token leaks back. Every step writes to a CMEK-encrypted log bucket retained 7 years.

    Decision Anchor: Choose Model Armor when the architect needs runtime control over what prompts reach the model and what responses leave it. Choose Sensitive Data Protection when the goal is to remove sensitive content from the prompt or grounding data before it reaches the model.

    Composing the security controls

    The controls covered above are not independent products to deploy in parallel; they form a single composed posture. The architect's documentation maps each control to the threats it mitigates, the audit evidence it produces, and the dependencies it carries on other controls.

    Diagram: Layered security controls across the resource hierarchy


    Continue with the interactive course

    Track your progress, jump into practice questions and use the Shark AI tutor inside the GCP - Professional Cloud Architect learning hub.