Lesson 1 of 4 IAM Access Analyzer and Authorization Tools

Finding Unintended Access with IAM Access Analyzer

This lesson explains how IAM Access Analyzer finds access that may be unintended and helps you move towards least privilege, both for existing resources and for policies before deployment.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish external access, internal access and unused access analyzers.
  • Explain how policy validation and custom policy checks test policies before deployment.
  • Set up organisation-level analyzers and archive rules.

Analyzer types

IAM Access Analyzer has three types of analyzer. An external access analyzer reports resources that principals outside your zone of trust, the account or organisation you choose, can reach. It covers S3 buckets, IAM roles, KMS keys, Lambda functions, SQS queues, Secrets Manager secrets, SNS topics, EBS and RDS snapshots, ECR repositories, EFS file systems and DynamoDB tables. Each finding shows whether access is public and which actions are allowed, and archive rules hide sharing that is expected.

An internal access analyzer reports which principals inside your organisation can reach the critical resources you select. An unused access analyzer reports roles, access keys and passwords that have not been used, and permissions granted but not used, over a period you choose, with recommendations for removing them, which supports least privilege. The following table summarises the analyzers.

AnalyzerReports
External accessResources reachable by principals outside the zone of trust (account or organisation): S3, IAM roles, KMS keys, Lambda, SQS, Secrets Manager, SNS, EBS and RDS snapshots, ECR, EFS, DynamoDB. Shows public access and allowed actions; archive rules hide expected sharing
Internal accessWhich principals inside the organisation can reach critical resources you select
Unused accessUnused roles, access keys and passwords, and permissions over a chosen period, with removal recommendations

The following diagram shows how an IAM Access Analyzer archive rule separates intended external access from real exposure.

Separating intended sharing from real exposure in IAM Access Analyzer. An archive rule hides findings for roles assumed by the monitoring vendor's account, leaving unexpected external access visible; a query for active public findings lists the highest-priority items, and new ones reach Security Hub and EventBridge.
The scenario is illustrative.
Sort into groups

Which analyzer type?

Exam skills 4.2.5

Choose the Access Analyzer type that answers each question.

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

Policy checks

Access Analyzer also checks policies before they take effect. Policy validation runs as you write a policy in the IAM editor, reporting errors, security warnings, such as overly broad permissions, and suggestions. Custom policy checks answer specific questions and suit CI/CD pipelines. CheckNoNewAccess confirms a changed policy grants nothing new, CheckAccessNotGranted confirms that named sensitive actions are not allowed, and CheckNoPublicAccess confirms a resource policy does not make the resource public. A failing check can block a risky change. Policy generation builds a least-privilege policy from the actions a role actually performed, according to CloudTrail. The following table summarises the features.

FeatureUse
Policy validationErrors, security warnings and suggestions while writing (built into the IAM editor)
Custom policy checksCheckNoNewAccess, CheckAccessNotGranted, CheckNoPublicAccess in CI/CD to block risky changes
Policy generationLeast-privilege policy from a role's actual CloudTrail activity
Match the pairs

Access Analyzer policy features

Exam skills 4.2.5 · 6.2.1

Match each Access Analyzer feature with what it does.

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

Organisation setup

Create organisation-level analyzers from a delegated administrator; findings go to Security Hub and EventBridge.

Worked example

Separating expected sharing from real exposure

An organisation-level analyzer reports dozens of findings for roles that a monitoring vendor assumes. The sharing is intended, so an archive rule hides findings for that vendor's account, leaving any unexpected external access visible:

aws accessanalyzer create-archive-rule --analyzer-name org-external --rule-name monitoring-vendor \
  --filter '{"principal.AWS":{"contains":["999988887777"]},"resourceType":{"eq":["AWS::IAM::Role"]}}'

aws accessanalyzer list-findings-v2 --analyzer-arn $ANALYZER_ARN \
  --filter '{"status":{"eq":["ACTIVE"]},"isPublic":{"eq":["true"]}}' \
  --query 'findings[].{resource:resource,type:resourceType,account:resourceOwnerAccount}'

The second command lists only active findings that grant public access, the highest-priority items. Findings also flow to Security Hub and EventBridge, so a new public resource can trigger an alert within minutes.

Check yourself

Which Access Analyzer check blocks policies that grant new access in CI?

Show answer

The custom policy check CheckNoNewAccess.

Exam Tips

Remember for the exam

  • To find which resources are shared outside the organisation, use an external access analyzer with the organisation as the zone of trust.
  • To remove unused roles, keys and permissions, use unused access findings.
  • To block policies that grant new access in CI, use the custom policy check CheckNoNewAccess.
  • To build a least-privilege policy from real activity, use policy generation.
  • When expected cross-account sharing creates findings, add an archive rule.