"Give admin now, tighten it later." Everyone means it, and later almost never comes. The broad permissions stay, the project moves on, and one day a set of credentials leaks and the attacker inherits everything nobody got around to removing. Least privilege is the habit that prevents this: every identity gets only the access its job needs.
What least privilege means
In IAM terms, least privilege is granting only the permissions required to perform a task. A good policy answers three questions narrowly:
- Which actions?
s3:GetObject, nots3:*. - On which resources? One bucket's ARN, not
*. - Under which conditions? For example, only from your network or only with MFA.
It applies to everything that has permissions: people, applications, pipelines and automation.
Why it matters: blast radius
Assume that some credential will eventually be exposed, through a leaked key, a compromised laptop or a bug in an application. What happens next depends entirely on what that identity was allowed to do.
- A role that can only read one bucket can leak one bucket.
- A role with administrator access can delete backups, create new users, mine cryptocurrency on your bill, or lock you out.
Least privilege doesn't stop the incident. It decides how big it gets.
How to get there without guessing
Nobody writes a perfect policy on the first try, and AWS doesn't expect you to. A practical path:
- Start with an AWS managed policy that roughly fits the job. Managed policies are written for all customers, so they're usually broader than you need, but they get you working.
- Observe what the workload really uses.
- Replace the managed policy with a customer managed policy that lists only those actions and resources.
IAM Access Analyzer does much of the observing for you:
- Policy generation reads the activity recorded in AWS CloudTrail for a role or user and produces a policy based on the actions it actually called.
- Unused access analysis flags roles, access keys, passwords and permissions that haven't been used. This is a paid Access Analyzer feature, so check the pricing before enabling it everywhere.
- Policy validation checks policies against AWS best practices as you write them.
Keep reviewing
Permissions drift. Projects end, people change teams, features are removed. IAM's last accessed information shows, for each user or role, which services it has used and when. A service that was never accessed is a permission you can remove.
Two more tools help at scale: permissions boundaries, which cap what a role can ever be granted when you let developers create their own roles, and service control policies in AWS Organizations, which set limits for whole accounts.
A common mistake is treating least privilege as a one-time project. It works better as a routine: review the unused access findings on a schedule, and remove what's idle.
Where AI fits
AI agents raise the stakes. A traditional application does what its code says. An agent chooses its own next step based on a prompt, the documents it reads and the tools it has, and it can be tricked or simply wrong. Whatever the instructions say, the real limit on an agent is the IAM role it runs with.
So scope the agent's role like any workload, and then a little tighter:
- only the few actions its tools need
- only the specific resources: this bucket, this table, these models
- no permission to change IAM, and no broad wildcards
If the agent only needs to read, don't let it write. Then a bad prompt costs a wrong answer, not a deleted database.
Quick recap
- Grant only what the task needs: specific actions, resources and conditions.
- Start broad, then narrow using IAM Access Analyzer and last accessed information.
- Scope AI agents tightly: the role is the real limit on what they can do.