View a markdown version of this page

Amazon Bedrock AgentCore - AWS Identity and Access Management

Amazon Bedrock AgentCore

Preview release

Agent and workload identity is in preview release for AWS Identity and Access Management (IAM) and is subject to change.

Agents that run on AgentCore runtime, a capability of Amazon Bedrock AgentCore, can receive their own agent and workload identities. Each gateway in AgentCore Gateway, a capability of Amazon Bedrock AgentCore, also receives its own identity. The AgentCore control plane attests them, so you don't install anything or write attestation facts by hand. Both use the same service principal, bedrock-agentcore.amazonaws.com.

You turn on agent and workload identity when you create a runtime or gateway. You can change its template afterward. During the preview, you can't turn it on for a runtime or gateway that already exists.

AgentCore runtime

When a caller invokes an agent runtime, IAM issues the agent's identity and adds it to the runtime's execution role session. The execution role's trust policy doesn't change. Agents call AWS Security Token Service (AWS STS) from their own code to get JSON Web Token SPIFFE Verifiable Identity Documents (JWT-SVIDs) and X.509 SPIFFE Verifiable Identity Documents (X.509-SVIDs).

Choose a template definition

 

Organization-level provider

Account-level provider

Definition

runtime/org-provider-account-template-default:1

runtime/account-provider-default:1

Identifier

spiffe://<org-domain>/<account>/<region>/bedrock-agentcore/runtime/<runtime-name>/<runtime-id>

spiffe://<account>.aws.internal/<region>/bedrock-agentcore/runtime/<runtime-name>/<runtime-id>

Definition with a session ID

runtime/org-provider-account-template-session:1

runtime/account-provider-session:1

Identifier with a session ID

spiffe://<org-domain>/<account>/<region>/bedrock-agentcore/runtime/<runtime-name>/<runtime-id>/<session-id>

spiffe://<account>.aws.internal/<region>/bedrock-agentcore/runtime/<runtime-name>/<runtime-id>/<session-id>

The name keeps the identifier readable, and the ID keeps a re-created runtime from inheriting the old one's access. To cover an agent and every re-creation of it, grant .../bedrock-agentcore/runtime/claims_processor/*.

