Least privilege and troubleshooting
SCS-C03 · Lesson 16 of 22 · 2:17:56
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the SCS-C03 exam (AWS Certified Security – Specialty). In this lesson: least privilege with policies generated from CloudTrail activity and last accessed information, permissions boundaries and session policies, explaining a denied request (error messages, explicit deny, the policy simulator), and IAM Access Analyzer for external and unused access, archive rules, and policy checks before deployment. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Too much, too little, or unexpected
Developers at AnyCompany Health create roles for their Lambda functions, and the security team must make sure that those roles never get more than they should. Meanwhile, a nightly job fails with an access denied error, and a review finds a bucket shared with an account that nobody recognizes. This lesson covers least privilege, the limits you can set, how to explain a denied request, and how to find access that should not exist.
Least privilege
Least privilege means granting only the permissions that a task needs, on the resources that it needs, and nothing more. In practice, you can start with AWS managed policies, then move toward your own policies, scoped to specific actions, resources, and conditions. IAM Access Analyzer can generate a policy from the CloudTrail activity of a role, over a period of up to ninety days, which gives you a template to refine. And last accessed information shows which services and actions a role has not used, so that you can remove them.
Permissions boundaries and session policies
A permissions boundary is a managed policy that sets the maximum permissions that identity-based policies can give a user or a role. It never grants anything by itself: the effective permissions are what both the identity-based policies and the boundary allow. The classic use is delegation: developers can create roles for their functions, but only when they attach the required boundary, which a condition in their own policy enforces. A session policy works the same way for one session: you pass it when you assume a role, and the session gets only what both the role and the session policy allow. Neither one can widen access, so adding a boundary or a session policy can only reduce what is allowed.
Explaining a denied request
Every request is denied by default, an allow in a policy is needed, and an explicit deny in any policy always wins. In an organization, a request must get through every layer that applies: SCPs and RCPs, resource-based policies, identity-based policies, permissions boundaries, and session policies. Many access denied messages name the type of policy that blocked the request, for example with an explicit deny in a service control policy, or because no identity-based policy allows the action. The IAM policy simulator tests identity-based policies, permissions boundaries, SCPs, and a resource-based policy that you provide, without sending a real request, and for an allow or an explicit deny, it shows which policy decided. It does not support resource control policies, and its results can differ from reality with VPC endpoint policies or role chaining, so confirm with the real request.
Finding unintended access
IAM Access Analyzer finds access that should not exist. An external access analyzer has a zone of trust, your account or your organization, and creates a finding for each resource-based policy that grants access to a principal outside it; it works per Region, so you turn it on in each Region that you use. An unused access analyzer watches every role and user, and finds unused roles, unused access keys and passwords, and unused permissions, over a usage window that you choose. For each finding, you remove the access if nobody intended it, or archive the finding if the access is expected, and archive rules do that automatically for known partners. Before you deploy, custom policy checks tell you whether a policy grants new access, grants public access, or grants an action that you never want, such as deleting a key.
Recap
Let's recap. Least privilege starts from what a task needs, with policies generated from CloudTrail activity and last accessed information. Permissions boundaries and session policies set a maximum, and never grant anything. To explain a denial, check the error message, remember that an explicit deny always wins, and test with the policy simulator. And IAM Access Analyzer finds external and unused access, archives what is expected, and checks policies before you deploy.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Developers must be able to create IAM roles for their Lambda functions, but no role that they create may ever reach patient data in DynamoDB. What should the security team set up?
- An SCP that denies iam:CreateRole in the account
- A session policy for each developer session
- A daily review of new roles in the IAM console
- A required boundary on every role they create
Show the answer
A required boundary on every role they create
The policy of the developers allows role creation only with the boundary attached, and the boundary excludes patient data, so no new role can go beyond it. “An SCP that denies iam:CreateRole in the account” would stop all role creation, which breaks the requirement. “A session policy for each developer session” limits the sessions of the developers, not the roles that they create. And “A daily review of new roles in the IAM console” finds problems after the fact, instead of preventing them.
The role of a nightly job has an identity-based policy that allows uploads to the archive bucket, but every upload fails with: “with an explicit deny in a service control policy”. What should the team do?
- Add another Allow to the role's identity policy
- Fix the SCP with the team that manages it
- Add a bucket policy that allows the role
- Raise the maximum session duration of the role
Show the answer
Fix the SCP with the team that manages it
An explicit deny in an SCP wins over every allow in the account, so only the team that manages the SCP can fix it, by changing it or by making an exception. “Add another Allow to the role's identity policy” adds an allow, and the explicit deny still wins. “Add a bucket policy that allows the role” is another allow, with the same result. And “Raise the maximum session duration of the role” changes how long a session lasts, not what it can do.
An external access analyzer (zone of trust: the organization) reports that a bucket policy grants access to an account outside the organization. The account belongs to the billing vendor hired last year, and the access is intended. What should the team do?
- Remove the vendor from the bucket policy
- Turn off the analyzer in that Region
- Archive the finding with a rule for that account
- Move the vendor account into the organization
Show the answer
Archive the finding with a rule for that account
The access is intended, so you archive the finding, and an archive rule archives future findings for that vendor automatically. “Remove the vendor from the bucket policy” would break a service that the company needs. “Turn off the analyzer in that Region” would hide every finding in that Region. And “Move the vendor account into the organization” would give a vendor a place in your organization, which is far more trust than it needs.