Loading...

Skip to main content

Architecture Patterns Reference

Pattern catalog for anonymization architectures β€” zone models, pipeline patterns, key management, and AI/LLM patterns. Restructured from Modules 06, 07, and 08 for quick lookup during architecture design and client recommendations.

Abbreviations used throughout: SDP = Sensitive Data Protection; HMAC = keyed-hash message authentication code; FPE = format-preserving encryption; DDM = dynamic data masking (BigQuery policy tags); ARX = open-source structural anonymization tool; MSISDN = subscriber phone number; CDR = Call Detail Record.

For per-zone techniques, see the techniques reference. For GCP tool configurations, see tooling. For operational monitoring of these architectures, see governance and ops.

Decision tree: which pattern do I need?​

For AI/LLM workloads, see the AI/LLM pattern selection flowchart below.


Zone model​

Three-zone model (default)​

ZoneContentAccessRetention
RawUnmodified source data, full PIIIngestion pipelines + break-glass onlyDays to weeks (reprocessing only)
PseudonymizedDirect IDs replaced (FPE, det. enc., HMAC); QIs at original granularityEngineers (full), analysts (DDM-masked), ML pipelinesMonths to years per classification
AnonymizedStructurally anonymized (k-anonymity) and/or DP aggregatesBroad β€” business users, partners, dashboards, externalYears or indefinite (outside GDPR if truly anonymous)

Four-zone extension​

Split the anonymized zone when data leaves the organization or record-level + aggregate outputs coexist:

ZoneContentAccessThreat model
Zone 2: Structurally anonymizedk-anonymous record-level dataInternal broad β€” analysts, BIBounded adversary (known QIs)
Zone 3: DP-guaranteedDP aggregates, DP-trained synthetic dataWidest β€” partners, regulators, monetizationUnbounded adversary (arbitrary auxiliary data). Non-DP synthetic data (e.g., SDV without DP-SGD) does not belong in Zone 3 β€” it requires separate memorization validation and does not provide formal guarantees against unbounded adversaries. For DP synthetic data, DPSynth provides marginal-based DP synthesis with an Apache Beam pipeline mode suitable for Dataflow-scale processing.

When to use 4 zones: Data leaves the organization, record-level + aggregate outputs have different consumers, multiple releases of overlapping data.

When to stay with 3: All anonymized data serves the same consumers, or only aggregate DP outputs are produced.

Critical detail: DP aggregation sources from Zone 1 (pseudonymized), NOT Zone 2 β€” DP needs full-granularity input data.

Zone model by vertical​

DimensionTelcoRetailFinancial servicesEnergy
Zone 0 retentionDays (ePrivacy)Days to weeksYears (AML mandates)Days (operational)
Zone 1 anchorMSISDNCanonical customer IDAccount numberMeter ID
Zone 1 techniqueHMAC; FPE if format neededDeterministic encryptionTokenization (PCI); HMACHMAC
Zone 2 approachk-anonymity (k β‰₯ 50)k-anonymity + sequence aggregationk-anonymity on summariesTemporal aggregation
Zone 3 useMobility analytics, monetizationMarketing, partner sharingRisk modeling, regulatoryGrid planning, forecasting

Pipeline patterns​

Streaming: anonymize at ingestion​

The default for greenfield platforms and real-time data. Source β†’ Pub/Sub β†’ Dataflow (streaming) with SDP per-record de-identification β†’ BigQuery Storage Write API (Zone 1). Reduces blast radius and simplifies access control β€” PII never lands in storage at original granularity. The tradeoff is reprocessing rigidity: if transform logic changes, you can't re-derive from stored data. Schema evolution and debugging are harder when the raw zone has short retention.

Batch pipeline​

For workloads where minutes-to-hours freshness is acceptable. Source (GCS / BigQuery / JDBC) β†’ Dataflow batch or Cloud Run β†’ SDP β†’ BigQuery load. Simpler architecture, cost-optimized (autoscale-to-zero), but higher latency. Most large-dataset anonymization uses this path.

