What You'll Learn
- 1Split a compliance requirement between Google's controls and your own
- 2Name the agreement and technical control each major framework requires
- 3Design a deletion workflow that accounts for time travel and backups
- 4Produce auditor evidence from configuration rather than from screenshots
Shared Responsibility in Plain Terms
Compliance on a cloud platform is a split job, and every failed audit starts with someone assuming the other half was covered. Google certifies the infrastructure: the data centres, the network, the hypervisor, the physical controls, the encryption of data at rest, and the platform services themselves. You remain responsible for what you put in the platform, who can reach it, how it is configured, and whether your own processes match the policy you published. A FedRAMP authorised region does not make an application FedRAMP compliant, and a signed business agreement does not encrypt a table you exported to an unencrypted bucket.
The practical consequence for a data engineer is that most controls are configuration, not code. A dataset location, a customer managed encryption key, an IAM binding, an organization policy that forbids resource creation outside named regions, and an audit log sink into a bucket the application team cannot edit: each of these is a line of Terraform, each produces evidence automatically, and each fails loudly when it is removed. Controls that live in a wiki page rather than in the deployment have no enforcement and will be missing on the day the auditor arrives.
| Framework | What it governs | Trigger to care | Agreement with Google | Your main obligation |
|---|---|---|---|---|
| HIPAA | Health data, PHI in the US | Handling any PHI | Business Associate Agreement | Minimum necessary access and safeguards |
| GDPR | Personal data of EU residents | Any EU data subject | Data Processing Agreement | Lawful basis, minimisation, deletion |
| FedRAMP | US federal workloads | Selling to a federal agency | FedRAMP authorisation of the service | Use authorised services and inherit controls |
| SOC 2 | Your own service controls | Enterprise customers ask | Google's SOC 2 report supports yours | Your control narrative and evidence |
| PCI DSS | Cardholder data | Card data touches a system | Responsibility matrix | Segmentation, tokenisation, scans |
| CCPA | Consumer privacy in California | Collecting Californian consumer data | DPA where applicable | Opt-out handling and disclosure |
GCP Compliance Features You Actually Configure
compliance_checklist = {
"encryption": {
"at_rest": "CMEK for sensitive data",
"in_transit": "TLS 1.2+ (automatic)",
"key_rotation": "Automated via Cloud KMS"
},
"access_control": {
"iam": "Least privilege principle",
"vpc_sc": "VPC Service Controls for perimeter security",
"column_security": "Policy tags in BigQuery"
},
"audit_logging": {
"admin_activity": "Always enabled",
"data_access": "Enable for sensitive data",
"log_retention": "Store in separate project"
},
"data_residency": {
"single_region": "Data stays in specified region",
"dual_region": "Two specific regions",
"multi_region": "All regions in geographic area"
}
}
Read that dictionary as four separate controls with four separate owners. Encryption at rest is on by default with Google managed keys, and CMEK changes who holds the key rather than the algorithm, which matters when a regulator asks who can decrypt the data. Access control is enforced by IAM plus the perimeter services, and column level protection is a policy tag rather than a view, so the restriction follows the data into every tool. Audit logging is free for admin activity and chargeable for data access, which is exactly why the decision to enable it must be made for sensitive datasets before an incident rather than after.
GDPR From the Data Engineer's Chair
The regulation reads as principles but lands as a data flow diagram. Collect only what the stated purpose needs, keep it no longer than that purpose requires, and be able to answer when an individual asks what you hold and to delete it. The deletion handler below is deliberately narrow: it enumerates tables, deletes matching rows with a parameterised statement, and records the outcome.
from google.cloud import bigquery
def handle_deletion_request(project_id, dataset_id, user_id):
client = bigquery.Client(project=project_id)
deleted = []
for table in client.list_tables(f"{project_id}.{dataset_id}"):
ref = f"{project_id}.{dataset_id}.{table.table_id}"
query = f"DELETE FROM `{ref}` WHERE user_id = @uid"
job = client.query(
query,
job_config=bigquery.QueryJobConfig(
query_parameters=[bigquery.ScalarQueryParameter("uid", "STRING", user_id)]
),
)
job.result()
deleted.append(table.table_id)
log_deletion_request(user_id, dataset_id, deleted)
return deleted
Three facts make this harder than it looks. BigQuery keeps a time travel window of up to seven days, so a deleted row is still readable by anyone with a valid query during that period; an erasure request therefore means clearing or accepting the window explicitly and documenting which. Tables expire on a schedule, but partitions and long term backups follow their own retention, and Cloud Storage exports or BigQuery scheduled query results can outlive the source table. Finally, deletion is not always lawful: records you must retain for tax or contractual reasons fall under an exception, so the workflow ends with a decision recorded against the request rather than with an empty result set.
â¨
Best Practice: Implement defence in depth: CMEK for encryption, IAM least privilege plus VPC Service Controls for the perimeter, audit logging into a project the workload cannot edit, and policy tags for column level protection. Keep production and non-production in separate projects, and review the configuration quarterly rather than annually, because drift is what auditors find.
HIPAA: What the Agreement Does and Does Not Cover
The Business Associate Agreement is a contract covering a defined list of services, not a blanket blessing for the account. Once signed, it obliges Google to protect PHI on those services and to give you the audit material to demonstrate it, while your side must enforce access control, encryption where required, workforce training, and a risk assessment of the actual workload. A useful engineering test: if a service on the list is used and the data is PHI, the controls apply; if you move PHI into a service that is not covered, you have silently left the agreement's scope.
De-identification is the alternative that removes the obligation entirely, and there are two recognised routes. Safe Harbor requires removing eighteen categories of identifier plus no actual knowledge of re-identification, which is straightforward to implement with Cloud DLP transformations. Expert determination requires a statistician to conclude that the risk of re-identification is very small, which is stronger but needs a signed document on file. Both are preferable to trying to protect raw identifiers everywhere, and both are cheaper than the access reviews that raw PHI forces on every downstream team.
Residency, Sovereignty and Region Choices
Residency is decided once, at resource creation, and is expensive to change later. A Cloud Storage bucket keeps the region it was created in, and a BigQuery dataset location cannot be edited at all: moving a dataset between regions means exporting and re-importing it through a storage bucket, which for a petabyte scale warehouse is a project rather than a setting. Dual region buckets keep two replicas in one geography and survive the loss of a region, while multi region keeps copies across a wider area and trades residency granularity for availability.
Two controls make residency enforceable rather than aspirational. An organization policy constraint on resource locations rejects any request to create a resource outside the allowed list, so a developer cannot place a bucket in an unapproved country by accident. Assured Workloads goes further by pinning a project to a specific set of controls and separating the identities that may operate inside it, which is how regulated workloads demonstrate that the boundary was never crossed rather than merely documented.
Producing Evidence, Not Screenshots
An auditor accepts evidence that is generated continuously and stored where it cannot be rewritten. Audit log sinks writing into a storage bucket with retention or hold, in a project with separate ownership, satisfy the access and change questions for every service at once. INFORMATION_SCHEMA and the policy intelligence APIs provide the state of the configuration itself: which tables lack expiration, which buckets allow allUsers, which keys are past their rotation period. Terraform state plus the deployment pipeline shows when a control was introduced and who approved the change, which is usually the question behind the question.
The recurring failure is a control that exists only in one environment. If production is hardened and the staging project, which holds a copy of the same customer data, is not, the auditor will find it, because auditors sample the copy rather than the crown jewels. The same configuration module applied to every project with a per environment variable removes that entire class of finding.
Common Interview Questions
Q1: What are the key GDPR requirements for data engineering?
Answer: Data minimisation, purpose limitation, storage limitation, the rights of access, rectification and erasure, and accountability for all of it. In a warehouse that translates into collecting only the needed fields, an expiration policy on tables and partitions, a working deletion path that covers time travel and exports, and a record of the lawful basis for each dataset.
Q2: How does GCP help with HIPAA compliance?
Answer: Google signs a Business Associate Agreement covering the listed services and provides encryption at rest and in transit, audit logging and access control as platform features. The customer still owns the workload: minimum necessary access, a risk assessment, workforce controls, and the decision about whether data is de-identified instead.
Q3: What is VPC Service Controls for?
Answer: It draws a perimeter around service perimeters so that credentials exfiltrated from inside the project cannot reach the data from outside it, and it denies calls to restricted services from outside the perimeter. It is the control that turns a compromised application key from a breach into a blocked request with a policy denied log entry.
Q4: How do you implement data residency?
Answer: Choose the region or dual region at resource creation, refuse multi region resources for regulated data, apply an organization policy constraint on resource locations so nothing can be created elsewhere, and verify with an inventory report rather than by reading the console.
Q5: Encryption at rest versus in transit?
Answer: At rest covers data on disk and defaults to Google managed keys, with CMEK available when you must control rotation or destruction. In transit is TLS, automatic between Google services and required for external traffic. Regulators generally ask for both plus the key management policy that proves who can decrypt.
Interview Questions
Q1: Does signing a BAA make a workload HIPAA compliant?
No. The agreement covers Google's obligations on the listed services; the customer still needs access control, encryption decisions, workforce policies, a risk assessment and de-identification where identifiers are not needed.
Q2: Why can you not simply move a BigQuery dataset to another region?
A dataset location is immutable, so relocation means exporting to a bucket, creating a dataset in the target location and reloading, with all the downtime and cost that implies. Region choice is therefore an up-front design decision.
Q3: What does Safe Harbor de-identification remove?
Eighteen categories of identifier, from names and geographic subdivisions smaller than a state to device identifiers and any other unique code, plus no actual knowledge that the remaining data could identify someone.
Q4: Where should audit logs live so they count as evidence?
In a bucket or project with retention or a hold that the identities being monitored cannot modify, because evidence that the monitored party can delete does not demonstrate anything to an auditor.
Common Mistakes
Assuming platform certification covers the application
Fix: Map each requirement to a control you own and a control Google owns, then implement yours as configuration that produces its own evidence.
Treating a deletion request as one DELETE statement
Fix: Cover time travel of up to seven days, partitions, scheduled query results, Cloud Storage exports and backups, and record the decision when retention law overrides the request.
Hardening production while staging keeps a copy of the same data
Fix: Apply the same Terraform module to every project with only environment variables differing, so auditors sampling any project find the same controls.
Key Takeaways
- Compliance splits at the platform boundary: Google certifies the infrastructure, you own data, configuration, access and evidence
- Each framework maps to one agreement with Google plus a set of controls you implement as code, and the table above shows which
- GDPR deletion collides with BigQuery time travel, partitions and exports, so the workflow must address all of them and record the outcome
- Residency is fixed at creation and enforceable with location organization policies; evidence must be generated continuously into an immutable location