The fastest way to give an agent too much AWS is to hand it an access key pair tied to an IAM user with a wide policy. It works on the first try, it never expires, and it is exactly the non-human identity you will regret. The better target is least scope: the agent reaches only the AWS-hosted resources its task needs, for as short a time as possible, and holds no AWS credentials of its own.
This post is about configuring AI agents access to AWS with non-human identity and keeping that identity scoped to the minimum. Least-scope is the organizing principle, and every step below serves it.
Non-human identity on AWS, done right
The trap is treating the agent as an AWS principal at all. The moment the agent holds an IAM user key, or keys that can assume a role, you own a standing non-human identity inside AWS that lives until someone rotates it. The better shape is that the agent never becomes an AWS principal. It reaches the AWS-hosted resources it needs, a database on RDS, a cluster on EKS, an instance through SSM, an object in a bucket, through a gateway that authenticates itself to AWS with its own scoped IAM role. The agent's non-human identity stays an identity-provider identity, not an AWS one.
Configuring least-scope access
- Name the AWS-hosted resources the task needs, not "AWS." A grant to "read objects from this one bucket" or "connect to this one database" is easier to scope than "the agent does AWS things." Naming the specific resource is the foundation of least scope.
- Front those resources with hoop.dev and give the gateway a tightly scoped IAM role. hoop.dev's gateway uses its own IAM role, with
sts:AssumeRoleand RDS IAM auth where configured, to reach the resources it fronts. Write that role's permissions to the exact actions and resource ARNs, for examples3:GetObjecton one bucket, and constrain it with conditions. This is hoop.dev authenticating itself to the infrastructure, not the agent. - Give the agent no AWS credentials. The agent authenticates to hoop.dev with its own identity and connects to the resource through the gateway. It never holds an access key and never assumes an AWS role.
- Scope and time-box the agent's access at the gateway. A policy grants the agent the specific connection the task requires, per session, expiring in minutes. The agent's reach is defined at the boundary, above AWS, not by an IAM policy attached to the agent.
- Close direct network paths to AWS so the gateway is the only route to the resource.
The architectural point is that least scope is not only about the IAM policy. A perfectly scoped role is still standing access if the agent holds credentials that can use it at any time. The requirement is that the agent reaches AWS-hosted infrastructure through something it cannot reconfigure, which authenticates itself to AWS and grants the agent a scoped, per-session, recorded connection. hoop.dev is built to that requirement. The getting-started docs cover fronting an AWS-hosted resource, and the learn pages explain how least-scope access is granted per session.
