Govern data on AWS with Lake Formation and retention
Assign data owners, grant table-level and cross-account access with Lake Formation, and set protection and retention rules.
By Invicly Tech, , in AWS Cloud Engineering. About 12 minutes to read.
In short
Data governance answers who owns each data set, who may read which parts of it, how sensitive data is protected and when data is deleted. AWS Lake Formation adds database, table, column and row permissions on top of the Glue Data Catalog, and can share tables with other accounts. Retention is enforced with S3 lifecycle rules, Object Lock and documented owner decisions.
Think of it like this: Lake Formation is a library card system: the books stay on the shelves, but your card decides which rooms, shelves and even which pages you may read.
Explained simply
Once a data lake has real data, people start asking for access. Finance wants failure counts, support wants per-customer history, and a partner wants a monthly extract. Governance is the set of rules that decides who gets what, how sensitive data is protected and when old data is deleted. Without it, access grows by copy and paste and nobody knows who can see what.
Start with ownership. Every data set needs a named owner, a person or team who answers three questions: who may use this data, for what purpose, and for how long should we keep it. The platform team runs the tools, but the owner makes the decisions. Write the owner down next to the table, for example in a table property or a catalog description.
AWS Lake Formation turns those decisions into permissions. Instead of writing long S3 bucket policies, you grant SELECT on a database, a table, some columns or even some rows, much like GRANT in a normal database. Athena, Redshift Spectrum and AWS Glue check these grants, and Lake Formation hands them short-lived credentials to read only the allowed data.
Retention is the last piece. Some data must be deleted after a set time, for privacy. Some must be kept, for audit. S3 lifecycle rules delete or archive objects on a schedule, and S3 Object Lock stops anyone deleting objects before a date. Amazon Macie can scan buckets to find personal data you did not know was there.
Cost note: Lake Formation permissions do not add a large bill on their own; you pay for the services underneath, such as S3, Glue and Athena. Macie charges per bucket and per GB scanned, so use a small synthetic bucket in a lab. You can also do this topic as a design exercise on paper.
Press Play on a diagram to walk through it one step at a time.
- 1Owner decision
Data owner approves who needs which data and for how long
- 2Lake Formation grant
SELECT on table, columns or rows via data filters
- 3Glue Data Catalog
Table definition registered with Lake Formation
- 4S3 location
Registered path; Lake Formation vends temporary credentials
- 5Encryption and retention
KMS keys, lifecycle expiry, Object Lock if required
- 1Request
Team asks for data and states the purpose
- 2Owner approves
Scope: columns, rows, duration
- 3Grant
Lake Formation grant or LF-Tag expression
- 4Use and audit
CloudTrail records data access calls
- 5Review
Quarterly check; revoke what is unused
- Back to step 1
In depth
How Lake Formation permissions actually work
First you register an S3 location with Lake Formation, using a role that can read it. From then on, for tables in that location, query engines ask Lake Formation for access. Lake Formation checks the caller's grants and, if allowed, vends temporary credentials scoped to the data, then the engine applies any column or row limits. A data lake administrator manages grants. A big trap is the compatibility default: new databases and tables may carry a grant to IAMAllowedPrincipals, which means plain IAM policies still control access and Lake Formation grants are bypassed. To truly enforce Lake Formation, remove that grant (or adjust the default settings for new resources) once your grants are in place. Hybrid access mode lets you move tables over gradually.
- Analyst role to Athena: SELECT file_id, status FROM results1SELECT file_id, status FROM results
- Athena to Lake Formation: Check grants for this role and table2Check grants for this role and table
- Lake Formation to Athena: Allowed columns plus temporary credentials3Allowed columns plus temporary credentials
- Athena to S3: Read objects with vended credentials4Read objects with vended credentials
- Athena to Analyst role: Rows with only permitted columns5Rows with only permitted columns
Granting by name, by tag and by row
The named resource method grants on a specific database or table. It is clear but grows with every new table. LF-Tag based access control (LF-TBAC) scales better: you define tags such as domain=files and sensitivity=public or restricted, attach them to databases, tables or columns, and grant on tag expressions. A new table tagged domain=files and sensitivity=public is instantly readable by everyone granted that expression, with no new grant. Data filters add fine-grained control: a filter names included or excluded columns and a row filter expression like region = 'eu', and you grant SELECT through the filter. Column-level grants are good for hiding fields like email; row filters are good for giving each team only its region.
- Named grants: simple, explicit, many statements
- LF-Tags: scale with new tables automatically
- Column grants hide personal fields
- Row filters split one table by team or region
Sharing across accounts
In a multi-account setup, the lake usually lives in a central data account and consumers live in their own accounts. Lake Formation shares catalog resources to another account, an organization or an organizational unit using AWS Resource Access Manager (RAM). The consumer account accepts the share (automatic within an organization, depending on settings), sees the shared database or table, and creates a resource link so the table appears in its own catalog. Then the consumer account's data lake administrator grants access to its own roles. This two-step model keeps each account in charge of its own people: the producer decides which account gets what, and the consumer decides which of its users can use it. The data never leaves the producer's bucket.
- Producer grants to an account, org or OU
- RAM carries the share
- Consumer creates a resource link and grants internally
- Revoke in the producer to cut off the whole account
Protection and retention decisions
Protection starts with knowing where sensitive data is. Amazon Macie scans S3 objects with managed and custom data identifiers and reports findings such as credit card numbers or names. Classify each data set (for example public, internal, restricted) and record it as an LF-Tag so access follows the class. Encrypt with SSE-KMS where you need key-level control and audit; remember readers then also need kms:Decrypt. For retention, agree a rule per class with the owner, then automate it. Lifecycle rules can expire raw uploads after 30 days and move curated data to a cheaper storage class. Object Lock in compliance mode cannot be shortened by anyone, including the root user, so test it in a throwaway bucket first. On versioned buckets, expire noncurrent versions too, or deleted data lingers.
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Name data owners~30m
- 2Grant access with Lake Formation~30m
- 3Share across accounts~30m
- 4Classify and protect sensitive data~30m
- 5Set retention and deletion rules~30m
Key points
- Every data set needs a named owner who approves access and retention.
- Lake Formation grants work like database GRANT statements on catalog resources.
- LF-Tags let you grant by label (for example sensitivity=restricted) instead of table by table.
- Cross-account sharing uses AWS Resource Access Manager; the receiving account still grants to its own users.
- Retention should be automated with lifecycle rules, not left to someone remembering to delete files.
Key terms
Tap a card to flip it. 0/5 known
Examples
Give support access to file results without customer emails
Scenario: the table lab.file_results has file_id, status, bytes, customer_email and region. Support needs counts by status but must not see emails. Step 1: the data owner approves columns file_id, status, bytes and region. Step 2: grant SELECT on those columns to the support role. Step 3: test as support: SELECT customer_email fails, and SELECT status works. Evidence: Athena returns an error naming the column, and CloudTrail shows the Lake Formation GetDataAccess call. Rollback: revoke the grant with the matching revoke-permissions command.
aws lakeformation grant-permissions \
--principal DataLakePrincipalIdentifier=arn:aws:iam::111122223333:role/support-analyst \
--permissions SELECT \
--resource '{"TableWithColumns": {
"DatabaseName": "lab",
"Name": "file_results",
"ColumnNames": ["file_id", "status", "bytes", "region"]}}'Automate retention for raw uploads
Decision from the owner: raw uploads may contain personal data and must be deleted 30 days after upload; curated results are kept 400 days. Step 1: add the lifecycle rule below to the raw bucket. Step 2: because versioning is on, also expire noncurrent versions so deleted files do not linger. Evidence: get-bucket-lifecycle-configuration shows the rule, and objects older than 30 days disappear within a day or two of becoming eligible. Rollback: delete or edit the rule.
{
"Rules": [{
"ID": "expire-raw-uploads",
"Status": "Enabled",
"Filter": { "Prefix": "uploads/" },
"Expiration": { "Days": 30 },
"NoncurrentVersionExpiration": { "NoncurrentDays": 7 },
"AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
}]
}Quick reference
- Every data set needs a named owner who approves access and retention.
- Register the S3 location with Lake Formation before relying on its grants.
- Remove the IAMAllowedPrincipals grant or Lake Formation permissions are bypassed.
- LF-Tags grant by label, so new tagged tables are covered automatically.
- Data filters combine column limits and a row filter expression in one grant.
- Cross-account shares go through AWS RAM; the consumer grants to its own roles.
- Lifecycle rules delete on schedule; Object Lock blocks deletion until a retention date.
- Macie finds sensitive data in S3; record the class as an LF-Tag.
Common mistakes
- Leaving the default IAMAllowedPrincipals grant in place, so plain IAM policies still bypass Lake Formation.
- Granting at table level when only a few safe columns are needed.
- Setting retention without asking the data owner or legal team what the real requirement is.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
For three data sets (raw uploads, file results, monthly finance report) write the owner, classification and retention rule.
- Exercise 2medium
Create LF-Tags for sensitivity and attach sensitivity=restricted to the customer_email column only.
- Exercise 3hard
Design a cross-account setup: the data account 111122223333 shares lab.file_results with the analytics account 444455556666, where only the reporting role may read it, with rows limited to region = 'eu'.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Do I need Lake Formation if I already use IAM and bucket policies?
- Not for a small lake with one team. Lake Formation pays off when you need column or row limits, tag-based grants or many cross-account consumers.
- Does Lake Formation copy my data?
- No. Data stays in your S3 buckets. Lake Formation manages permissions and hands query engines temporary credentials to read it.
- What is the difference between a lifecycle rule and Object Lock?
- A lifecycle rule deletes or moves objects after a time. Object Lock stops objects being deleted or overwritten before a time. One enforces deletion, the other enforces keeping.
- How do I find personal data I did not know was in S3?
- Run Amazon Macie sensitive data discovery on the bucket. It reports objects that contain matches for data types such as names, addresses or card numbers.