Research · AI security · AWS · AI agents
AWS STS GetScopedCredentials: smaller AWS credentials for AI agents
What AWS STS GetScopedCredentials does, how it differs from AssumeRole with a session policy, its limits, and how to use it to give AI agents less access.
Short answer
AWS announced STS GetScopedCredentials on 19 November 2026. You call it with temporary credentials you already hold and get back a new set that can do less, expire sooner, or both, while the identity stays the same. The new permissions are the overlap of your session and a scope down policy of up to 2,048 characters, so permissions and lifetime can only shrink. Give each AI agent and sub-agent its own scoped set instead of your own session. It limits what a hijacked agent can reach. It does not stop the hijack.
AWS has a new STS call, GetScopedCredentials, announced on 19 November 2026. You call it with the temporary credentials you already have, and it returns a second set that can do less, expires sooner, or both. AWS says the point is to “give your agents, sub agents and workloads their own set of credentials” with only the permissions they need. (AWS announcement)
If you run AI agents against an AWS account, this is the cheapest least-privilege control you’ve been given in a while. It needs no new role and no change to how you manage identities.
What it does
You pass two optional things, and at least one of them is required: a scope down policy and a shorter duration.
The scope down policy is an ordinary IAM policy document. The IAM user guide says the result is the intersection of the calling session’s effective permissions, that policy and any scope down policies from earlier calls. It is blunt about the direction: “The scope down policy can only restrict permissions further and cannot grant new permissions.”
Duration works the same way. You can ask for anything from 1 second up, but never more than the calling session has left. Leave it out and the new credentials inherit the caller’s expiry.
What doesn’t change is who you are. The principal ARN, role session name, session tags and source identity all carry over.
How access narrows from you to a sub-agent
What was missing before
You could already hand out weaker credentials with AssumeRole and a session policy. The user guide names two differences.
With AssumeRole, session policies are replaced when you assume again. With GetScopedCredentials, each call’s policy “is added as an independent layer that intersects with all prior layers. Prior restrictions are never removed.” And where role chaining caps a session at one hour, this call does not impose that cap.
| AssumeRole + session policy | GetScopedCredentials | |
|---|---|---|
| Who can call | IAM user, or a role with temporary credentials | Temporary credentials only |
| Earlier restrictions | Replaced on re-assume | Kept, each call adds a layer |
| Lifetime | 15 minutes minimum, 1 hour default | 1 second minimum, the caller’s remaining time at most |
| MFA support | Yes | No |
Sources: AWS, Compare AWS STS credentials and the user guide page above.
The limits
The limits at launch
A few more from the CLI reference and the user guide:
- It only accepts temporary credentials. “You cannot call it with IAM user credentials or root credentials.” An IAM user has to call
GetSessionTokenfirst. - It isn’t available on the STS global endpoint. Use a regional one.
- The caller needs
sts:GetScopedCredentialsallowed. For an agent to scope down again, every earlier scope down policy has to allow that action too. - Some services don’t accept these credentials. AWS lists Amazon MemoryDB, AWS Quick, Amazon CloudSearch, Neptune Database engine versions earlier than 1.2.0.0 and some older OpenSearch Service releases.
- KMS is a soft spot. AWS says a policy that removes KMS permissions “might not prevent access to data that the calling session’s role accessed recently.”
How to use it for an agent
Say your session can do a lot, and the agent’s job is to read reports from one bucket. Save this as policy.json:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::amzn-s3-demo-bucket/reports/*"
}]
}
Then ask for fifteen minutes of that:
aws sts get-scoped-credentials \
--policy file://policy.json \
--duration-seconds 900 \
--scoped-session-description "report-agent" \
--region us-east-1
The reply holds an access key, a secret key, a session token and an expiry, plus a ScopedPoliciesCount that tells you how many layers the session now carries. Start the agent with those three values and nothing else.
This example is ours, built from the documented options, and we haven’t run it. Classmethod ran a similar test on AWS CLI 2.41.2 the day after launch. Their scoped credentials listed S3 buckets as allowed, and an EC2 call outside the policy was refused. When they asked for 3,600 seconds from a session with about 900 left, the call failed with InsufficientSessionLifetime.
If you’d sooner remove a few dangerous actions than list every allowed one, the AWS Security Blog shows a NotAction policy that allows everything except IAM, Organizations and account actions, sts:AssumeRole* and a short list of destructive actions. I’d keep sts:AssumeRole* on that list every time, so an agent can’t trade its scoped set for another role’s.
What it doesn’t fix
The identity is shared. In CloudTrail, calls made with scoped credentials show your session’s ARN. What differs is the access key ID, and Classmethod matched agent calls to the issuing event that way. Set --scoped-session-description on every call, because it’s logged with the request and gives you a label a person can read.
You can’t revoke the scoped set alone. The user guide says you can’t use aws:TokenIssueTime to revoke scoped down credentials separately from the parent session. Killing the agent’s access means killing the parent’s, so short durations matter more than usual.
The agent mustn’t see the parent credentials. If your own session sits in the same environment variables, profile or instance metadata the agent can read, the scoped set is decoration.
And none of this is a defense against prompt injection. An agent that reads a poisoned document will still follow it. What changes is the damage: a hijacked agent holding read access to one prefix for fifteen minutes is a much smaller incident than one holding your admin session for twelve hours. That is the “give the agent less” rule from our LLM security guide, now with an AWS call behind it.
What to do this week
- Update the AWS CLI and SDKs, then find every place an agent, a coding assistant or a CI job inherits a human’s or a role’s full session.
- Put a credential broker in front of those: a few lines that call
GetScopedCredentialswith a per-task policy and hand over only the result. - Cap the lifetime centrally. AWS documents a service control policy that denies
sts:GetScopedCredentialswhensts:DurationSecondsis above 900. - Add
GetScopedCredentialsto your CloudTrail detections. Each event records the policy text, the description and the new access key ID.
AWS says the API is available in all commercial Regions, the GovCloud (US) Regions, the European Sovereign Cloud Regions in Germany and the China Regions.
Sources (all checked 23 November 2026)
- AWS What’s New, “AWS STS announces GetScopedCredentials to scope down permissions at runtime”, 19 Nov 2026: aws.amazon.com
- AWS Security Blog, “Scope down permissions of existing sessions using AWS STS GetScopedCredentials”, 20 Nov 2026: aws.amazon.com/blogs/security
- IAM User Guide, “Permissions for GetScopedCredentials”: docs.aws.amazon.com
- IAM User Guide, “Compare AWS STS credentials”: docs.aws.amazon.com
- AWS CLI Command Reference,
get-scoped-credentials: docs.aws.amazon.com/cli - Classmethod, “Trying Out AWS STS GetScopedCredentials to Narrow Down Permissions and Session Duration of Temporary Credentials”, 20 Nov 2026: dev.classmethod.jp