# 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.

- Published: 2026-11-23
- Topics: AI security, AWS, AI agents
- Canonical page: https://thesecguy.com/notes/aws-sts-getscopedcredentials-ai-agents/
- Publisher: The Sec Guy (https://thesecguy.com)

**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](https://aws.amazon.com/about-aws/whats-new/2026/11/sts-getscopedcredentials/))

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](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getscopedcredentials.html) 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.

<figure class="fig">
<p class="fig-k">How access narrows from you to a sub-agent</p>
<div class="flow">
<div class="node"><b>1. Your session</b><span>Temporary credentials from an assumed role</span><div class="chips"><i class="chip">full role permissions</i></div></div>
<div class="node"><b>2. Scope down</b><span>One STS call with a policy, a shorter duration, or both</span><div class="chips"><i class="chip">layer 1</i></div></div>
<div class="node"><b>3. Agent</b><span>Gets only the scoped set. Same identity, fewer permissions</span><div class="chips"><i class="chip">overlap only</i></div></div>
<div class="node"><b>4. Scope down again</b><span>The agent narrows its own set for a sub-agent</span><div class="chips"><i class="chip">layer 2</i></div></div>
<div class="node"><b>5. Sub-agent</b><span>Can never hold more than its parent, or outlive it</span><div class="chips"><i class="chip">narrowest</i></div></div>
</div>
<figcaption>Our layout of the behavior described in the AWS IAM user guide and the AWS Security Blog.</figcaption>
</figure>

## 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](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_sts-comparison.html) and the user guide page above.

## The limits

<figure class="fig">
<p class="fig-k">The limits at launch</p>
<div class="tiles">
<div class="tile hot"><b>2,048</b><span>characters, the most one scope down policy can hold</span></div>
<div class="tile"><b>3</b><span>policy layers per session</span><small>duration-only calls don't count</small></div>
<div class="tile"><b>1 s</b><span>shortest lifetime you can ask for</span></div>
<div class="tile"><b>200</b><span>requests per second, per account, per Region</span></div>
</div>
<figcaption>Sources: AWS CLI reference for get-scoped-credentials and the AWS Security Blog, 20 November 2026.</figcaption>
</figure>

A few more from the [CLI reference](https://docs.aws.amazon.com/cli/latest/reference/sts/get-scoped-credentials.html) 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 `GetSessionToken` first.
- It isn't available on the STS global endpoint. Use a regional one.
- The caller needs `sts:GetScopedCredentials` allowed. 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`:

```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:

```bash
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](https://dev.classmethod.jp/en/articles/aws-sts-getscopedcredentials-scope-down/) 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](https://aws.amazon.com/blogs/security/scope-down-permissions-of-existing-sessions-using-aws-sts-getscopedcredentials/) 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](https://thesecguy.com/notes/prompt-injection-6-real-ai-agent-hijacks/). 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](https://thesecguy.com/notes/llm-security-guide/), now with an AWS call behind it.

## What to do this week

1. 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.
2. Put a credential broker in front of those: a few lines that call `GetScopedCredentials` with a per-task policy and hand over only the result.
3. Cap the lifetime centrally. AWS documents a service control policy that denies `sts:GetScopedCredentials` when `sts:DurationSeconds` is above 900.
4. Add `GetScopedCredentials` to 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](https://aws.amazon.com/about-aws/whats-new/2026/11/sts-getscopedcredentials/)
- AWS Security Blog, "Scope down permissions of existing sessions using AWS STS GetScopedCredentials", 20 Nov 2026: [aws.amazon.com/blogs/security](https://aws.amazon.com/blogs/security/scope-down-permissions-of-existing-sessions-using-aws-sts-getscopedcredentials/)
- IAM User Guide, "Permissions for GetScopedCredentials": [docs.aws.amazon.com](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getscopedcredentials.html)
- IAM User Guide, "Compare AWS STS credentials": [docs.aws.amazon.com](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_sts-comparison.html)
- AWS CLI Command Reference, `get-scoped-credentials`: [docs.aws.amazon.com/cli](https://docs.aws.amazon.com/cli/latest/reference/sts/get-scoped-credentials.html)
- Classmethod, "Trying Out AWS STS GetScopedCredentials to Narrow Down Permissions and Session Duration of Temporary Credentials", 20 Nov 2026: [dev.classmethod.jp](https://dev.classmethod.jp/en/articles/aws-sts-getscopedcredentials-scope-down/)
