Module 1 · Identity and Storage · Lesson 2 of 9
IAM reasoning and a least-privilege role
Read policies like the evaluator does, tell bucket ARNs from object ARNs, and build a role that reads one object and nothing else.
In this lesson · about 28 minutes
- Explain how AWS evaluates identity policies, resource policies, explicit denies and SCPs
- Write a policy scoped to a single object ARN
- Test both success and denial using the intended role, not an admin
IAM (Identity and Access Management) decides whether a principal (a user or role) may perform an action (like s3:GetObject) on a resource (identified by an ARN).
How a decision is made (simplified)
- Everything starts denied by default.
- An explicit deny in any applicable policy wins. Always.
- Service control policies (SCPs) from AWS Organizations set the outer limit for an account. They don't grant anything; they only constrain.
- An allow from an identity policy (attached to the user or role) or a resource policy (like a bucket policy) grants access, within those limits.
A role also has a trust policy that controls who can assume it. Permissions and trust are separate questions.
Bucket ARN versus object ARN
| ARN | Used for |
|---|---|
arn:aws:s3:::noviq-lab-bucket | Bucket-level actions like s3:ListBucket |
arn:aws:s3:::noviq-lab-bucket/reports/q3.txt | Object-level actions like s3:GetObject, s3:PutObject |
A common mistake is granting s3:GetObject on the bucket ARN: it matches nothing, because objects live under bucket/key.
The role for challenge 01
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::noviq-lab-bucket/reports/q3.txt"
}]
}
It reads exactly one object. No upload, no delete, no listing. Add s3:ListBucket on the bucket ARN only if listing is actually required.
Performance-based question (PBQ)
Allow or deny?
The role lab-reader has only the policy above. The account's SCP allows all S3 actions. There's no bucket policy except where noted.
Decide the result of each request made as lab-reader.
- GetObject noviq-lab-bucket/reports/q3.txt
- GetObject noviq-lab-bucket/reports/payroll.txt
- PutObject noviq-lab-bucket/reports/q3.txt
- ListBucket noviq-lab-bucket
- GetObject q3.txt, after a bucket policy adds Deny s3:* for lab-reader
- GetObject q3.txt, after the SCP changes to deny all S3
Hands-on lab (simulated terminal)
Practice challenge 01: test as the role
A simulated AWS CLI in a sandbox account (111122223333). The profile lab-reader assumes the role above. Bucket and data are dummies.
Step 1 of 4. Type each command and press Enter. Nothing runs on your computer.
1. Confirm who you are with the lab-reader profile.
Check your understanding0 of 4 correct
Quiz score: 0 of 4
Noviq Academy is free and for learning. The AWS command line and console in this course are simulated with a made-up account and dummy data. If you practise in a real AWS account, use a dedicated sandbox, enable MFA and budget notifications, and delete everything when you finish: you are responsible for any charges. AWS and Amazon S3 are trademarks of Amazon.com, Inc.; this course is independent of AWS.