Sub topic 14
Running Access Analyzer across an organization
This chapter assumes you can create an account-level analyzer and read its findings. It also assumes you know the basics of AWS Organizations: a management account, member accounts, organizational units (OUs) and service control policies. You should also be comfortable with archive rules and the finding lifecycle from earlier chapters. Here you will scale the same ideas to many accounts, decide where the analyzer should live, and keep the cost under control.
Why account-level analyzers stop being enough
An account-level analyzer uses the single account as its zone of trust. Any resource shared with another account in your own organization is reported as external access. With 50 accounts, that means a lot of findings that describe normal internal sharing. You would also have to create and watch 50 analyzers.
An organization analyzer changes the zone of trust to the whole organization. Access from a principal inside the organization is not reported. Only access from outside the organization produces a finding. You get one analyzer and one findings list for every member account.
The unused access analyzer works the same way. The account-level type analyzes one account. The organization type analyzes the roles and users in every member account and reports them in one place.
| Analyzer type value | Zone of trust | Reports |
|---|---|---|
| `ACCOUNT` | One account | External access |
| `ORGANIZATION` | The whole organization | External access |
| `ACCOUNT_UNUSED_ACCESS` | One account | Unused roles, users, credentials and permissions |
| `ORGANIZATION_UNUSED_ACCESS` | The whole organization | Unused roles, users, credentials and permissions |
Where the analyzer should live
You can create organization analyzers in the management account. For ongoing work, a delegated administrator account is usually the better choice, for three reasons:
- The management account should hold as few workloads and as few day-to-day users as possible.
- A delegated administrator lets your security team read and manage findings without access to the management account.
- The delegated administrator account can be a dedicated security tooling account, next to your other security services.
The delegated administrator sees findings for all member accounts. Member accounts do not see findings from the organization analyzer. They can still create their own account-level analyzers, and those findings stay in the member account.
The diagram shows the flow of data. Analyzers in the delegated administrator account read configuration from the member accounts, and findings flow to one place.
Setting up the delegated administrator
Run the first two commands from the management account. The first enables trusted access, so that Access Analyzer can work with the organization. The second registers the security account as delegated administrator.
aws organizations enable-aws-service-access \
--service-principal access-analyzer.amazonaws.com
aws organizations register-delegated-administrator \
--account-id 111122223333 \
--service-principal access-analyzer.amazonaws.comAccess Analyzer uses a service-linked role named AWSServiceRoleForAccessAnalyzer. It is created in each account when needed. The identity that creates the first organization analyzer needs permission to create that role (iam:CreateServiceLinkedRole) and to read organization data. The analyzer also needs the Organizations read permissions it gets through the service-linked role.
Now switch to the delegated administrator account and create the analyzers.
aws accessanalyzer create-analyzer \
--analyzer-name org-external \
--type ORGANIZATION
aws accessanalyzer create-analyzer \
--analyzer-name org-unused \
--type ORGANIZATION_UNUSED_ACCESS \
--configuration '{"unusedAccess":{"unusedAccessAge":90}}'If you created an analyzer in the management account first, check aws accessanalyzer list-analyzers there before you create a second one. Quotas limit how many analyzers of each type you can have per Region, so a duplicate can fail with a quota or conflict error. Check Service Quotas for the current limits.
Regions: where analyzers must exist
Analyzers are Regional, but the two kinds behave differently.
- External access. Resources such as S3 buckets, KMS keys and SQS queues are Regional (S3 buckets belong to the Region where you created them). An analyzer only sees resources in its own Region. To cover every Region you use, create an analyzer in each of them. A Region with no analyzer is a blind spot.
- Unused access. IAM roles, users and policies are global. One unused access analyzer in a single Region of your choice covers the IAM entities in all of the accounts. Creating the same analyzer in more Regions would only add cost and duplicate findings.
This loop creates an external access organization analyzer in each Region listed. Adjust the list to the Regions your organization allows.
for region in us-east-1 us-west-2 eu-west-1; do
aws accessanalyzer create-analyzer \
--region "$region" \
--analyzer-name org-external \
--type ORGANIZATION
doneRerunning the loop fails with a conflict error for Regions where the analyzer already exists. That is harmless, but a script that stops on the first error needs to handle it.
Reading findings from many accounts
Each finding carries the account that owns the resource (resourceOwnerAccount). That is the field to use when you triage in a large organization. This command lists active findings for a single member account.
aws accessanalyzer list-findings-v2 \
--analyzer-arn arn:aws:access-analyzer:us-east-1:111122223333:analyzer/org-unused \
--filter '{"status":{"eq":["ACTIVE"]},"resourceOwnerAccount":{"eq":["444455556666"]}}' \
--query 'findings[].[findingType,resource,status]' \
--output tableUse the same filter key in archive rules. A rule for an organization analyzer can match on account, resource or finding attributes, so you can write one rule that covers a known sharing pattern across many accounts.
aws accessanalyzer create-archive-rule \
--analyzer-name org-external \
--rule-name sandbox-accounts \
--filter '{"resourceOwnerAccount":{"eq":["555566667777","666677778888"]}}'Be careful with broad rules. An archive rule that matches a whole account hides every future finding for that account, including a new public bucket. Prefer rules that name a specific resource, or a specific resource and principal.
Controlling cost with exclusions
The cost model is different for each analyzer kind:
- External access analyzers have no charge.
- Unused access analyzers are billed per IAM role and user analyzed each month. In an organization with thousands of roles this is the part of the bill that grows.
- Custom policy checks are billed per API call, which matters if you run them in every pull request.
Check the current Access Analyzer pricing page for the rates. To limit unused access cost, exclude accounts or resources that do not need analysis. An organization unused access analyzer accepts an analysis rule with exclusions by account ID or by resource tag.
aws accessanalyzer create-analyzer \
--analyzer-name org-unused \
--type ORGANIZATION_UNUSED_ACCESS \
--configuration '{
"unusedAccess": {
"unusedAccessAge": 90,
"analysisRule": {
"exclusions": [
{"accountIds": ["555566667777"]},
{"resourceTags": [{"environment": "sandbox"}]}
]
}
}
}'Exclude carefully. An excluded account never produces unused access findings, so an old, forgotten role there is never reported. A tag-based exclusion is only as reliable as your tagging, since anyone who can tag a role can remove it from analysis. Restrict who can set that tag, for example with a service control policy or a tag policy.
Routing findings from many accounts
Findings from an organization analyzer are published to the default EventBridge event bus of the delegated administrator account, in the Region of the analyzer. The event pattern is the one from the automation chapter.
{
"source": ["aws.access-analyzer"],
"detail-type": ["Access Analyzer Finding"]
}Because every finding arrives in one account and Region per analyzer, one rule covers the whole organization. The event detail includes the owning account. A notification target should include it, so the responder knows which account to open. If you have analyzers in several Regions, either create the rule in each Region or forward events to one central bus.
Common mistakes
- Remediating from the wrong place. The delegated administrator sees findings, but it cannot change roles in member accounts. Fixing a finding still needs access to the member account, through a cross-account role or your deployment pipeline.
- Analyzing only the home Region. External access in a Region without an analyzer produces no findings and no warning.
- Expecting a new account to appear instantly. A new member account is added to the zone of trust and analysis after Access Analyzer scans it. Findings can take some time to appear.
- Treating the organization as the only trust boundary. Organization-wide trust means an account in your organization that nobody monitors is trusted by every other account. Archive rules and SCPs still need to reflect which sharing is intended.
Exercise
Your organization has 80 accounts and uses three Regions. How many external access analyzers and how many unused access analyzers do you create in the delegated administrator account, and why?
Show answer
Three organization external access analyzers (type ORGANIZATION), one per Region, because external access resources are Regional and an analyzer only sees resources in its own Region. One organization unused access analyzer (type ORGANIZATIONUNUSEDACCESS) in a single Region, because IAM roles and users are global. A second unused access analyzer would add cost and duplicate findings.
Exercise
A security engineer writes an archive rule on the organization analyzer that matches every finding with resourceOwnerAccount equal to a sandbox account, to quiet noisy findings. What is the risk, and what would you do instead?
Show answer
The rule archives every future finding for that account, including a newly public bucket or a role trusted by an unknown external account. Instead, write rules that match a specific resource ARN (and, where possible, the specific external principal), and review archived findings periodically.