Sub topic 4
Creating analyzers and choosing a tracking period
This chapter assumes you know IAM users, roles and policies, can read JSON policy documents, and can run the AWS CLI against an account. You also need a basic idea of AWS Organizations. Here you create the analyzers that produce findings. The following chapters cover how to read those findings.
What an analyzer is
An analyzer is a regional resource that scans your account (or organization) and produces findings. Each analyzer has one type, and the type decides what it looks for. You create analyzers per Region. An external access analyzer only sees resources in the Region where it lives, so you need one in every Region you use. Unused access analyzers read IAM data, which is global, so one analyzer covers the whole account.
| Type value | Zone of trust | What it reports |
|---|---|---|
| `ACCOUNT` | Current account | Resources shared outside the account |
| `ORGANIZATION` | Your organization | Resources shared outside the organization |
| `ACCOUNT_UNUSED_ACCESS` | Current account | Unused roles, users, keys, passwords and permissions |
| `ORGANIZATION_UNUSED_ACCESS` | Your organization | The same, across all member accounts |
Create one analyzer of each kind
The first command creates an external access analyzer. The second creates an unused access analyzer and sets its tracking period.
# 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}}'Each call returns the analyzer ARN. Keep it, because later commands such as list-findings-v2 need it. To confirm both analyzers exist, run aws accessanalyzer list-analyzers.
Choosing a tracking period
The unusedAccessAge value is the number of days without activity before Access Analyzer reports something as unused. It accepts values from 1 to 365 days, and 90 is the usual starting point.
Pick the value by asking how often legitimate access happens:
- A short period, such as 30 days, finds more candidates and clears stale access quickly. It also flags roles for quarterly jobs, which causes false positives.
- A long period, such as 180 or 365 days, covers annual processes like year-end reporting. It also leaves unused access in place for longer.
- 90 days covers most monthly and quarterly workloads.
Roles used only in disaster recovery or for annual tasks can look unused under any short period. Treat those as expected, and handle them with archive rules instead of lengthening the period for everything.
Organization analyzers
To analyze every member account, use an organization type. You create it from the management account or from a delegated administrator account for Access Analyzer.
aws accessanalyzer create-analyzer \
--analyzer-name org-unused \
--type ORGANIZATION_UNUSED_ACCESS \
--configuration '{"unusedAccess":{"unusedAccessAge":90}}'An organization analyzer needs trusted access for Access Analyzer in AWS Organizations. The console enables it when you create the analyzer. With the CLI, enable it first with aws organizations enable-aws-service-access --service-principal access-analyzer.amazonaws.com.
Common errors
- Passing
unusedAccessAgeto an external access analyzer. The setting only applies to unused access types. The call fails or the value is ignored. - Creating only one external analyzer. Resources in other Regions go unreported.
- Creating an organization analyzer from a member account. Only the management account or the delegated administrator can do it.
- Expecting findings immediately. The first scan can take some time, so an empty findings list right after creation is normal.
Exercise
Your finance team runs a role only once a year for year-end reporting. With a 90-day tracking period, the role appears as unused. What are two ways to handle it, and which do you prefer?
Show answer
You can raise unusedAccessAge (up to 365 days) so the role is not flagged, or keep 90 days and archive the finding with an archive rule for that role. Archiving is better, because raising the period for the whole analyzer delays detection of every other unused role and credential.