Sub topic 1
What IAM Access Analyzer does and why it matters
IAM Access Analyzer is an AWS service that looks for two kinds of risk in your accounts. The first is access that reaches outside your account or organization. The second is access that exists but nobody uses. This chapter explains what the service checks, how it reaches its conclusions, and where it fits among other AWS security tools. Later chapters cover each analyzer type and its findings in detail.
Prerequisites
This chapter assumes you already know the following:
- Basic IAM concepts: users, roles, identity-based policies and resource-based policies.
- How to read a JSON policy document, including
Effect,Principal,Action,ResourceandCondition. - How to run commands with the AWS CLI or find a service in the AWS console.
- What an AWS account is, and that AWS Organizations groups accounts under one management account.
You do not need prior experience with Access Analyzer. To run the CLI examples you need permission to call accessanalyzer:* actions and, for creating analyzers, the ability to create a service-linked role.
The problem it solves
Permissions in AWS grow in two ways that are hard to notice from the outside.
- Resources get shared. A bucket policy, KMS key policy, role trust policy or queue policy can name a principal in another account, or name
*. Each of these is a deliberate grant on paper, but nobody reviews the whole set. One careless"Principal": "*"can expose data to the internet. - Permissions pile up. A role is created for a project and gets broad permissions "to make it work." The project ends, or the code only ever calls three of the fifty allowed actions. The role, its access keys and its unused permissions remain as attack surface.
Reviewing every policy by hand does not scale. Access Analyzer does this review for you and reports the results as findings. A finding is a record that says what resource or identity is involved, what access exists, and why the service flagged it.
The two kinds of analysis
Access Analyzer has two separate analysis modes. They answer different questions and use different mechanisms.
| Question | Analyzer type | What it examines | Result |
|---|---|---|---|
| Who outside my boundary can reach this resource? | External access | Resource-based policies, trust policies, ACLs, access points and similar sharing settings | A finding per resource that grants outside access |
| What access do I grant that nobody uses? | Unused access | IAM roles, users, access keys, passwords, and the permissions attached to them | A finding per unused role, credential or permission |
The term analyzer refers to the configured resource in your account that performs one of these analyses. You create an analyzer, and it produces findings.
External access analysis
External access analysis uses automated reasoning, a branch of mathematical logic. The service does not send test requests to your resources. It converts the relevant policies into logical formulas and checks whether any principal outside your boundary could be allowed to act. Because it evaluates policy logic, it catches access that exists on paper even if no one has ever used it.
Here is a bucket policy that an external access analyzer reports:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowEveryoneRead",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-bucket/*"
}
]
}The Principal of * lets any caller read objects. The analyzer produces a public access finding for example-bucket. The finding names the resource, the external principal (here, everyone), the allowed actions and the policy statement that grants them. It also records any Condition that narrows the access, which is why conditions matter when you interpret a finding. A condition such as aws:SourceAccount or aws:PrincipalOrgID can change a finding from public to limited to one account or organization, or remove it entirely.
Unused access analysis
Unused access analysis answers a different question. It looks at how roles and users have actually behaved and compares that with what they are allowed to do. It reports:
- Roles with no activity within the tracking period.
- IAM user access keys and passwords that have not been used within the tracking period.
- Permissions, at the service level and the action level, that are granted but not used.
The tracking period is the number of days without use before something counts as unused. The default is 90 days, and you can set it between 1 and 365 days. A short period finds more candidates but also flags roles that run only quarterly or annually, such as a year-end reporting job. Pick the period with your slowest legitimate workload in mind.
How an analyzer is scoped
Every analyzer has a zone of trust: the boundary that decides what counts as "inside" and "outside." You pick it when you create the analyzer.
- With an account zone of trust, only principals in that account are trusted. Access from any other account is external.
- With an organization zone of trust, all accounts in your AWS Organizations organization are trusted. Access from another account in the same organization is not reported, but access from outside it is.
An analyzer is a Regional resource, and external access findings come from resources in the Region where the analyzer lives. For global concepts such as IAM roles, one analyzer is enough, but for resources such as S3 buckets, KMS keys or SQS queues you need an analyzer in each Region you use. The next chapters cover the zone of trust and analyzer types in more detail. For now it is enough to see how one analyzer is created for each mode:
# External access analyzer for the current account
aws accessanalyzer create-analyzer \
--analyzer-name account-external \
--type ACCOUNT
# Unused access analyzer that flags access unused for 90 days
aws accessanalyzer create-analyzer \
--analyzer-name account-unused \
--type ACCOUNT_UNUSED_ACCESS \
--configuration '{"unusedAccess":{"unusedAccessAge":90}}'The --type value selects both the mode and the zone of trust. ACCOUNT and ACCOUNT_UNUSED_ACCESS use the account as the boundary. The organization variants are ORGANIZATION and ORGANIZATION_UNUSED_ACCESS, and you create them from the management account or a delegated administrator.
How the pieces connect
Findings are the shared output of both modes. After a finding appears, you decide what it means. You can archive it if the access is intended, remediate it if it is not, or send it to a workflow through Amazon EventBridge. Later chapters cover each of these steps.
What Access Analyzer does not do
Knowing the limits prevents wrong assumptions.
- It is not real-time. Findings are generated when you create an analyzer and then refreshed on a schedule. A new policy change normally shows up within minutes to a day, and unused access data is updated periodically. Do not treat it as a block on deployment. For that, use policy checks in your pipeline (covered in a later chapter).
- It does not change anything by itself. It reports. Removing a role or trimming a policy is your decision, or the decision of automation you build.
- It covers specific resource types. External access analysis supports a defined list of types, such as S3 buckets, IAM roles, KMS keys, Lambda functions, SQS queues, SNS topics, Secrets Manager secrets, EBS snapshots, ECR repositories and EFS file systems. A resource type outside the list is not analyzed, so a clean report does not mean "no sharing anywhere."
- It does not detect misuse. An unused permission is not necessarily a risky one, and a used permission is not necessarily appropriate. Use Amazon GuardDuty and CloudTrail for threat detection.
- It cannot know your intent. A public bucket for a static website produces the same finding as an accidental one. A human or an archive rule has to supply the intent.
Where it fits among related services
| Service | Main question | How it differs from Access Analyzer |
|---|---|---|
| IAM credential report | Which users have old passwords or keys? | Lists credential age for users only, and does not cover roles, permissions or resource sharing |
| IAM last accessed information | When was this service or action last used? | Raw data per identity. Access Analyzer builds on this and turns it into findings with recommendations |
| AWS Config | Does this resource match my rules? | Evaluates configuration against rules you write. Access Analyzer reasons about who can reach a resource |
| Amazon GuardDuty | Is something suspicious happening? | Detects threats from activity. Access Analyzer finds standing access |
| AWS Security Hub | What is the overall security posture? | Aggregates findings. Access Analyzer findings can flow into it |
Cost model
The pieces are billed differently, and this affects how you roll the service out.
- External access analysis, and policy validation with the
validate-policyAPI, have no charge. - Unused access analysis is billed per IAM role and user analyzed per month.
- Custom policy checks, such as
check-no-new-access, are billed per API call.
Check the current pricing page before enabling unused access analysis across a large organization, since charges scale with the number of identities.
Why it matters in practice
Three outcomes justify the setup effort.
- Fewer accidental exposures. A public-access finding on a bucket or a cross-account grant on a KMS key surfaces a mistake before an attacker or an audit does.
- Smaller blast radius. If a role with unused administrator permissions is compromised, the attacker gets only what the role can do. Removing unused permissions limits that.
- Cleaner audits. Findings give you a record of who can reach what, and of what you decided about each case.
Summary
Access Analyzer provides two views of access: who outside your boundary can reach your resources, and which granted access is never used. Both views produce findings that you triage. The analyzer's zone of trust and tracking period determine what is reported. The service reports and does not enforce, so you pair it with archive rules, remediation and automation. The next chapter defines the zone of trust in detail.
Exercise
A bucket policy in account 111122223333 allows s3:GetObject to "Principal": {"AWS": "444455556666"}. You have an external access analyzer with an organization zone of trust, and account 444455556666 is a member of the same organization. Does the analyzer produce a finding for this bucket? What would change if the analyzer used an account zone of trust?
Show answer
With the organization zone of trust, no finding is produced, because account 444455556666 is inside the trusted boundary. With an account zone of trust, the analyzer treats 444455556666 as external and reports a finding for the bucket, naming that account as the external principal and s3:GetObject as the allowed action.
Exercise
A role is used once a year to run a compliance export. You set the unused access tracking period to 90 days. What will happen, and what should you do?
Show answer
The role will be reported as unused for most of the year, because 90 days pass between runs. Deleting it would break the annual job. Either raise the tracking period (up to 365 days), or archive the finding for that role because the access is intended.