teluzia.Cloud Engineer · Day 38
CHAPTER 06 · AWS FOUNDATIONS

IAM users, roles, policies and least privilege

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Learn identity authorization by evaluating a small policy before applying anything to an account. Users, roles and policies are different objects: identities request actions, policies describe authorization, and role sessions provide temporary credentials. Your exercise scopes access to one fictional S3 prefix and diagnoses an incorrect resource ARN. An IAM user is a persistent identity that can have long-term credentials; a role is assumed to obtain temporary credentials. Human federation and service roles reduce reliance on stored access keys. A role’s trust policy governs who may assume it, while permission policies govern what its resulting session may do. An IAM statement includes Effect, Action and Resource, with optional Condition. Actions differ in whether they support resource scoping. S3 ListBucket applies to a bucket ARN, while GetObject applies to object ARNs. Conditions can narrow context, but syntax alone does not prove the intended authorization outcome.

Think of it this way

An IAM policy is a permission slip listing the action, place and conditions; a role is a temporary job badge with that slip attached.

TOPIC 01 / 03Step by step

Users, roles and sessions

An IAM user is a persistent identity that can have long-term credentials; a role is assumed to obtain temporary credentials. Human federation and service roles reduce reliance on stored access keys. A role’s trust policy governs who may assume it, while permission policies govern what its resulting session may do. An EC2 instance role can supply temporary credentials to an application through the supported credential provider rather than embedding an IAM user access key in the application’s configuration file or image distributed to every server running the workload. Distinguishing trust from permissions prevents granting useful actions to a role that nobody appropriate can assume, or allowing an inappropriate principal to assume a role whose permissions would then become available for unintended operations against account resources. Attaching an S3 permission policy alone does not authorize a caller to assume a role; review trust relationships separately and avoid creating static keys as the first workaround for every role-assumption failure encountered during setup.

WORKED EXAMPLE
An EC2 instance role can supply temporary credentials to an application through the supported credential provider rather than embedding an IAM user access key in the application’s configuration file or image distributed to every server running the workload.
Why this matters

Distinguishing trust from permissions prevents granting useful actions to a role that nobody appropriate can assume, or allowing an inappropriate principal to assume a role whose permissions would then become available for unintended operations against account resources.

A common trap

Attaching an S3 permission policy alone does not authorize a caller to assume a role; review trust relationships separately and avoid creating static keys as the first workaround for every role-assumption failure encountered during setup.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Users, roles and sessions

An IAM user is a persistent identity that can have long-term credentials; a role is assumed to obtain temporary credentials. Human federation and service roles reduce reliance on stored access keys. A role’s trust policy governs who may assume it, while permission policies govern what its resulting session may do. An EC2 instance role can supply temporary credentials to an application through the supported credential provider rather than embedding an IAM user access key in the application’s configuration file or image distributed to every server running the workload. Distinguishing trust from permissions prevents granting useful actions to a role that nobody appropriate can assume, or allowing an inappropriate principal to assume a role whose permissions would then become available for unintended operations against account resources. Attaching an S3 permission policy alone does not authorize a caller to assume a role; review trust relationships separately and avoid creating static keys as the first workaround for every role-assumption failure encountered during setup.

WORKED EXAMPLE
An EC2 instance role can supply temporary credentials to an application through the supported credential provider rather than embedding an IAM user access key in the application’s configuration file or image distributed to every server running the workload.

Why this matters

Distinguishing trust from permissions prevents granting useful actions to a role that nobody appropriate can assume, or allowing an inappropriate principal to assume a role whose permissions would then become available for unintended operations against account resources.

A common trap

Attaching an S3 permission policy alone does not authorize a caller to assume a role; review trust relationships separately and avoid creating static keys as the first workaround for every role-assumption failure encountered during setup.

Policy actions, resources and conditions

An IAM statement includes Effect, Action and Resource, with optional Condition. Actions differ in whether they support resource scoping. S3 ListBucket applies to a bucket ARN, while GetObject applies to object ARNs. Conditions can narrow context, but syntax alone does not prove the intended authorization outcome. s3:GetObject with arn:aws:s3:::example-bucket/notes/* allows objects under notes, while s3:ListBucket needs arn:aws:s3:::example-bucket and can use an s3:prefix condition appropriate to the listing request made by a client within that allowed bucket. Correct action-resource pairing produces narrow useful permissions and prevents a policy that either does nothing because its ARN type is wrong or grants broader data access than the application actually requires to fulfill its own read-only contract. Using the bucket ARN for GetObject omits the object resource and causes denial; learn service-specific ARN semantics instead of changing every Resource to star whenever a narrowly scoped request fails under a policy being tested.

WORKED EXAMPLE
s3:GetObject with arn:aws:s3:::example-bucket/notes/* allows objects under notes, while s3:ListBucket needs arn:aws:s3:::example-bucket and can use an s3:prefix condition appropriate to the listing request made by a client within that allowed bucket.

Why this matters

Correct action-resource pairing produces narrow useful permissions and prevents a policy that either does nothing because its ARN type is wrong or grants broader data access than the application actually requires to fulfill its own read-only contract.

A common trap

Using the bucket ARN for GetObject omits the object resource and causes denial; learn service-specific ARN semantics instead of changing every Resource to star whenever a narrowly scoped request fails under a policy being tested.

Evaluation and least privilege

IAM authorization combines applicable policy layers. An explicit deny overrides an allow; absence of an applicable allow is normally an implicit deny. Resource policies, permission boundaries, session policies and organization controls can affect the result. Least privilege starts from required operations and narrows scope, then validates realistic requests. A statement allowing GetObject cannot override an applicable explicit deny for that object; a successful identity policy review alone does not prove a request succeeds when other relevant policy layers deny it or necessary encryption-key permissions are missing. Reasoning across policy layers makes access-denied investigations accurate and avoids widening one identity policy repeatedly when the actual blocker is a different explicit deny, role trust restriction or required companion permission on a resource used by the request. Assuming one Allow guarantees success ignores other controls; inspect principal, action, resource and context together and preserve denials rather than immediately granting AdministratorAccess to make the first practice request appear successful without explaining why it failed.

WORKED EXAMPLE
A statement allowing GetObject cannot override an applicable explicit deny for that object; a successful identity policy review alone does not prove a request succeeds when other relevant policy layers deny it or necessary encryption-key permissions are missing.

Why this matters

Reasoning across policy layers makes access-denied investigations accurate and avoids widening one identity policy repeatedly when the actual blocker is a different explicit deny, role trust restriction or required companion permission on a resource used by the request.

A common trap

Assuming one Allow guarantees success ignores other controls; inspect principal, action, resource and context together and preserve denials rather than immediately granting AdministratorAccess to make the first practice request appear successful without explaining why it failed.

KEEP THESE WITH YOU

Today’s takeaways

Prefer temporary role credentials.

Pair actions with correct resources.

Diagnose all applicable policy layers.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed