Pair your devices with a code and playback position follows you: pause on this device, hit resume on the other. Position is saved to the site every minute and on pause.
Open this panel on your other device and enter the same code.
Starts this lesson and continues through 6 more to the end of the course.
Every pipeline in lessons 1–5 ends with a role reading S3 and a query engine reading it back.
Three systems decide whether that succeeds — IAM, Lake Formation, and KMS — and a request has to
pass all of them. Most "AccessDenied" tickets on a data platform are not a missing IAM statement.
They are a Lake Formation grant never made, a key policy that doesn't name the Glue role, or a
PassRole the deployer lacks. This lesson is about knowing which of the three said no.
The responsibility line is "Implement data governance and security best practices using Lake Formation, IAM, and KMS." Read it as three interview questions: who can see which columns (Lake Formation), which role runs the job and who may hand it that role (IAM), who can decrypt the bytes and how often (KMS). The senior answer connects them — a Glue job needs all three, and only one produces a useful error message.
From Overview of Lake Formation permissions (verified 2026-10-30):
"When a principal makes a request to access Data Catalog resources or underlying data, for the request to succeed, it must pass permission checks by both IAM and Lake Formation."
IAM controls the API (glue:CreateTable). Lake Formation controls the catalog object and
the data under it, with DBMS-style GRANT/REVOKE. You can hold CREATE_TABLE in Lake Formation
and still fail for lack of glue:CreateTable. And: "Lake Formation permissions apply only in the
Region in which they were granted."
IAMAllowedPrincipals default, and why you remove itA new account is not actually governed by Lake Formation. Per Changing the default settings (verified 2026-10-30), the initial settings are:
Super permission is granted to the group IAMAllowedPrincipals on all existing AWS Glue
Data Catalog resources."Together: "access … [is] controlled solely by IAM policies. Individual Lake Formation permissions
are not in effect." IAMAllowedPrincipals is "any IAM users and roles that are allowed access … by
your IAM policies". Until you revoke it, every LF grant you make is decorative.
The API fix, copied from the same page — this turns off the defaults for new resources:
{
"DataLakeSettings": {
"DataLakeAdmins": [
{
"DataLakePrincipalIdentifier": "arn:aws:iam::<AccountId>:user/<Username>"
}
],
"CreateDatabaseDefaultPermissions": [],
"CreateTableDefaultPermissions": []
}
}
Existing resources need the explicit revoke in
Upgrading AWS Glue data permissions:
"revoke the Super permission from IAMAllowedPrincipals on each table and database". Automation
that creates tables will need its own grants afterwards.
⚠️ Hybrid access mode avoids the big-bang: "an incremental path that allows you to set Lake Formation permissions for a specific set of users without interrupting … existing users".
From Create a data lake administrator (verified 2026-10-30): admins "are initially the only IAM users or roles that can grant Lake Formation permissions … to any principal (including self)", and "By default, Lake Formation allows you to create upto 30 data lake administrators." ⚠️ I could not verify whether 30 is adjustable — it is stated in prose, not in a Service Quotas table; check the General Reference.
Implicit permissions:
admins have Describe on everything and can grant to anyone, but "do not have implicit permissions
to drop databases or alter/drop tables created by others" — they must grant themselves first.
Storage-level enforcement is off until you register the S3 location with a role (Storage access management). After that LF vends temporary credentials: it assumes the registered role and hands the engine scoped-down credentials. Users "don't need direct access to Amazon S3."
| Role option | Use it when | Source |
|---|---|---|
Service-linked role AWSServiceRoleForLakeFormationDataAccess |
Simplest; LF appends each path to its inline policy | service-linked-roles |
User-defined role (trusts lakeformation.amazonaws.com; s3:Get/Put/DeleteObject + s3:ListBucket) |
Required for: another account; the AWS managed key aws/s3; "if you plan to access the location using Amazon EMR" |
registration-role |
The registering admin "must have the iam:PassRole permission on the role". And for encrypted
locations: "either the role must have permission to encrypt and decrypt data with the AWS KMS key,
or the KMS key policy must grant permissions on the key to the role"
(register-encrypted).
That sentence is where Lake Formation and KMS meet.
⚠️ Registered with the service-linked role and now want EMR? "You must deregister the location and reregister it with a user-defined role."
| Method | Granularity | When |
|---|---|---|
| Named resource | database, table, column (include/exclude list) | Small catalogs |
| LF-TBAC (LF-Tags) | tag expressions, inherited db → table → column | "Recommended … when there is a large number of Data Catalog objects" |
| Data filters | row, column, cell — attached to a SELECT grant |
PII, regional partitions |
LF-TBAC (verified 2026-10-30): "Tables inherit LF-Tags from databases and columns inherit LF-Tags from tables. Inherited values can be overridden." The worked example replaces 17 named grants with 5 tag assignments and 4 grants. ⚠️ "IAM tags are not the same as LF-Tags."
Data filters: all-columns
wildcard + row expression = row-level; column list + all-rows = column-level; both = cell-level.
"Filters apply only to read operations … you can grant only the SELECT Lake Formation permission
with filters." The CreateDataCellsFilter body, copied from the doc:
{
"Name": "restrict-pharma",
"DatabaseName": "sales",
"TableName": "orders",
"TableCatalogId": "111122223333",
"RowFilter": {"FilterExpression": "product_type='pharma'"},
"ColumnWildcard": {
"ExcludedColumnNames": ["customer_name"]
}
}
Cross-account data sharing (verified 2026-10-30): a cross-account grant "uses the AWS Resource Access Manager (AWS RAM) service to share the resource." Same organization — immediate. Different organization — RAM invitation that "the data lake administrator in the grantee account must … accept." LF-TBAC to Organizations/OUs needs "Cross account version settings to Version 3 or above." ⚠️ Athena and Redshift Spectrum "require resource links to be able to include shared resources in queries".
From Service integrations plus the engine guides (verified 2026-10-30):
| Engine | Honours LF? | Caveat |
|---|---|---|
| AWS Glue | Yes — same Data Catalog; sees only granted objects | Crawlers/jobs need grants once Super is revoked |
| Athena | Reads of registered data only | "do not apply when writing objects"; query-results locations "cannot be registered"; no LF control of VACUUM/MERGE/UPDATE/OPTIMIZE on OTF tables |
| Redshift Spectrum | Yes — external schema sees only granted tables/columns | Only where LF is available |
| EMR | Release 6.7.0+, Spark/Hive/Presto, "with a runtime role" | Location registered with a user-defined role |
| Amazon Quick Enterprise | Needs LF SELECT |
— |
From How AWS enforcement code logic evaluates requests (verified 2026-10-30), in sequence: explicit deny anywhere → Deny; then RCPs; SCPs; resource-based; identity-based; permissions boundary; session policy. Two pipeline details:
kms:Decrypt in an identity policy is not enough on its own.ExecutionRoleSessionPolicy
(Jobs API) is a session policy.| Service | Role | Who assumes it |
|---|---|---|
| Glue job | one IAM role, Role is required on CreateJob; trusts glue.amazonaws.com |
the job run |
| EMR | service role EMR_DefaultRole_V2 — provisioning; EC2 instance profile EMR_EC2_DefaultRole — "application processes … use this role when they call other AWS services"; both "required for all clusters" |
EMR control plane vs the nodes |
| EMR + LF | runtime role on the step | the job, per-user |
Source: Configure IAM service roles for Amazon EMR
(verified 2026-10-30). Spark's S3 read uses the instance profile (or runtime role) — adding
s3:GetObject to EMR_DefaultRole_V2 fixes nothing.
PassRole trapGranting a user permissions to pass a role
(verified 2026-10-30): "The service then checks whether that user has the iam:PassRole
permission." For Glue, Role is a required parameter of CreateJob (and UpdateJob);
StartJobRun carries no role, so a deployer without PassRole fails at deploy, not run time.
⚠️ "PassRole is not an API call … no CloudTrail logs are generated" — read the CreateJob event.
And: "Do not try to control who can pass a role by tagging the role."
The Glue statement, copied from attach-policy-iam-user:
{
"Action": [
"iam:PassRole"
],
"Effect": "Allow",
"Resource": "arn:aws:iam::*:role/AWSGlueServiceRole*",
"Condition": {
"StringLike": {
"iam:PassedToService": [
"glue.amazonaws.com"
]
}
}
}
iam:PassedToService is the condition that stops a role meant for Glue being handed to EC2.
aws:SourceArn / aws:SourceAccountThe confused deputy problem
(verified 2026-10-30): "We recommend using aws:SourceArn, aws:SourceAccount, aws:SourceOrgID,
or aws:SourceOrgPaths in your resource policies wherever an AWS service principal is granted
permission." A bucket or key policy trusting glue.amazonaws.com without one is open to any account
that knows the bucket name.
Key types, key policies, envelope encryption, rotation and S3's SSE options are covered in
certification/SAA1-design-secure-architectures/lessons/05-encryption-and-keys.md. Read that first;
this is what a pipeline adds.
Request quotas
(verified 2026-10-30): "Each time you upload or download an S3 object that's encrypted with SSE-KMS,
Amazon S3 makes a GenerateDataKey (for uploads) or Decrypt (for downloads) request … These
requests count toward your quota." A million small Parquet files is a million Decrypt calls.
| Quota | Default | Adjustable? |
|---|---|---|
Cryptographic operations (symmetric), shared across Encrypt/Decrypt/GenerateDataKey/… |
10,000 rps; 20,000 in us-east-2, ap-southeast-1/2, ap-northeast-1, eu-central-1, eu-west-2, eu-south-2; 100,000 in us-east-1, us-west-2, eu-west-1 | Yes |
CreateGrant |
50 rps | Yes |
DescribeKey |
2,000 rps | Yes |
| CloudHSM key store | 1,800 rps shared | No — the only non-adjustable one |
"All AWS KMS request quotas are adjustable, except for the AWS CloudHSM key store request quota." ⚠️ Doc contradiction: the same page's "on your behalf" paragraph still says "5,500 (or 10,000 or 50,000 depending upon your AWS Region)". Quote the table, not the prose.
Cross-account: "AWS KMS throttles the account that makes the requests, not the account that owns the KMS key."
Reducing the cost of SSE-KMS with S3 Bucket Keys (verified 2026-10-30): "can reduce AWS KMS request costs by up to 99 percent" via "a short-lived bucket-level key" that mints per-object data keys inside S3. Three traps:
CopyObject them.Protecting data with encryption: SSE-S3 is "the base level of encryption for every bucket" since 5 January 2023 — the real choice is whether you need a key policy, and SSE-KMS gives you one. DSSE-KMS applies "two independent layers of AES-256 encryption", keys "must be in the same Region as the bucket", costs more, no Bucket Keys. For a compliance mandate, not by default.
kms:ViaService and encryption contextCopied from AWS KMS condition keys (verified 2026-10-30):
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/ExampleRole"
},
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:CreateGrant",
"kms:ListGrants",
"kms:DescribeKey"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"kms:ViaService": [
"ec2.us-west-2.amazonaws.com",
"rds.us-west-2.amazonaws.com"
]
}
}
}
Swap in s3.<region>.amazonaws.com and your Glue role, and a stolen credential can't call
kms:Decrypt directly. kms:EncryptionContext:context-key restricts by the key/value pair the
service attaches (symmetric keys only).
Grants: "A grant can allow
access to a KMS key, but not deny access", one key per grant, eventually consistent ("use a grant
token"). Integrated services create grants on your behalf — denying kms:CreateGrant breaks them.
Multi-Region keys share "the same key material and key ID, so you can encrypt data in one AWS Region and decrypt it in a different AWS Region without re-encrypting" — what makes a replicated lake readable. Rotation: "Key rotation has no effect on the data that the KMS key protects. It does not rotate the data keys." Rotating never re-encrypts your Parquet.
SELECT in Lake Formation; the analyst still sees every column in
Athena. First check?CreateJob fails with AccessDenied on iam:PassRole. Why not at StartJobRun, and where in
CloudTrail?Super is still granted to IAMAllowedPrincipals on that table or database. While it
is, LF grants are not in effect.Role is a parameter of CreateJob/UpdateJob, not StartJobRun. PassRole emits no
CloudTrail event — read the CreateJob event.aws lakeformation list-permissions on a fresh account; find IAMAllowedPrincipals
with ALL. Revoke it on one table, watch Athena fail, put it back.kms:Decrypt on the role, key policy untouched. Show the IAM line about key
policies being an exception.cheatsheet.md, lab.md, quiz.md, interview.md.