Security tools and best practices
Audit who has access with the credential report, last accessed data and IAM Access Analyzer, and follow AWS's IAM best practices.
What it is
Over time, accounts collect unused users, old access keys and policies that give more than anyone needs. IAM has tools to find them:
- The credential report checks every user's credentials in the account.
- Last accessed information (called Access Advisor in the course) shows which services an identity actually uses.
- IAM Access Analyzer finds resources shared outside the account and permissions nobody uses, and helps write least-privilege policies.
Credential report
An account-level CSV file listing every IAM user and the status of their credentials:
- whether the user has a console password, when it was last used and last changed;
- whether MFA is active;
- for each of the user's two access keys: active or not, when it was last rotated and last used, and in which Region and service.
A new report can be generated at most every four hours; asking sooner returns the last one. Download it from IAM → Credential report.
Use it to find: users without MFA, passwords never used, access keys older than 90 days.
Last accessed information (Access Advisor)
A user-, group-, role- or policy-level view that shows which services an identity is allowed to use, and when it last tried to use each one. AWS keeps at least 400 days of this data. Recent activity appears within about four hours, and it counts denied attempts too.
Use it to: remove permissions for services an identity never uses. If a developer's role allows 40 services but they've touched three in a year, trim the policy to those three.
IAM Access Analyzer
Access Analyzer checks permissions in a few ways:
- External access analyzer: finds resources (S3 buckets, KMS keys, IAM roles, SQS queues, Lambda functions and more) that can be reached from outside the zone of trust, meaning the account or the organization. Free.
- Unused access analyzer: finds unused roles, unused access keys and passwords, and unused services and actions in policies. Paid per IAM role or user analyzed each month.
- Internal access analyzer: shows who inside the organization can reach selected critical resources.
- Policy validation: checks a policy being written for errors and risky patterns, such as
"Action": "*"with"Resource": "*". - Policy generation: builds a least-privilege policy from the actions a role really used, read from CloudTrail logs.
IAM best practices
The course's list, updated with AWS's current advice:
- Don't use the root user except for the tasks that need it.
- One person, one identity. Never share users or access keys.
- Prefer IAM Identity Center (with temporary credentials) for people, especially across several accounts. Use IAM users only where they're required.
- Put users in groups and attach permissions to groups, not to individual users.
- Set a strong password policy and require MFA for every human.
- Use roles for AWS services and applications, never access keys.
- Use access keys only when nothing else works, and rotate them.
- Grant least privilege, and audit with the credential report, last accessed data and Access Analyzer.
Updated since the slides
The slides recommend "access keys for programmatic access (CLI / SDK)". AWS now recommends short-term credentials instead: IAM Identity Center or aws login for people, and roles for workloads. IAM Access Analyzer also isn't in the slides, but it's the main IAM auditing tool today.
Exam tips
- "List all users and the status of their passwords, MFA and access keys" → IAM credential report.
- "See which services a user / role has used, to remove unused permissions" → last accessed information (Access Advisor).
- "Find S3 buckets or roles shared with external accounts" → IAM Access Analyzer.
- "Generate a least-privilege policy based on actual activity" → Access Analyzer policy generation.
Common traps
- Mixing up the two old tools. The credential report is account-level (all users, their credentials). Access Advisor is identity-level (one identity, its service usage).
- "The credential report shows what users did." It shows credential status. For actions, use CloudTrail.
Hands-on lab: audit your account
Goal: generate a credential report, check last accessed data, and turn on an external access analyzer.
Free
The credential report, last accessed data and the external access analyzer have no charge. Don't create an unused access analyzer: that one is billed.
Download the credential report
Open IAM → Credential report → Download credentials report and open the CSV. Check that mfa_active is true for the root user (<root_account>) and your admin user.
Check last accessed data
Open IAM → Users → your user → Last accessed. You'll see the services you've touched in the labs so far, and Not accessed in the tracking period for the rest.
Create an external access analyzer
Open IAM → Access analyzer → Analyzer settings → Create analyzer. Choose External access analysis, zone of trust Current account, and create it in us-east-1. After a few minutes, open Findings. A new lab account usually has none.
Expected result: a CSV showing every user's credentials, a list of services you've used, and an analyzer with no (or few) findings.
Clean up: delete the analyzer if you don't want to keep it (Analyzer settings → select → Delete). It's free either way.