Tech Insights
AWS GetScopedCredentials Makes Runtime Least Privilege Practical for AI Agents
AWS STS GetScopedCredentials lets agents, sub-agents, and workloads narrow existing temporary sessions by permission, resource, and duration while preserving identity and CloudTrail traceability.
AI agents can be useful precisely because they act on their own. That is also the security problem: if an agent receives a broad temporary session, a bad tool call, prompt injection, or coding mistake may let it reach more AWS resources than the task requires. Amazon Web Services is addressing that gap with AWS STS GetScopedCredentials, a new API that narrows an existing temporary session at runtime.
The important detail is that the API does not create a new identity with wider powers. It preserves the caller’s IAM identity while reducing permissions, shortening the remaining session lifetime, or doing both. That gives teams a practical way to hand an agent, sub-agent, worker, or tenant-specific process a smaller credential set without redesigning the entire identity system first.
What GetScopedCredentials changes
Traditional least privilege is usually designed in advance. An administrator creates a role, attaches policies, and decides what a workload may do. That remains essential, but many modern workloads learn the precise task only at runtime. A multi-tenant service discovers the tenant after authentication. An orchestrating agent decides which sub-agent is needed after reading a request. A CI job knows the target branch and deployment stage only after evaluating the pipeline.
GetScopedCredentials gives those systems a runtime control point. A caller with temporary AWS credentials can pass an inline scope-down policy, a shorter duration, or both. The resulting credentials are the intersection of the original session’s effective permissions and the new policy. They cannot grant access the parent session did not already have, and they cannot outlive the remaining parent session when the requested lifetime would be longer.
A policy can be narrow by resource, action, or both. An agent that reads one S3 bucket can receive only s3:GetObject on that object path. A deployment helper may retain project read access while losing deletion actions. The restriction travels with the temporary credential instead of depending only on the agent’s prompt or tool configuration.
Why this matters for AI agents
An agent does not interpret permissions like a human operator. It chooses actions from prompts, tool descriptions, files, API responses, and intermediate reasoning. If the session behind the agent can list every bucket, alter IAM, delete infrastructure, and publish code, a single confused step can become a security incident.
GetScopedCredentials supports a safer sequence: the orchestrator keeps its broader role, identifies the next task, obtains a smaller session, and passes only that session to the worker. A sub-agent can then receive an even narrower session. AWS says the call can be made recursively, with each new scope-down policy intersecting with the earlier restrictions. At launch, a session can have up to three scope-down policies applied.
This is not an agent safety guarantee; it is a boundary around what the agent can do when its behavior is uncertain. The model may still make a wrong change inside its allowed area, but it is less likely to turn a narrow task into account-wide access.
A practical example for an Indian SaaS team
Consider a Bengaluru SaaS company running a customer-support agent. At 9:30 PM IST, it receives a request to prepare a usage report for one customer. The application already uses an IAM role that can read usage data for all customers.
After authenticating the customer and determining the tenant identifier, a trusted credential broker can call GetScopedCredentials with a policy that allows access only to that tenant’s S3 prefix. The worker receives the scoped credentials, generates the report, and cannot read a neighboring tenant’s prefix even though the parent role can. The broker can also request a short duration, such as the expected lifetime of the report job.
Identity and auditability are preserved
The scoped credentials preserve the caller’s original IAM identity, so teams do not need a new role for every possible task just to keep attribution intact. AWS says the resulting session retains the caller’s ARN, role session name, session tags, and context keys.
Each GetScopedCredentials call is logged in AWS CloudTrail. The request can include a scoped-session description, such as tenant-4821-usage-report or agent-invoice-review, so security teams have more context when they investigate a session. Later activity made with the scoped credentials can be connected back to the parent session through the access key information and session identity.
The trade-offs and failure modes
First, the scope-down policy must be correct. One that is too broad defeats the point; one that is too narrow may break a task midway. Build policies from the smallest required action and resource set, test dependent actions, and treat policy generation as code with review and regression tests.
Second, every credential vending step adds latency and another dependency. High-volume applications should measure the extra STS calls and decide where caching is safe. Caching a scoped session for too long may erase the benefit of a short runtime window, while requesting a new session for every tiny operation can add avoidable overhead.
Third, the API only narrows the session it receives. If the parent role is already excessive, the agent broker is still operating inside a large blast radius. The root role, permission boundaries, service control policies, resource policies, and network controls remain important. GetScopedCredentials is a runtime layer on top of an identity foundation, not a replacement for it.
Finally, teams need to decide who may call the API. AWS controls access through IAM policies, and the API supports conditions such as sts:DurationSeconds. Restricting which brokers, roles, or VPC endpoints may request scoped credentials can prevent an untrusted component from minting sessions for itself.
How to introduce it safely
Start with a read-only workflow that has a clear resource boundary. Log the parent identity, task identifier, scope-down policy, requested duration, and resulting session. Use CloudTrail to confirm that the credential chain is understandable during an incident review.
Next, test recursive delegation. Give an orchestrator access to create a narrow worker session, then verify that the worker cannot widen its permissions or extend its lifetime. Add failure tests for missing dependent actions, expired credentials, malformed policies, and attempts to access a second tenant.
For AI agents, keep tool permissions and credential permissions aligned. A tool should not advertise destructive actions if the agent’s session cannot use them, and a credential should not allow actions that the task never needs. When a human approves an escalation, issue a new, explicitly bounded session rather than quietly passing the parent credentials through.
AWS STS GetScopedCredentials is a small API with a large operational implication: least privilege no longer has to be fully static. By preserving identity while narrowing permissions and time at runtime, it gives agent builders and cloud teams a stronger answer to the question, “What can this process do right now?” The answer should be as narrow as the task, as short as the task, and visible in the audit trail.
Read the AWS Security Blog announcement on GetScopedCredentials for policy examples, recursive scoping details, quotas, and supported use cases.
This article is a general information summary based on the cited public sources. It is not legal, cybersecurity, or compliance advice.