With a session definition, each runtime session receives its own identifier. To grant access to every session of a runtime, match the identifier up to the runtime ID, followed by /*. No definition adds the runtime version.

Set up agent and workload identity for a runtime

Before you create the runtime:

  • Use the latest version of the AWS CLI or an AWS SDK, released on or after December 1, 2026. In your agent code, use the latest version of the AgentCore SDK, so that your agent gets execution role session credentials that carry its identity.

  • Use platform version V2 or the Instances compute type for the runtime.

  • Create a workload identity provider and a template from a runtime/ definition, or let the AgentCore console create them for you. For more information, see Create a workload identity provider and Create workload identity templates.

  • Allow the person who creates or updates the runtime to call iam:PassWorkloadIdentityTemplate on the template, with iam:PassedToService set to bedrock-agentcore.amazonaws.com. Without it, CreateAgentRuntime and UpdateAgentRuntime fail with AccessDeniedException. For more information, see Permission to assign a template.

  • You don't need to change the execution role.

Console

  1. Open the Amazon Bedrock AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home# and choose Agents. On the Agents page, choose Create Host agent (runtime).

  2. Configure the runtime with platform version V2 or the Instances compute type.

  3. Under IAM for agents, select Enable IAM for agents.

  4. For Workload identity setup, choose one of the following:

    • Auto create a new setup – The console chooses the provider and template:

      • If the account can use an organization-level provider, the console creates nothing in the account. It uses the organization's runtime template, or the account's existing default template if the organization has none. If neither exists, ask your organization's administrator to add a runtime template. If the organization has more than one runtime template, choose Select an existing setup instead.

      • Otherwise, the console uses the provider named default, with the trust domain <account>.aws.internal, and the account's default template. It creates them if they don't exist.

      To give each session its own identity, select Include session ID in the agent identity.

    • Select an existing setup – Choose a Workload identity provider and a Template. To create either one in the IAM console, choose Create new.

  5. Complete the rest of the configuration, and then choose Create runtime.

The console shows the agent's identity format, with placeholders for values that AgentCore sets when the agent runs, such as the session ID. It isn't the actual identifier. To see the identifier, find the agent's AssumeRole event in AWS CloudTrail after the first invocation. For more information, see Logging and monitoring agent and workload identity.

AWS CLI

Create the template from the definition:

aws iam create-workload-identity-template \ --template-definition '{ "TemplateDefinitionArn": "arn:aws:iam::aws:workload-identity-template-definition/bedrock-agentcore.amazonaws.com/runtime/account-provider-default:1", "ReplacementValues": { "Name": { "Values": ["agentcore-runtimes"] }, "WorkloadIdentityProviderArn": { "Values": ["arn:aws:iam::444455556666:workload-identity-provider/claims"] } } }'

Then set the template with --workload-identity-template-arn when you create the runtime:

aws bedrock-agentcore-control create-agent-runtime \ --agent-runtime-name "claims_processor" \ --role-arn "arn:aws:iam::444455556666:role/AgentExecutionRole" \ --platform-version V2 \ --workload-identity-template-arn "arn:aws:iam::444455556666:workload-identity-template/agentcore-runtimes" \ ...

The response doesn't include the agent's identifier. To switch to a different template later, call update-agent-runtime with the new template ARN. If you leave the template out of the update, the runtime keeps its current template. To add a template to a runtime that was created without one, or to remove a template, create a new runtime.

AWS API

CreateAgentRuntime sets the template in workloadIdentityTemplateArn. UpdateAgentRuntime changes it, only on a runtime that was created with an agent and workload identity.

How the runtime gets its identity

When you invoke your runtime, AgentCore attests the runtime and sends its facts and your template reference to AWS STS, which returns a signed context that carries the agent and workload identity. AgentCore then adds the identity to the runtime's execution role session and returns those credentials to your agent. Use the AgentCore SDK to get the credentials in your agent's code. The SDK also refreshes a running agent's credentials, and they keep carrying the agent's identity. In Python, import bedrock_agentcore before you create any boto3 client. The SDK then puts the credentials on the default credential chain, so a client that you create afterward carries the agent's identity. A client that you create before the import uses the execution role's credentials without the identity.

A runtime with a template doesn't get an AgentCore Identity workload identity. Your agent can still get OAuth 2.0 tokens and API keys from AgentCore Identity, but only with the latest AgentCore SDK. Calls made with the execution role's credentials alone fail with AccessDeniedException.

Runtime limitations during the preview

  • Your agent also holds the execution role's credentials without its identity. Calls made with them go out without the identity, and a Deny that names the agent's identity doesn't stop them. To limit a resource to the agent, deny the execution role when the identity doesn't match.

  • You can't change a runtime that has a template to platform version V1.

  • CreateAgentRuntime and UpdateAgentRuntime don't check that the template exists. If it doesn't, invocations fail with AccessDeniedException.

  • If AWS STS can't issue the agent's identity, the invocation fails. An identifier longer than 256 characters fails with ValidationException. Every part counts, including the session ID when the template includes it.

  • After you create a template or change its attestation policy, invocations can fail with AccessDeniedException for a few minutes while the change propagates.

  • When you delete a template, every invocation of a runtime that uses it fails with AccessDeniedException, including invocations of existing sessions.

For the full setup, including a Python example and a bucket policy that denies the role without the agent's identity, see Agent and workload identity for AgentCore Runtime (preview) in the Amazon Bedrock AgentCore Developer Guide.

AgentCore Gateway

Each gateway receives its own identity, with the identifier .../[<account>/]<region>/bedrock-agentcore/gateway/<gateway-name>/<gateway-id>. Use the gateway/org-provider-account-template-default:1 definition under an organization-level provider, or gateway/account-provider-default:1 under an account-level provider. A gateway supports JWT-SVIDs only, not X.509-SVIDs. It calls AWS STS with the execution role that you provide for the gateway.

Before you create the gateway:

For the full gateway setup, see Set up workload identity for a gateway and Create a gateway in the Amazon Bedrock AgentCore Developer Guide.

Console

  1. Open the Amazon Bedrock AgentCore console at https://console.aws.amazon.com/bedrock-agentcore/home#. In the navigation pane, under Resources, choose Gateways, and then choose Create Gateway. To change the provider or template of an existing gateway, choose a gateway that was created with an agent and workload identity, and then choose Edit to open the Edit Gateway page.

  2. Under IAM Workload Identity, select Enable Workload Identity. Under Workload Identity setup, choose one of the following:

    • Auto-configure setup – The console chooses the provider and template:

      • If the account can read an organization-level provider, the console uses the organization's gateway template and creates nothing. If the organization has no gateway template, or has more than one, the console shows an error. Choose Select an existing setup instead.

      • Otherwise, the console uses the provider named default, with the trust domain <account>.aws.internal, and the template <account>-agentcore-gateway-account-provider-default, created from the gateway/account-provider-default:1 definition. The console creates the provider and the template if they don't exist.

    • Select an existing setup – For Provider and Template, choose a provider and a template.

  3. Complete the gateway configuration, and then choose Create Gateway. If you're editing a gateway, choose Save. On the Edit Gateway page, you can't clear Enable Workload Identity, but you can choose a different provider and template.

AWS CLI

Set the template when you create the gateway, with the --workload-identity-template-arn parameter:

aws bedrock-agentcore-control create-gateway \ --name payments-tools \ --authorizer-type AWS_IAM \ --role-arn arn:aws:iam::444455556666:role/AgentCoreGatewayRole \ --workload-identity-template-arn arn:aws:iam::444455556666:workload-identity-template/agentcore-gateways

To change it later, use update-gateway. This works only on a gateway that was created with an agent and workload identity.

AWS API

CreateGateway sets the template. UpdateGateway changes it, only on a gateway that was created with an agent and workload identity. GetGateway and ListGateways return it.

To set a target's outbound authorization to JWT_SVID, use CreateGatewayTarget or UpdateGatewayTarget.

Authenticate to targets with a JWT-SVID

A gateway with an agent and workload identity can authenticate to its targets with a JWT-SVID instead of a stored API key or OAuth credential. When you add a target, set its outbound authorization type to JWT_SVID and set the audience that the target expects. When the gateway calls the target, it calls GetWebIdentityToken with its execution role for that audience, and sends the token as a bearer token in the Authorization header.

  • JWT_SVID is available for MCP server, OpenAPI schema, AgentCore runtime, and HTTP passthrough targets.

  • Tokens are signed with RS256 by default. You can choose ES384 instead. Each token is valid for 5 minutes.

  • The target verifies the token with your provider's JSON Web Key Set (JWKS), and checks that aud is its own audience and sub is the gateway's identifier.

  • The gateway doesn't exchange the JWT-SVID for another token. If a target accepts only tokens from its own authorization server, use OAuth instead.

The gateway's execution role needs sts:GetWebIdentityToken for the audiences of its targets:

{ "Version": "2012-10-17", "Statement": [{ "Sid": "GetJwtSvidForTargets", "Effect": "Allow", "Action": "sts:GetWebIdentityToken", "Resource": "*", "Condition": { "ForAllValues:StringEquals": { "sts:IdentityTokenAudience": ["https://api.example.com"] }, "Null": { "sts:IdentityTokenAudience": "false" } } }] }

For more information, see Set up outbound authorization for your gateway in the Amazon Bedrock AgentCore Developer Guide.

Example: allow one agent to read a bucket

{ "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*", "Condition": { "StringLike": { "aws:OriginIdentity/Subject": "spiffe://444455556666.aws.internal/us-west-2/bedrock-agentcore/runtime/claims_processor/*" }, "StringEquals": { "aws:PrincipalAccount": "444455556666", "aws:OriginIdentity/Issuer": "arn:aws:iam::444455556666:workload-identity-provider/claims" } } }

The policy uses "Principal": "*" so that the agent can read the bucket whichever role it uses. The conditions limit access to that agent's identifier from one provider, and the aws:PrincipalAccount condition keeps S3 Block Public Access from treating the policy as public.

This Allow doesn't stop a role whose own policy already grants access, and during the preview the agent also holds its execution role's credentials without the identity. To limit the bucket to the agent, also deny the execution role when aws:OriginIdentity/Subject or aws:OriginIdentity/Issuer doesn't match.