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.
| Analyzer | Reports |
|---|---|
| External access | Resources 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 access | Which principals inside the organisation can reach critical resources you select |
| Unused access | Unused 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.

Which analyzer type?
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.
| Feature | Use |
|---|---|
| Policy validation | Errors, security warnings and suggestions while writing (built into the IAM editor) |
| Custom policy checks | CheckNoNewAccess, CheckAccessNotGranted, CheckNoPublicAccess in CI/CD to block risky changes |
| Policy generation | Least-privilege policy from a role's actual CloudTrail activity |
Access Analyzer policy features
Organisation setup
Create organisation-level analyzers from a delegated administrator; findings go to Security Hub and EventBridge.
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.
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.