Lesson 1 of 8 Security Posture Improvement

Auditing and Reducing Excess Permissions

This lesson explains how least-privilege audits find and remove accumulated excess permissions continuously rather than once a year.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how IAM Access Analyzer finds excess permissions.
  • Describe a regular audit cycle.
  • Explain the structural improvements that stop excess accumulating.

Finding excess permissions

Least privilege is maintained by regularly finding and removing permissions that are not needed. IAM Access Analyzer provides three analyses. External access analysis finds resources shared outside the organisation or account. Unused access analysis finds roles, access keys, passwords and permissions that have not been used across the organisation. Internal access analysis shows which principals inside the organisation can reach critical resources. Its policy validation and custom policy checks catch risky policies in pipelines before they are deployed, and policy generation builds least-privilege policies from a role's CloudTrail activity.

Within IAM, last accessed information shows which services and actions a principal actually used, and credential reports list the status and age of every IAM user's passwords and access keys. The following table summarises the tools.

ToolWhat it finds or does
Access Analyzer external accessResources shared outside the organisation or account
Access Analyzer unused accessUnused roles, access keys, passwords and permissions across the organisation
Access Analyzer internal accessWhich principals inside the organisation can reach critical resources
Policy validation and custom policy checksRisky or non-compliant policies, caught in pipelines before deployment
Policy generationLeast-privilege policies built from CloudTrail activity
Last accessed informationServices and actions a principal actually used
Credential reportsStatus and age of IAM users' passwords and access keys
Match the pairs

Finding excess permissions

Exam skills 2.1.4 · 2.1.3

Match each audit need with the feature that meets it.

Log in to try this activity Interactive activities are free with an account.

An audit cycle

Permissions should be reviewed regularly and reduced to what is actually used. A typical audit cycle proceeds as follows.

  1. Find unused access

    Enable an organisation-wide unused access analyzer from the delegated administrator account.

  2. Remove what is unused

    Remove unused roles and credentials first; they carry risk and no benefit.

  3. Narrow active roles

    Compare granted permissions with last accessed data, and generate a narrower policy from CloudTrail activity.

  4. Deploy through the pipeline

    Deploy the narrower policy through the normal pipeline, with custom policy checks to stop the excess returning.

  5. Repeat

    Repeat on a schedule, and alert on new external access findings as they occur.

Structural improvements

Audits remove excess permissions; structural changes stop it accumulating again. Replacing IAM users and long-term access keys with IAM Identity Center for people and roles for workloads removes the credentials that are hardest to track and most often leaked. Permissions boundaries let teams create roles for their applications without being able to exceed a ceiling, so delegation does not lead to privilege escalation.

Attribute-based access control lets new projects reuse existing policies by tagging, rather than receiving new and often broader policies. Organisation-wide SCPs and RCPs catch what individual policies miss, by setting limits that no account-level policy can exceed.

Worked example

Removing unused access across the organisation

An audit finds hundreds of roles with broad permissions. The security account creates an organisation-wide unused access analyzer that flags roles, keys and permissions not used in 90 days:

aws accessanalyzer create-analyzer --analyzer-name org-unused --type ORGANIZATION_UNUSED_ACCESS \
  --configuration '{"unusedAccess":{"unusedAccessAge":90}}'
aws accessanalyzer list-findings-v2 --analyzer-arn $ANALYZER_ARN \
  --filter '{"findingType":{"eq":["UnusedPermission"]}}' --max-results 20

Findings feed a regular review: unused roles are deleted, and policies with unused permissions are replaced with narrower ones generated from CloudTrail activity. To stop the excess returning, the deployment pipeline runs a custom policy check that fails any change granting new access beyond a reference policy:

aws accessanalyzer check-no-new-access --policy-type IDENTITY_POLICY \
  --new-policy-document file://proposed.json --existing-policy-document file://approved.json
Check yourself

How can new policies be checked for excess permissions before they are deployed?

Show answer

With IAM Access Analyzer custom policy checks in the pipeline, which fail the change if it grants new access or specified sensitive actions.

Exam Tips

Remember for the exam

  • Unused roles and permissions across the organisation are found with Access Analyzer unused access findings.
  • To build a least-privilege policy from real activity, use Access Analyzer policy generation.
  • To stop overly broad policies being deployed, use custom policy checks in the pipeline.
  • To see which services a role has used, check last accessed information.
  • Replace IAM users and long-term keys with Identity Center and roles.