Structural anonymization (batch-only)​

Produces Zone 2 outputs. Zone 1 β†’ ARX (Cloud Run job) β†’ Zone 2 for k-anonymity. Cannot run inline in streaming β€” structural anonymization requires the full dataset for equivalence class computation.

Produces Zone 3 outputs. Zone 1 β†’ Privacy on Beam (batch pipeline with budget tracking) or BigQuery DIFFERENTIAL_PRIVACY (SQL clause) β†’ Zone 3. BigQuery DP technically supports interactive queries, but materialized batch outputs are recommended for budget control β€” standalone DIFFERENTIAL_PRIVACY queries have no cumulative tracking across invocations. BigQuery Data Clean Rooms can enforce cumulative privacy budgets via analysis rules for controlled sharing scenarios.

Query-time masking (DDM)​

For different users needing different views of the same dataset within a zone, when data stays in BigQuery. Uses Knowledge Catalog taxonomy β†’ policy tags β†’ DDM masking rules β†’ IAM (fineGrainedReader / maskedReader). No separate copies, declarative, Terraform-manageable. Only works for BigQuery-routed queries β€” bypassed if data is exported or read directly by Spark/Trino. Masking is access control, NOT anonymization. Data crossing organizational boundaries needs pipeline transforms.

Late-arriving data strategies​

StrategyMechanismTradeoff
Append and regenerateLate records to pseudo zone; anon zone regenerated next batchSimple, eventually consistent
Micro-batch re-anonymizationRe-anonymize affected partition on arrivalBetter consistency, higher cost
Cutoff and dropRecords after threshold logged but not processedSimple but lossy
Separate late-arrival partitionAccumulate in staging, merge on scheduleBalanced

Key management patterns​

Transform selection​

TransformReversibilityKey architectureJoin compatibleBest for
RedactionNo (data destroyed)No keysN/AFields not needed downstream
HMACNo (one-way)Shared wrapped key in SDP templateYes (deterministic)Default for identifier pseudonymization
FPEYesDEKs required; per-subject DEKs if crypto-shredding (requires custom Tink β€” SDP templates take a single fixed key)Yes (deterministic)Legacy format compatibility
Deterministic encryption (AES-SIV)YesDEKs required; per-subject DEKs if crypto-shredding (requires custom Tink β€” SDP templates take a single fixed key)Yes (deterministic)Reversibility without format constraints

Cloud KMS configuration​

Cloud KMS
β”œβ”€β”€ Key ring: anonymization-keys (regional)
β”‚ β”œβ”€β”€ KEK: pseudonymization-master (HSM protection level)
β”‚ β”‚ β”œβ”€β”€ Version 2 (active for new pseudonymization)
β”‚ β”‚ └── Version 1 (retained for decryption of historical data)
β”‚ └── KEK: partner-export-key (HSM protection)
└── Wrapped DEKs (in pipeline config / Secret Manager)
β”œβ”€β”€ DEK for MSISDN FPE transform
└── DEK for IMSI deterministic encryption

Protection levels​

LevelKey material locationWhen to use
SOFTWAREGoogle software infrastructureDev, non-regulated workloads
HSMFIPS 140-2 Level 3 HSMsProduction default β€” protects against software infra breaches. One-line Terraform change.
EXTERNAL / EXTERNAL_VPCOn-premises or third-party HSM via Cloud EKMRegulations requiring provider inaccessibility (Swiss FADP + FINMA/SBA)

Key rotation​

KEK rotation β€” routine, non-disruptive. New version wraps new operations; old versions still unwrap existing DEKs. 90 days (CIS default) or per compliance policy. Never disable/destroy old versions that still wrap active DEKs.

DEK rotation β€” disruptive, changes pseudonyms:

