Finding Unintended and Unused Access with IAM Access Analyzer
This lesson explains how IAM Access Analyzer uses automated reasoning to show who can reach your resources from outside, which permissions go unused, and whether a policy is correct before you deploy it.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish external access, unused access and policy validation findings.
- Describe how Access Analyzer covers a whole organisation.
- Identify related tools such as the IAM policy simulator.
Finding types
IAM Access Analyzer helps find and remove access that should not exist. External access findings list resources, such as S3 buckets, KMS keys, IAM roles, SQS queues, Lambda functions and secrets, whose policies allow principals outside a zone of trust, which is the account or the whole organisation. A bucket shared with an unknown account, for example, appears as a finding. Internal access findings show which principals inside the organisation can reach chosen critical resources. Unused access findings list roles, access keys, passwords and permissions that have not been used for a chosen period, so they can be removed.
Access Analyzer also helps when writing policies. Policy validation reports errors, security warnings and suggestions as a policy is written. Custom policy checks test whether a policy grants new access, or particular sensitive actions, and can run in a CI/CD pipeline to stop a risky change before deployment. Policy generation builds a least-privilege policy from the actions a role actually performed, as recorded in CloudTrail. The following table summarises the capabilities.
| Capability | What it shows |
|---|---|
| External access findings | Resources such as S3 buckets, KMS keys, IAM roles, SQS queues, Lambda functions and secrets shared with principals outside the zone of trust (the account or organisation) |
| Internal access findings | Which principals inside the organisation can reach critical resources |
| Unused access findings | Unused roles, access keys, passwords and permissions |
| Policy validation | Errors, security warnings and best-practice suggestions as policies are written |
| Custom policy checks | Whether a policy grants new access or particular actions, usable in CI/CD before deployment |
| Policy generation | A least-privilege policy built from a role's CloudTrail activity |
Access Analyzer capabilities
Using it in practice
IAM Access Analyzer is most effective when it covers the whole organisation. An analyzer is created with the organisation as its zone of trust, ideally from a delegated administrator account, so that access granted to any principal outside the organisation, in any member account, is reported.
Some external access is intended, such as a bucket shared with a partner, and archive rules suppress those expected findings so that new, unexpected ones stand out. Findings are sent to AWS Security Hub and Amazon EventBridge, where they can trigger notifications or automated responses. For Amazon S3, the Access Analyzer for S3 view in the S3 console flags buckets that are public or shared with other accounts.
Related tools
Three other IAM tools help review and test permissions. The IAM policy simulator evaluates a set of policies against a specific action and resource and reports whether it would be allowed and which statement decided it, without making the call, which is useful for testing a new policy or explaining an access denied error. Last accessed information shows when each service, and for some services each action, was last used by a user or role, so unused permissions can be removed with confidence. The credential report lists every IAM user with the status and age of their passwords, access keys and MFA devices, for audits such as finding keys older than 90 days. The following table summarises the tools.
| Tool | Use |
|---|---|
| IAM policy simulator | Test whether given policies allow a specific action |
| Last accessed information | See when each service was last used by an identity |
| Credential report | Audit users' passwords and access keys |
Which IAM tool?
Finding what is shared outside the company
Before an audit, a company with 40 accounts must list every resource accessible from outside its organisation and remove unused permissions.
| Task | Access Analyzer capability |
|---|---|
| Find buckets, KMS keys, roles and queues shared outside the organisation | An organisation-level analyzer's external access findings |
| Mark the intentional partner share as expected | An archive rule |
| Find roles and keys unused for 90 days | Unused access findings |
| Replace a broad role policy with what is actually used | Policy generation from CloudTrail activity |
| Stop new public access being deployed | Custom policy checks in the CI/CD pipeline |
Findings flow into Security Hub, so the security team tracks them alongside other issues.
How does IAM Access Analyzer help when writing a least-privilege policy for a role?
Show answer
It can generate a policy from the role's activity in CloudTrail, containing only the actions the role actually used, and it validates policies for errors and security warnings.
Exam Tips
Remember for the exam
- To find S3 buckets or KMS keys shared with external accounts, use IAM Access Analyzer.
- To generate a least-privilege policy from actual usage, use Access Analyzer policy generation.
- To find unused roles, keys and permissions across accounts, use Access Analyzer unused access findings.
- To block policies that grant new public access before deployment, use custom policy checks in the pipeline.
- Set the organisation as the zone of trust to see access from outside the organisation.