Last Access Analysis and Permission Rightsizing
What you'll learn: How to use last-accessed data to systematically reduce cloud IAM permissions and enforce true least privilege.
The Core Problem
Even with the best intentions, cloud identities often accumulate permissions over time—resources are added, experiments run, and access granted "just in case." The result? Service accounts and roles with far more permissions than they actually use. This violates least privilege and expands your attack surface.
Last access analysis solves this by tracking when each permission was last exercised, giving you data-driven evidence to safely remove unused permissions.
How Last Access Data Works
Cloud providers log IAM activity and generate reports showing:
- Which permissions a role or service account has
- When each permission was last used (or "never")
- Age thresholds (e.g., unused for 90+ days)
Think of it like pruning a garden: you keep the paths people actually walk and remove overgrown trails nobody uses. Last access data shows you which paths are abandoned.
Permission Rightsizing in Practice
- Review last accessed data for a role (e.g., using Access Analyzer findings from lesson 1749)
- Identify unused permissions (never accessed or stale beyond 90 days)
- Create a trimmed policy removing those permissions
- Test in non-production before applying broadly
- Monitor for access denied errors indicating over-correction
This isn't a one-time task—it's continuous hygiene. Regularly review and rightsize as workload needs evolve.
Real-World Example
A service account might have s3:* (all S3 actions), but last access data reveals it only ever uses s3:GetObject and s3:PutObject. You rightsize to those two actions, dramatically reducing blast radius if those credentials leak.
Key Takeaway: Last access analysis transforms permission management from guesswork into evidence-based security, enabling continuous rightsizing and true least privilege enforcement.