TransformEffect of DEK rotationHandling
FPE / det. encryptionNew DEK β†’ different ciphertexts; pre/post records can't joinPin DEK for defined period. When rotating, re-encrypt entire pseudo zone in batch migration.
HMACNew key β†’ different hashes; irreversible, can't re-key existing"Pseudonym reset" β€” permanent continuity break. Use as deliberate lifecycle event only.

When to rotate DEK: Key compromise, personnel change in custodian role, end of data sharing agreement, legal hold release, major migration.

Vault architecture​

ArchitectureHow it worksThroughputWhen to use
Stateless (crypto-derived)Pseudonym computed from input + key; no lookup tableVery highDefault. FPE and det. enc. via SDP are stateless by design.
Stateful (lookup table)Random token in mapping tableLimited by DBPCI-DSS tokenization, cross-org sharing, audit-enumerable mappings

Crypto-shredding​

Two approaches for implementing GDPR right-to-erasure via key destruction:

DimensionApproach A: Same-table keysets (BigQuery AEAD)Approach B: Separate DEK table
Crypto-shreddingMulti-row update (NULL keyset column)Single-row delete
Architecture complexitySimpler β€” no separate storeMore complex β€” DEK table + coordinator
Re-identificationQuery-time AEAD.DECRYPT_* β€” pure SQLCompute-then-filter (lookup DEK β†’ compute β†’ filter β†’ decrypt)
Residual groupabilityNo grouping possible (AEAD is randomized)Deterministic pseudonyms remain groupable
Best forPrivacy advantage; simpler architectureAtomic erasure; deterministic pseudonyms needed for joins

DEK store options (Approach B):

StoreBest for
BigQueryMost engagements β€” same governance perimeter
FirestoreStrict physical key-data separation
BigtableVery high new-subject rates (ad-tech, IoT). Atomic CheckAndMutateRow.
Redis (Memorystore)Coordination layer in front of durable store

Coordinator for new subjects (race condition prevention):

ApproachBest for
Cloud Run + Firestore transactionsStable populations, low new-subject rate (telco)
Redis SETNXHigher new-subject rates (e-commerce). Sub-ms.
Batch pre-generationBatch-only ingestion

AI/LLM architecture patterns​

Impact on LLM workloads​

LLM taskAnonymization impactApproach
RAG retrievalHigh β€” placeholders disrupt embeddingsDetect-then-process with realistic substitutes
Prompt groundingModerate–high β€” placeholder tokens give LLM nothing to reason aboutPrompt-level data minimization
Agent tool callsLow–moderate β€” operates on column valuesStandard DDM / pipeline transforms
Conversational analyticsLow β€” LLM generates SQL; DDM masks resultsBigQuery Conversational Analytics
SummarizationLow–moderate β€” quality degrades only if context removedModel Armor or detect-then-process
Customer-facing generationHigh β€” placeholder tokens unacceptable in outputDetect-then-process with re-substitution

Six patterns (defense-in-depth stack)​

#PatternWhen to useGCP serviceKey limitation
1VPC-SC PerimeterAlways β€” baseline for all LLM workloads with sensitive dataVPC Service ControlsPrevents exfiltration but doesn't control what goes into prompts
2Prompt-level data minimizationAlways β€” defense in depthCloud Run/GKE application logicRequires per-task analysis of needed fields
3Detect-then-process pipeline (custom)RAG, semantic search, context-preserving pseudonymizationSDP + Presidio NER β†’ custom Beam β†’ Agent PlatformCustom pipeline code, substitution map management
4Model Armor (managed)Classification, summarization, tasks tolerant of standard SDP maskingModel Armor on Agent PlatformNo context-preserving pseudonymization (standard SDP transforms)
5Gemini Enterprise (enterprise search)AI assistant over organizational dataGemini Enterprise + DLP filteringNot an anonymization tool β€” indexes data as-is. Safety net only.
6BigQuery Conversational Analytics (DDM)Natural language queries over structured dataBigQuery Conversational AnalyticsPrivacy only as strong as IAM config

AI/LLM pattern selection​