The one-line mental model
Governance on AWS is a stack of controls that answer four questions about any byte in your lake: who owns it, who may read it, what it contains, and how you prove that after the fact.
Lake Formation answers access, Macie answers content, Config answers drift, and CloudTrail answers history. Miss one and an auditor will find it for you.
Prerequisites
- !S3 buckets, Glue Data Catalog and basic IAM roles
- !Comfort reading IAM and resource policies
What You'll Learn
- 1Explain why governance fails and what it costs
- 2Grant column-level and row-level access through Lake Formation
- 3Discover and classify PII with Macie findings and custom identifiers
- 4Encode compliance as Config rules with automated remediation
Why governance exists, and what it costs without it
A data lake without governance becomes a swamp within two quarters. Engineers copy tables nobody trusts, analysts build shadow spreadsheets on top of them, and security discovers sensitive data only when it leaks. The financial exposure is concrete: GDPR fines reach four percent of global annual revenue, HIPAA penalties scale per record, and PCI DSS assessments grow more expensive as cardholder data multiplies. Even without a regulator, the internal cost is real. A single misconfigured S3 bucket holding unencrypted customer records can trigger an incident response that consumes hundreds of engineering hours and dents customer trust in ways no quarterly report captures.
Governance turns that risk into an operational routine. Every asset gets a classification tag, every grant goes through a central broker rather than ad-hoc bucket policies, every configuration deviation triggers a Config rule, and every sensitive-content discovery lands in a finding you can automate against. The goal is not paperwork. The goal is that when someone asks who accessed a customer table last quarter, the answer takes minutes rather than a two-week investigation.
| Driver | What happens without it | The AWS control |
|---|---|---|
| Regulatory risk | Fines, forced shutdowns, legal exposure | Macie, Lake Formation, Audit Manager |
| Data trust | Analysts abandon the lake for spreadsheets | Glue catalog, quality checks |
| Security posture | Undetected PII in open buckets | Macie, GuardDuty, SCPs |
| Cost creep | Unclassified data never leaves Standard storage | S3 lifecycle on classified prefixes |
| Access sprawl | Former employees still hold SELECT rights | Lake Formation, quarterly reviews |
Lake Formation as the permission broker
AWS Lake Formation sits between consumers and the Glue Data Catalog, replacing raw S3 and IAM grants with a permission model that supports column-level, row-level, and tag-based access control, which AWS calls LF-TBAC. The architectural shift matters: users no longer need direct S3 permissions. They receive Lake Formation permissions on catalog objects, and Lake Formation brokers the underlying data-plane access on their behalf. This means a data steward can revoke access to one column of one table across five consuming roles without touching a single bucket policy, which is precisely the kind of control an auditor expects to see documented.
The workflow has four moving parts. You register the S3 location with a service role that Lake Formation assumes to read and write on your behalf. You create classification tags such as DataClassification and ComplianceScope. You grant permissions against catalog resources, optionally conditioned on those tags. And you audit the resulting grants on a schedule, because permission creep is the slow failure mode that no alert will catch.
import boto3
lf = boto3.client("lakeformation")
lf.create_lf_tag(TagKey="DataClassification", TagValues=["Public", "Internal", "Confidential", "Restricted"])
lf.register_resource(
ResourceArn="arn:aws:s3:::acme-data-lake/curated/",
RoleArn="arn:aws:iam::123456789012:role/LF-RegistrationRole",
UseServiceLinkedRole=False,
)
lf.grant_permissions(
Principal={"DataLakePrincipalIdentifier": "arn:aws:iam::123456789012:role/AnalystRole"},
Resource={
"TableWithColumnsResource": {
"DatabaseName": "analytics",
"TableName": "customer_orders",
"ColumnNames": ["order_id", "customer_name", "order_date", "amount"],
}
},
Permissions=["SELECT"],
GrantOption=False,
)
lf.grant_permissions(
Principal={"DataLakePrincipalIdentifier": "arn:aws:iam::123456789012:role/RegionalAnalyst"},
Resource={"TableResource": {"DatabaseName": "analytics", "TableName": "customer_orders"}},
Permissions=["SELECT", "DESCRIBE"],
Conditions=[
{
"StringEquals": {
"Expression": "lf:tag/Region",
"Values": ["us-east-1"],
}
}
],
)
grants = lf.list_permissions(Resource={"TableResource": {"DatabaseName": "analytics", "TableName": "customer_orders"}})
print(f"{len(grants.get('PrincipalResourcePermissions', []))} active grants on customer_orders")
Row-level filters work through data cell filters attached to a table, restricting which rows a principal sees based on column predicates rather than tags. Column-level grants hide sensitive fields such as national identifiers without removing the table from the catalog, so downstream dashboards continue to function while the restricted column simply does not resolve for unauthorized roles. Both features are the difference between a lake that can hold regulated data and one that merely stores files.
Macie: discovering what you did not know you had
Amazon Macie classifies S3 content using built-in machine learning detectors for personally identifiable information, financial instruments and credentials, plus custom data identifiers that encode your own patterns such as internal customer numbers. Macie does not read every byte of every object by default. You enable it per account, register the buckets worth scanning, and choose between scheduled jobs and one-time discovery runs. Findings are published to EventBridge, which is where the automation begins: a Lambda function can quarantine the offending object, attach a default encryption key, or open a ticket with the data owner.
The design pattern that works in production combines Macie with a classification job that samples high-value prefixes on a weekly cadence rather than scanning everything continuously. Full-population scans are expensive on large estates and unnecessary when the risk surface is concentrated in a handful of buckets. Custom data identifiers let you catch what built-in detectors miss, and an allowlist reduces false positives so the findings queue stays actionable instead of becoming noise engineers learn to ignore.
import boto3
macie = boto3.client("macie")
macie.create_custom_data_identifier(
name="acme-customer-id",
description="Internal customer identifier prefix",
regex="ACME-CUST-[0-9]{8}",
severityLevels=[{"score": 80, "severity": "HIGH"}],
)
macie.create_classification_job(
name="weekly-curated-scan",
jobType="SCHEDULED",
scheduleFrequency="WEEKLY",
s3JobDefinition={
"bucketDefinitions": [
{"accountId": "123456789012", "buckets": ["acme-data-lake-curated"]}
]
},
customDataIdentifierIds=["ACME-CUST-ID"],
)
findings = macie.get_findings_filter(id="pii-in-curated")
print(f"filter {findings['name']} excludes {len(findings.get('excludeFindings', []))} known-safe findings")
Treat Macie findings as events in your data pipeline, not as a dashboard someone checks quarterly. Wire the EventBridge rule to a Lambda that tags the offending prefix, notifies the owner, and records the incident in your ticketing system. That loop, detection to remediation to evidence, is what an assessor wants to walk through during a compliance review.
Config, drift and the three lines of defense
AWS Config continuously evaluates whether resources match rules you define, and the compliance rate across those rules is the single number executives understand immediately. A managed rule such as S3_BUCKET_SERVER_SIDE_ENCRYPTION_ENABLED catches buckets created without encryption the moment they appear. A custom Lambda-backed rule can enforce required tags such as DataClassification, DataOwner and RetentionPeriod on every new bucket, rejecting or auto-tagging based on your chosen response. CloudTrail provides the complementary audit trail of who called which API, and Audit Manager assembles both into evidence packs for specific frameworks.
The three lines of defense model keeps these controls organized. The first line is preventive: encryption defaults, SCPs that deny unencrypted S3 writes, network isolation, Lake Formation registration requirements. The second is detective: Config rules, CloudTrail monitoring, Macie scans, GuardDuty threat detection. The third is corrective: Lambda auto-remediation, Step Functions workflows that restore compliant state, and human review for ambiguous cases. A governance program that only invests in detection ends up with an endless backlog. One that only invests in prevention has no evidence when an audit arrives.
import boto3
config = boto3.client("config")
config.put_config_rule(
ConfigRule={
"ConfigRuleName": "data-classification-tag-required",
"Description": "All S3 buckets must carry DataClassification and DataOwner tags",
"Source": {
"Owner": "CUSTOM_LAMBDA",
"SourceIdentifier": "arn:aws:lambda:us-east-1:123456789012:function:tag-checker",
"SourceDetails": [
{
"EventSource": "aws.config",
"MessageType": "ConfigurationItemChangeNotification",
}
],
},
"Scope": {"ComplianceResourceTypes": ["AWS::S3::Bucket"]},
}
)
status = config.get_compliance_details_by_config_rule(
ConfigRuleName="s3-encryption-required",
ComplianceTypes=["NON_COMPLIANT"],
)
for item in status.get("EvaluationResults", []):
resource = item["EvaluationResultIdentifier"]["EvaluationResultQualifier"]["ResourceId"]
print(f"non-compliant: {resource}")
Compliance rate is compliant resources divided by total resources, and governance coverage is tagged resources divided by total resources. Both should trend upward quarter over quarter and both should appear on a QuickSight dashboard that data stewards review, because a metric nobody looks at is not a control.
Handling erasure requests without breaking the lake
The GDPR right to erasure collides with the data lake design principle of immutability, and resolving that collision is a common interview topic. The practical answer has five steps. First, use Macie and catalog metadata to locate every partition and table containing the subject's identifiers. Second, rewrite the affected files excluding those records, or anonymize the identifying columns in place if referential integrity across denormalized tables depends on the row existing. Third, update the Glue Data Catalog statistics so downstream query optimizers do not plan against stale row counts. Fourth, write an audit entry to CloudTrail documenting the erasure, the tables touched and the operator who requested it. Fifth, notify the requesting party through the channel their contract specifies.
For immutable columnar formats the rewrite step is the expensive one, and it is worth being honest about that in an interview: erasure in a Parquet lake is a batch operation, not a real-time delete, and your answer should include the expected latency so the business can set expectations correctly.
Cross-account sharing under governance
Multi-account data platforms need sharing that does not dissolve the governance boundary. Lake Formation cross-account grants let a producer account share specific tables with named principals in consumer accounts, and the consumer sees the table in their own catalog without any direct S3 policy changes. AWS Resource Access Manager distributes shared resources such as registered locations, and service control policies prevent accounts from granting outside approved organizational boundaries. CloudTrail should be enabled in both the producer and consumer accounts so the shared access produces a single coherent audit narrative. Encryption keys cross the boundary deliberately: the producer's KMS key is shared with the consumer account under an explicit key policy, and every decrypt under that key lands in the producer's CloudTrail, which is exactly the evidence trail an auditor asks for.
Measuring whether the program works
Governance programs fail quietly when they have no scorecard. Track compliance rate from Config, Macie findings per classification job with the false-positive trend, percentage of assets carrying required classification tags, mean time to remediate a non-compliant resource, and the completion rate of quarterly access reviews. Review the scorecard with data owners rather than only engineers, because the remediation decisions, such as whether a legacy table can be deleted or must be archived under a specific retention rule, belong to the people accountable for the data rather than the people who move it. A governance program that improves these five numbers quarter over quarter is one you can defend in any audit, and one that gives engineers a clear answer when someone asks why a grant takes a day instead of five minutes.
Common Mistakes
Skipping classification and tagging entirely
Fix: Enforce required tags through Config rules and SCPs before data lands in the lake
Granting broad IAM access instead of Lake Formation permissions
Fix: Register locations and grant through Lake Formation so column and row level controls apply
Disabling Macie because the scan cost looks high
Fix: Use scheduled sampling on high-risk prefixes instead of continuous full-population scans
Never auditing existing grants
Fix: Run quarterly access reviews and revoke roles tied to departed employees or dead projects
Best Practices
- Centralize permission grants in a dedicated data lake admin role
- Combine Macie custom data identifiers with an allowlist to keep findings actionable
- Pair every preventive control with a detective Config rule and a corrective Lambda
- Document the erasure workflow and its expected latency before a request arrives
- Publish the governance scorecard to data owners, not only to engineering
Interview Questions
Q1: How does Lake Formation differ from IAM for data access?
IAM grants are coarse, at the bucket or table level. Lake Formation adds column level, row level and tag-based grants and brokers access through the Glue catalog so consumers never need direct S3 permissions.
Q2: When would you use Macie versus a custom classifier?
Use Macie for built-in ML detection of common PII and financial data across S3, and add custom data identifiers for domain-specific patterns the built-in detectors do not know about.
Q3: Explain the three lines of defense.
Preventive controls stop violations, detective controls find them, and corrective controls fix them. Effective governance needs all three; missing any one leaves either an endless backlog or silent drift.
Q4: How do you implement right to erasure in a lake?
Locate the subject's data with Macie and catalog metadata, rewrite or anonymize affected partitions, refresh catalog statistics, log the action to CloudTrail, and notify the requester within the agreed window.
Key Takeaways
- Governance answers four questions: ownership, access, content and audit history
- Lake Formation brokers access through the Glue catalog with column, row and tag level controls
- Macie findings should trigger automated remediation, not a dashboard nobody opens
- Config compliance rate is the governance metric executives actually understand
- Erasure in an immutable lake is a batch rewrite with a documented latency, not a delete