

# Security in Amazon Bedrock AgentCore
<a name="security"></a>

Cloud security at AWS is the highest priority. As an AWS customer, you benefit from data centers and network architectures that are are designed to help meet with the requirements of the most security-sensitive organizations.

Security is a shared responsibility between AWS and you. The [shared responsibility model](https://aws.amazon.com/compliance/shared-responsibility-model/) describes this as security *of* the cloud and security *in* the cloud:
+  **Security of the cloud** – AWS is responsible for protecting the infrastructure that runs AWS services in the AWS Cloud. AWS also provides you with services that you can use securely. Third-party auditors regularly test and verify the effectiveness of our security as part of the [AWS Compliance Programs](https://aws.amazon.com/compliance/programs/) . To learn about the compliance programs that apply to Amazon Bedrock AgentCore, see [AWS Services in Scope by Compliance Program](https://aws.amazon.com/compliance/services-in-scope/).
+  **Security in the cloud** – Your responsibility is determined by the AWS service that you use. You are also responsible for other factors including the sensitivity of your data, your company’s requirements, and applicable laws and regulations.

This documentation helps you understand how to apply the shared responsibility model when using AgentCore. The following topics show you how to configure AgentCore to help meet your security and compliance objectives You also learn how to use other AWS services that help you to monitor and secure your AgentCore resources.

**Topics**
+ [Data protection in Amazon Bedrock AgentCore](data-protection.md)
+ [Identity and access management for Amazon Bedrock AgentCore](security-iam.md)
+ [Resource-based policies for Amazon Bedrock AgentCore](resource-based-policies.md)
+ [Compliance validation for Amazon Bedrock AgentCore](compliance-validation.md)
+ [Resilience in Amazon Bedrock AgentCore](disaster-recovery-resiliency.md)
+ [Cross-service confused deputy prevention](cross-service-confused-deputy-prevention.md)

# Data protection in Amazon Bedrock AgentCore
<a name="data-protection"></a>

The AWS [shared responsibility model](https://aws.amazon.com/compliance/shared-responsibility-model/) applies to data protection in Amazon Bedrock AgentCore. As described in this model, AWS is responsible for protecting the global infrastructure that runs all of the AWS Cloud. You are responsible for maintaining control over your content that is hosted on this infrastructure. You are also responsible for the security configuration and management tasks for the AWS services that you use. For more information about data privacy, see the [Data Privacy FAQ](https://aws.amazon.com/compliance/data-privacy-faq/) . For information about data protection in Europe, see the [AWS Shared Responsibility Model and GDPR](https://aws.amazon.com/blogs/security/the-aws-shared-responsibility-model-and-gdpr/) blog post on the * AWS Security Blog*.

For data protection purposes, we recommend that you protect AWS account credentials and set up individual users with AWS IAM Identity Center or AWS Identity and Access Management (IAM). That way, each user is given only the permissions necessary to fulfill their job duties. We also recommend that you secure your data in the following ways:
+ Use multi-factor authentication (MFA) with each account.
+ Use SSL/TLS to communicate with AWS resources. We require TLS 1.2 and recommend TLS 1.3.
+ Set up API and user activity logging with AWS CloudTrail. For information about using CloudTrail trails to capture AWS activities, see [Working with CloudTrail trails](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-trails.html) in the * AWS CloudTrail User Guide*.
+ Use AWS encryption solutions, along with all default security controls within AWS services.
+ Use advanced managed security services such as Amazon Macie, which assists in discovering and securing sensitive data that is stored in Amazon S3.
+ If you require FIPS 140-3 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see [Federal Information Processing Standard (FIPS) 140-3](https://aws.amazon.com/compliance/fips/).

We strongly recommend that you never put confidential or sensitive information, such as your customers' email addresses, into tags or free-form text fields such as a **Name** field. This includes when you work with AgentCore or other AWS services using the console, API, AWS CLI, or AWS SDKs. Any data that you enter into tags or free-form text fields used for names may be used for billing or diagnostic logs. If you provide a URL to an external server, we strongly recommend that you do not include credentials information in the URL to validate your request to that server.

 **AgentCore Gateway-specific considerations** 
+ AgentCore Gateway accepts inputs from customers for tool definitions and service details, which can potentially contain personally identifiable information (PII).
+ Customer data and metadata are stored in Amazon DynamoDB and Amazon Simple Storage Service and are encrypted either with a service key or a customer-managed KMS key.
+ Customer content is not used to provide and maintain the AgentCore Gateway service.
+ Metadata doesn’t include customer information (such as PII).
+ Metrics and logs are stored in CloudWatch.

**Topics**
+ [Data encryption](data-encryption.md)
+ [Protecting your data using VPC and AWS PrivateLink](vpc.md)
+ [Cross-region inference in Amazon Bedrock AgentCore Memory, Policy in Amazon Bedrock AgentCore, and AgentCore Evaluations](cross-region-inference.md)

# Data encryption
<a name="data-encryption"></a>

## Encryption at rest
<a name="encryption-rest"></a>

Amazon Bedrock AgentCore stores data at rest using Amazon DynamoDB and Amazon Simple Storage Service (Amazon S3). The data at rest is encrypted using AWS encryption solutions by default. AgentCore encrypts your data using AWS owned encryption keys from AWS Key Management Service. You don’t have to take any action to protect the AWS managed keys that encrypt your data. For more information, see [AWS owned keys](kms/latest/developerguide/concepts.html#aws-owned-cmk) in the * AWS Key Management Service Developer Guide*.

 **Key considerations** 
+ The following data is not encrypted by default:
  + Gateway names
  + Gateway target names
  + Gateway tool names
  + Gateway CloudWatch logs
+ Customers can encrypt the following resources with a customer-managed KMS key:
  + Gateways – For more information, see [Encrypt your AgentCore gateway with a customer-managed KMS key](gateway-encryption.md).

## Encryption in transit
<a name="encryption-transit"></a>

All communication between customers and Amazon Bedrock AgentCore and between AgentCore and its downstream dependencies is protected using TLS 1.2 or higher connections.

Encryption in transit is configured by default for the following services:

 **Key considerations** 
+ All outbound traffic for AgentCore Gateway is protected using TLS.
+ When invoking a gateway, note the following about the data that is transferred:
  + During a *call tool* request, the service transforms the data in the request and makes a call to the customer-configured web service. The response from the web service is transformed and returned as a *call tool* response to the invoker.
  + During a *list tools* request, the request is a standard MCP list/tools operation request and the response contains a list of tools configured on the gateway by the customer during control plane operations.

## Key management
<a name="key-management"></a>

You can use AWS KMS customer managed keys for the following Amazon Bedrock AgentCore resources:

 **Resources that support AWS KMS customer managed keys** 
+ Memories. For more information, see [Create an AgentCore Memory](memory-create-a-memory-store.md).
+ Gateways. For more information, see [Encrypt your AgentCore gateway with a customer-managed KMS key](gateway-encryption.md) . Note the following:
  + For AgentCore Gateway resources, AWS managed keys are single-tenant use and different for each region.
  + If a key encrypting your gateway is compromised, you should rotate the key or delete the gateway and create a new one with a new key.
  + AgentCore Gateway integrates with AWS Certificate Manager. For more information, see [AWS Certificate Manager User Guide](https://docs.aws.amazon.com/acm/latest/userguide/) 

# Protecting your data using VPC and AWS PrivateLink
<a name="vpc"></a>

You can use Amazon Virtual Private Cloud (Amazon VPC) and AWS PrivateLink to create private connections between your VPC and Amazon Bedrock AgentCore.

**Topics**
+ [Use interface VPC endpoints (AWS PrivateLink) to create a private connection between your VPC and your Amazon Bedrock AgentCore resources](vpc-interface-endpoints.md)
+ [Configure Amazon Bedrock AgentCore Gateway VPC Egress for Gateway Targets](gateway-vpc-egress.md)
+ [Connect to private resources in your VPC using VPC Lattice](vpc-egress-private-endpoints.md)
+ [Configure Amazon Bedrock AgentCore Runtime and tools for VPC](agentcore-vpc.md)
+ [Use IAM condition keys with AgentCore Runtime and built-in tools VPC settings](security-vpc-condition.md)

# Use interface VPC endpoints (AWS PrivateLink) to create a private connection between your VPC and your Amazon Bedrock AgentCore resources
<a name="vpc-interface-endpoints"></a>

You can use AWS PrivateLink to create a private connection between your VPC and Amazon Bedrock AgentCore. You can access AgentCore as if it were in your VPC, without the use of an internet gateway, NAT device, VPN connection, or Direct Connect connection. Instances in your VPC don’t need public IP addresses to access AgentCore.

You establish this private connection by creating an *interface endpoint* , powered by AWS PrivateLink. We create an endpoint network interface in each subnet that you enable for the interface endpoint. These are requester-managed network interfaces that serve as the entry point for traffic destined for AgentCore.

For more information, see [Access AWS services through AWS PrivateLink](https://docs.aws.amazon.com/vpc/latest/privatelink/privatelink-access-aws-services.html) in the * AWS PrivateLink Guide*.

## Considerations for AgentCore
<a name="vpc-endpoint-considerations"></a>

Before you set up an interface endpoint for AgentCore, review [Considerations](https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html#considerations-interface-endpoints) in the * AWS PrivateLink Guide*.

AgentCore provides three AWS PrivateLink endpoints:
+  **Data plane endpoint** - `com.amazonaws.region.bedrock-agentcore` 
+  **Control plane endpoint** - `com.amazonaws.region.bedrock-agentcore-control` 
+  **Gateway endpoint** - `com.amazonaws.region.bedrock-agentcore.gateway` 

The following table shows AWS PrivateLink support status for each AgentCore primitive:


| Primitive | Data plane | Control plane | 
| --- | --- | --- | 
|  Runtime  |  Supported  |  Supported  | 
|  Memory  |  Supported  |  Supported  | 
|  Built-in Tools (Code Interpreter, Browser Tool)  |  Supported  |  Supported  | 
|  Identity  |  Supported  |  Supported  | 
|  Gateway  |  Supported  |  Supported  | 
|  Evaluations  |  Not yet supported  |  Supported  | 
|  Policy  |  Supported  |  Supported  | 

For a list of AWS Regions in which AgentCore interface endpoints are available, see [Supported AWS Regions](agentcore-regions.md).

**Important**  
The data plane APIs support both AWS Signature Version 4 (SigV4) headers for authentication and Bearer Token (OAuth) authentication. VPC endpoint policies can only restrict callers based on IAM principals and not OAuth users. For OAuth-based requests to succeed through the VPC endpoint, the principal must be set to \$1 in the endpoint policy. Otherwise, only SigV4 allowlisted callers can make successful calls over the VPC endpoint.

 AWS IAM global condition context keys are supported. By default, full access to AgentCore is allowed through the interface endpoint. You can control access by attaching an endpoint policy to the interface endpoint or by associating a security group with the endpoint network interfaces.

## Create an interface endpoint for AgentCore
<a name="vpc-endpoint-create"></a>

You can create an interface endpoint for AgentCore using either the Amazon VPC console or the AWS Command Line Interface (AWS CLI). For more information, see [Create an interface endpoint](https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html#create-interface-endpoint-aws) in the * AWS PrivateLink Guide*.

Create an interface endpoint for AgentCore using the following service name format:
+ All data plane primitives (Runtime, Built-in Tools, Memory, Identity): `com.amazonaws.region.bedrock-agentcore` 
+ For AgentCore Gateway: `com.amazonaws.region.bedrock-agentcore.gateway` 
+ For control plane operations (Runtime and Memory management): `com.amazonaws.region.bedrock-agentcore-control` 

If you enable private DNS for the interface endpoint, you can make API requests to AgentCore using its default Regional DNS name. For example, `bedrock-agentcore.us-east-1.amazonaws.com`.

## Create an endpoint policy for your interface endpoint
<a name="vpc-endpoint-policy"></a>

An endpoint policy is an IAM resource that you can attach to an interface endpoint. The default endpoint policy allows full access to AgentCore through the interface endpoint. To control the access allowed to AgentCore from your VPC, attach a custom endpoint policy to the interface endpoint.

An endpoint policy specifies the following information:
+ The principals that can perform actions (AWS accounts, IAM users, and IAM roles).
  + For AgentCore Gateway, if your gateway ingress isn’t [AWS Signature Version 4 (SigV4)](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) -based (for example, if you use OAuth instead), you must specify the `Principal` field as the wildcard \$1 . SigV4 -based authentication allows you to define the `Principal` as a specific AWS identity. This also applies to AgentCore Runtime.
+ The actions that can be performed.
+ The resources on which the actions can be performed.

For more information, see [Control access to services using endpoint policies](https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-access.html) in the * AWS PrivateLink Guide*.

 **Endpoint policies for various primitives** 

The following examples show endpoint policies for different AgentCore components:

**Example**  

1. The following endpoint policy allows specific IAM principals to invoke agent runtime resources.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:user/USERNAME"
            },
            "Action": [
               "bedrock-agentcore:InvokeAgentRuntime"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:runtime/RUNTIME_ID"
         }
      ]
   }
   ```

    **Mixed IAM and OAuth authentication** 

   The `InvokeAgentRuntime` API supports two modes of VPC endpoint authorization. The following example policy allows both IAM principals and OAuth callers to access different agent runtime resources.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:InvokeAgentRuntime"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:runtime/customAgent1"
         },
         {
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
               "bedrock-agentcore:InvokeAgentRuntime"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:runtime/customAgent2"
         }
      ]
   }
   ```

   The above policy allows only the IAM principal to make `InvokeAgentRuntime` calls to `customAgent1` . It also allows both IAM principals and OAuth callers to make `InvokeAgentRuntime` calls to `customAgent2`.

1. The following endpoint policy allows specific IAM principals to invoke Code Interpreter resources.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:InvokeCodeInterpreter"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:code-interpreter/CODE_INTERPRETER_ID"
         }
      ]
   }
   ```

1. ====== All data plane operations

   The following endpoint policy allows specific IAM principals to access us-east-1 data plane operations for a specific AgentCore Memory.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:CreateEvent",
               "bedrock-agentcore:DeleteEvent",
               "bedrock-agentcore:GetEvent",
               "bedrock-agentcore:ListEvents",
               "bedrock-agentcore:DeleteMemoryRecord",
               "bedrock-agentcore:GetMemoryRecord",
               "bedrock-agentcore:ListMemoryRecords",
               "bedrock-agentcore:RetrieveMemoryRecords",
               "bedrock-agentcore:ListActors",
               "bedrock-agentcore:ListSessions",
               "bedrock-agentcore:BatchCreateMemoryRecords",
               "bedrock-agentcore:BatchDeleteMemoryRecords",
               "bedrock-agentcore:BatchUpdateMemoryRecords"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:memory/MEMORY_ID"
         }
      ]
   }
   ```

    **Access to all memories** 

   The following endpoint policy allows specific IAM principals access to all memories.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:CreateEvent",
               "bedrock-agentcore:DeleteEvent",
               "bedrock-agentcore:GetEvent",
               "bedrock-agentcore:ListEvents",
               "bedrock-agentcore:DeleteMemoryRecord",
               "bedrock-agentcore:GetMemoryRecord",
               "bedrock-agentcore:ListMemoryRecords",
               "bedrock-agentcore:RetrieveMemoryRecords",
               "bedrock-agentcore:ListActors",
               "bedrock-agentcore:ListSessions",
               "bedrock-agentcore:BatchCreateMemoryRecords",
               "bedrock-agentcore:BatchDeleteMemoryRecords",
               "bedrock-agentcore:BatchUpdateMemoryRecords"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:memory/*"
         }
      ]
   }
   ```

    **Access restriction by APIs** 

   The following endpoint policy grants permission for a specific IAM principal to create events in a specific AgentCore Memory resource.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:CreateEvent"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:memory/MEMORY_ID"
         }
      ]
   }
   ```

1. The following endpoint policy allows specific IAM principals to connect to Browser Tool resources.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": {
               "AWS": "arn:aws::iam::ACCOUNT_ID:root"
            },
            "Action": [
               "bedrock-agentcore:ConnectBrowserAutomationStream"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1:ACCOUNT_ID:browser/BROWSER_ID"
         }
      ]
   }
   ```

1. The following is an example of a custom endpoint policy. When you attach this policy to your interface endpoint, it allows all principals to invoke the gateway specified in the `Resource` field.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
               "bedrock:InvokeGateway"
            ],
            "Resource": "arn:aws::bedrock-agentcore:us-east-1::gateway/my-gateway"
         }
      ]
   }
   ```

1. The following endpoint policy allows access to Identity resources.

   ```
   {
      "Statement": [
         {
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
               "*"
            ],
            "Resource": "arn:aws:bedrock-agentcore:us-east-1:ACCOUNT_ID:workload-identity-directory/default/workload-identity/WORKLOAD_IDENTITY_ID"
         }
      ]
   }
   ```

# Configure Amazon Bedrock AgentCore Gateway VPC Egress for Gateway Targets
<a name="gateway-vpc-egress"></a>

The AgentCore Gateway service provides secure and controlled egress traffic management for your applications, enabling seamless communication with resources within your Virtual Private Cloud (VPC). This document outlines how egress traffic flows through the AgentCore Gateway to reach VPC resources. You’ll learn about the supported gateway target types (Lambda, API Gateway, and MCP servers via AgentCore Runtime), their configuration requirements, and the authentication methods supported for each target type. This guide covers the security considerations, routing mechanisms, and best practices needed to enable proper egress traffic flow while maintaining network isolation and following the principle of least privilege throughout your architecture.

## MCP
<a name="mcp-target"></a>

AgentCore Gateway supports Model Context Protocol (MCP) servers as target endpoints, providing flexible deployment options to meet various customer requirements. MCP servers can be configured in multiple ways depending on your infrastructure needs and security requirements.

Your MCP targets could be of two types, not hosted on AgentCore, or hosted on AgentCore Runtime or Gateway. We discuss both below.

### MCPs not hosted on AgentCore
<a name="self-hosted-mcp"></a>

AgentCore Gateway supports connecting to self-hosted MCP servers running inside your VPC using private endpoints powered by Amazon VPC Lattice. You can configure a `privateEndpoint` on your gateway target to route traffic privately to your MCP server without exposing it to the public internet.

**Important**  
VPC egress with private endpoints is made available as a "Beta Service" as defined in the AWS Service Terms.

The following example creates a private MCP server target using managed Lattice:

```
{
  "name": "my-private-mcp-target",
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0abc123def456",
      "subnetIds": ["subnet-0abc123", "subnet-0def456"],
      "endpointIpAddressType": "IPV4",
      "securityGroupIds": ["sg-0abc123def"]
    }
  },
  "targetConfiguration": {
    "mcp": {
      "mcpServer": {
        "endpoint": "https://my-mcp-server.internal.example.com/mcp"
      }
    }
  }
}
```

If your MCP server uses a domain that is not publicly resolvable (for example, a private hosted zone in Route 53), you must also specify a `routingDomain` . For more information, see [Workaround for private DNS support: routing domain](vpc-egress-private-endpoints.md#lattice-vpc-egress-routing-domain).

If your MCP server uses a TLS certificate issued by a private certificate authority, you can place an internal Application Load Balancer with a public ACM certificate in front of it. For more information, see [Workaround for private certificates: ALB](vpc-egress-private-endpoints.md#lattice-vpc-egress-private-certs).

For self-managed Lattice, cross-account setups, and advanced configurations, see [Connect to private resources in your VPC using VPC Lattice](vpc-egress-private-endpoints.md).

### AgentCore Runtime or Gateway
<a name="agentcore-runtime"></a>

AgentCore Runtime provides native support for communicating with resources within your VPC through a managed infrastructure approach. All communication between AgentCore Gateway and AgentCore Runtime stays on the AWS backbone, ensuring your data never traverses the public internet (except for cross-region calls to China datacenters). For more information, see the [Connectivity](https://aws.amazon.com/vpc/faqs/#connectivity) section in the Amazon VPC FAQs. For detailed setup instructions on connecting AgentCore Runtime to your VPC, refer to the [Configure Amazon Bedrock AgentCore Runtime and tools for VPC](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-vpc.html) 

For outbound authorization from AgentCore Gateway to AgentCore Runtime, two authentication methods are supported: no authorization (not recommended for production use) and OAuth with client credentials grant (for machine-to-machine authentication). When no authorization is configured, the request from AgentCore Gateway to AgentCore Runtime has no auth tokens. This architecture provides a seamless connection pathway while maintaining security isolation. As a security best practice, configure restrictive authentication and authorization permissions for both AgentCore Runtime and AgentCore Gateway, limiting access to only the necessary resources and operations required for your specific use case. To configure an OAuth Identity to be used by AgentCore Gateway for egress and ingress for AgentCore Runtime use the following documents:
+  [Configure an OAuth client](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/identity-oauth-client.html) 
+  [Specify the authorization type and credentials to access the gateway target](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-building-adding-targets-authorization.html) 
+  [Authenticate and authorize with Inbound Auth and Outbound Auth](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-oauth.html) 

![\[gateway runtime vpc access\]](http://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/images/gateway-runtime-vpc-access.png)


 **Example CreateGatewayTarget with AgentCore Runtime as a the target** 

The following example shows how to create a gateway target with AgentCore Runtime:

```
POST /gateways/gatewayIdentifier/targets/ HTTP/1.1
Content-type: application/json

    {
    "clientToken": "string",
    "credentialProviderConfigurations": [
      {
         "credentialProvider": {
            "oauthCredentialProvider": {
               "providerArn": "string",
               "scopes": [ "string" ],
               ...
            }
         },
         "credentialProviderType": "OAUTH"
      }
    ],
    "description": "string",
    "metadataConfiguration": {
      "allowedQueryParameters": [ "string" ],
      "allowedRequestHeaders": [ "string" ],
      "allowedResponseHeaders": [ "string" ]
    },
    "name": "string",
    "targetConfiguration": {
      "mcp": {
         "mcpServer": {
            "endpoint": "https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<runtime-id>/invocations?qualifier=DEFAULT&accountId=<account-id>"
         }
      }
    }
}
```

**Note**  
Avoid using a VPC endpoint (VPCE) URL with `privateEndpoint` to prevent an unnecessary extra network hop. Use the direct AgentCore Runtime endpoint instead, with which traffic remains on the AWS backbone.

## Open API target
<a name="openapi-target"></a>

### API Gateway endpoint via Open API Target
<a name="api-gateway-via-openapi"></a>

If your API Gateway can’t be directly added as a target, you can always export the resource as an OpenAPI spec and import the spec into AgentCore Gateway as a OpenAPI target.
+  [Export a REST API from API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-export-api.html) 
+  [OpenAPI schema targets](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-schema-openapi.html) 

If you have Private REST APIs in API Gateway, follow the instructions here: [Private REST APIs in API Gateway](#private-api-gateway).

### Other endpoints
<a name="other-endpoints"></a>

You can configure Open API targets to reach private endpoints inside your VPC using the `privateEndpoint` configuration. AgentCore Gateway uses Amazon VPC Lattice to establish private connectivity to your endpoint without exposing it to the public internet.

**Important**  
VPC egress with private endpoints is made available as a "Beta Service" as defined in the AWS Service Terms.

The following example creates a private OpenAPI target using managed Lattice:

```
{
  "name": "my-private-openapi-target",
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0abc123def456",
      "subnetIds": ["subnet-0abc123", "subnet-0def456"],
      "endpointIpAddressType": "IPV4",
      "securityGroupIds": ["sg-0abc123def"]
    }
  },
  "targetConfiguration": {
    "mcp": {
      "openApiSchema": {
        "inlinePayload": "<your OpenAPI spec JSON with server URL pointing to your private endpoint>"
      }
    }
  }
}
```

If your endpoint uses a domain that is not publicly resolvable, you must also specify a `routingDomain` . For more information, see [Workaround for private DNS support: routing domain](vpc-egress-private-endpoints.md#lattice-vpc-egress-routing-domain).

If your endpoint uses a TLS certificate issued by a private certificate authority, you can place an internal Application Load Balancer with a public ACM certificate in front of it. For more information, see [Workaround for private certificates: ALB](vpc-egress-private-endpoints.md#lattice-vpc-egress-private-certs).

For self-managed Lattice, cross-account setups, and advanced configurations, see [Connect to private resources in your VPC using VPC Lattice](vpc-egress-private-endpoints.md).

## Smithy target
<a name="smithy-target"></a>

Private endpoint ( `privateEndpoint` ) configuration is not currently supported for Smithy targets.

## API Gateway
<a name="api-gateway-target"></a>

AgentCore Gateway supports API Gateway as a target type, which can serve as an intermediary layer for accessing VPC resources. AgentCore Gateway specifically supports REST API Gateways configured with regional endpoints only. While direct VPC communication from the Gateway is not currently available (this feature is planned for future release), the gateway communicates with API Gateway over the AWS backbone, ensuring that traffic never traverses the public internet (except for cross-region calls to China datacenters). The API Gateway can then communicate with resources using VPC Link, creating a secure pathway for the AgentCore Gateway to reach internal services while maintaining network isolation.

To implement security best practices, configure your API Gateway to restrict inbound traffic exclusively to the AgentCore Gateway service principal or the configured API key, preventing unauthorized access from other sources. For outbound authorization from AgentCore Gateway to API Gateway, only two authentication methods are supported: IAM-based authentication (using the gateway service role to authenticate with AWS Signature Version 4) and API key authentication (managed by AgentCore Gateway); OAuth-based authorization and Cross Account API Gateways are not supported for API Gateway targets, please use API Gateway endpoint via Open API Target for those. Limit the AgentCore Gateway execution role permissions to invoke only the specific API Gateway endpoint required, rather than granting broad API Gateway access, ensuring that the gateway cannot interact with unintended API resources and maintaining the principle of least privilege throughout your architecture.

 [Amazon API Gateway REST API stages as targets](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-target-api-gateway.html) 

### Permissions for API Gateway integration using IAM Auth
<a name="api-gateway-permissions"></a>

 **API Gateway Resource Policy Locked Down to AgentCore Gateway** 

The following resource policy restricts API Gateway access to AgentCore Gateway:

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
      {
        "Effect": "Allow",
        "Principal": {
          "Service": "bedrock-agentcore.amazonaws.com"
        },
        "Action": "execute-api:Invoke",
        "Resource": [
          "arn:aws:execute-api:us-west-2:111122223333:rest-api-id/api-stage/*/*"
        ],
        "Condition": {
          "ArnEquals": {
            "aws:SourceArn": "arn:aws:bedrock-agentcore:us-west-2:111122223333:gateway/my-gateway-d4jrgkaske"
          }
        }
      }
    ]
}
```

 **AgentCore Gateway Execution Role policy** 

The following policy grants the gateway permission to invoke the API Gateway:

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "execute-api:Invoke"
        ],
        "Resource": [
          "arn:aws:execute-api:us-west-2:111122223333:abcd123/prod/*/*"
        ]
      }
    ]
}
```

 **AgentCore Gateway Execution Role trust policy** 

The following trust policy allows AgentCore Gateway to assume the execution role:

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
      {
        "Effect": "Allow",
        "Principal": {
          "Service": "bedrock-agentcore.amazonaws.com"
        },
        "Action": "sts:AssumeRole",
        "Condition": {
          "StringEquals": {
            "aws:SourceAccount": "111122223333"
          },
          "ArnLike": {
            "aws:SourceArn": "arn:aws:bedrock-agentcore:us-west-2:111122223333:gateway/*"
          }
        }
      }
    ]
}
```

#### Private REST APIs in API Gateway
<a name="private-api-gateway"></a>

API Gateway targets with private endpoints are not natively supported. However, you can export your private API Gateway as an OpenAPI schema and use an Open API target with that schema, configured with a `privateEndpoint` . Set the `routingDomain` to your API Gateway VPC endpoint (VPCE) DNS name, and ensure the OpenAPI schema server URL uses the domain that matches your public TLS certificate.

```
{
  "name": "my-private-apigw-target",
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0123456789abcdef0",
      "subnetIds": ["subnet-0123456789abcdef0", "subnet-0abcdef1234567890"],
      "endpointIpAddressType": "IPV4",
      "routingDomain": "<vpce-id>.execute-api.<region>.vpce.amazonaws.com"
    }
  },
  "targetConfiguration": {
    "mcp": {
      "openApiSchema": {
        "inlinePayload": "<OpenAPI spec JSON with server URL matching the public certificate domain for your API Gateway, for example https://<api-id>.execute-api.<region>.amazonaws.com>"
      }
    }
  }
}
```

For more details on private endpoint configuration, see [Connect to private resources in your VPC using VPC Lattice](vpc-egress-private-endpoints.md).
+  [Export a REST API from API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-export-api.html) 
+  [OpenAPI schema targets](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-schema-openapi.html) 

## Lambda
<a name="lambda-target"></a>

AgentCore Gateway supports Lambda targets as one of it target types, allowing seamless invocation of Lambda functions that can communicate with resources within your VPC. This functionality is available out-of-the-box and requires no additional configuration from customers - the gateway can immediately invoke Lambda functions that have been configured with VPC access to reach your internal resources such as databases, APIs, or other services. To maintain security best practices, it’s strongly recommended to configure the AgentCore Gateway execution role with minimal permissions, specifically limiting it to invoke only the intended Lambda function rather than granting broad Lambda execution permissions. This principle of least privilege ensures that the gateway, or any other caller using the same role, cannot inadvertently invoke unintended Lambda functions, thereby reducing your security attack surface and maintaining strict access controls within your AWS environment.

## Workaround for private identity providers
<a name="private-idp-workaround"></a>

Configuring a private (VPC-hosted) OAuth identity provider for AgentCore Gateway inbound authorization is not yet natively supported. As a workaround, you can use an interceptor Lambda function for inbound authentication and override the Authorization header in the interceptor Lambda for use with outbound auth.
+  [Gateway interceptors](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-interceptors.html) 
+  [Specify the authorization type and credentials to access the gateway target](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/gateway-building-adding-targets-authorization.html) 

## Limitations and considerations
<a name="gateway-vpc-access-limitations"></a>
+  **Inbound authorization required** : Gateway targets configured with a `privateEndpoint` cannot use `NO_AUTH` as the inbound authorizer type unless an interceptor Lambda is configured on the gateway.

For additional limitations related to private DNS resolution, cross-account connectivity, and DNS TTL configuration, see [Limitations and considerations](vpc-egress-private-endpoints.md#lattice-vpc-egress-limitations) in [Connect to private resources in your VPC using VPC Lattice](vpc-egress-private-endpoints.md).

# Connect to private resources in your VPC using VPC Lattice
<a name="vpc-egress-private-endpoints"></a>

**Important**  
This feature is made available to you as a "Beta Service" as defined in the AWS Service Terms. It is subject to your Agreement with AWS and the AWS Service Terms.

Amazon Bedrock AgentCore supports private connectivity to resources hosted inside your AWS VPC or on-premises environments connected to your VPC, such as private MCP servers, internal REST APIs, or databases, without exposing those services to the public internet.

Private connectivity is established using [Amazon VPC Lattice](https://docs.aws.amazon.com/vpc-lattice/latest/ug/what-is-vpc-lattice.html) resource gateways and resource configurations. For details on the two supported modes (managed and self-managed Lattice), see [Supported VPC egress modes](#lattice-vpc-egress-compare-modes).

**Topics**
+ [Key concepts](#lattice-vpc-egress-concepts)
+ [Supported Amazon Bedrock AgentCore services](#lattice-vpc-egress-supported-services)
+ [Supported VPC egress modes](#lattice-vpc-egress-compare-modes)
+ [Option 1: Managed Lattice](#lattice-vpc-egress-managed-lattice)
+ [Option 2: Self-managed Lattice](#lattice-vpc-egress-self-managed-lattice)
+ [Workaround for private DNS support: routing domain](#lattice-vpc-egress-routing-domain)
+ [Workaround for private certificates: ALB](#lattice-vpc-egress-private-certs)
+ [Service-linked role for VPC egress](#lattice-vpc-egress-slr)
+ [Target status and troubleshooting](#lattice-vpc-egress-target-status)
+ [Limitations and considerations](#lattice-vpc-egress-limitations)

## Key concepts
<a name="lattice-vpc-egress-concepts"></a>

 **Resource Gateway**   
An Amazon VPC Lattice resource gateway is the point of ingress into your VPC. It is associated with one or more subnets and security groups in your VPC and acts as the network entry point for traffic from AgentCore. When you use managed Lattice, AgentCore creates and manages this resource on your behalf.

 **Resource Configuration**   
A resource configuration represents a specific private endpoint - an IP address or DNS name - within your VPC. It is attached to a resource gateway and defines which resource AgentCore can reach. When you use managed Lattice, AgentCore creates this resource in the AgentCore service account on your behalf.

 **Service Network Resource Association**   
A service network resource association connects a resource configuration to the AgentCore service network, enabling the AgentCore service to invoke your private endpoint. AgentCore always creates and manages this association on your behalf, regardless of whether you use managed or self-managed Lattice.

 **Routing domain**   
An optional field that specifies an intermediate publicly resolvable domain that AgentCore uses as the resource configuration domain instead of the actual target domain. This is required when your private endpoint uses a domain that is not publicly resolvable, because Amazon VPC Lattice requires publicly resolvable DNS for resource configurations. The AgentCore service continues to invoke the actual target domain using SNI override. For more information, see [Workaround for private DNS support: routing domain](#lattice-vpc-egress-routing-domain).

## Supported Amazon Bedrock AgentCore services
<a name="lattice-vpc-egress-supported-services"></a>

The following Amazon Bedrock AgentCore services support VPC egress with VPC Lattice:

 **AgentCore Gateway**   
AgentCore Gateway supports private endpoints for MCP server and OpenAPI target types. For details on configuring VPC egress for each target type, see [Configure Amazon Bedrock AgentCore Gateway VPC Egress for Gateway Targets](gateway-vpc-egress.md).

## Supported VPC egress modes
<a name="lattice-vpc-egress-compare-modes"></a>

Amazon Bedrock AgentCore supports two modes for configuring VPC Lattice connectivity:
+  **Managed Lattice** — Amazon Bedrock AgentCore creates and manages the VPC Lattice resource gateway and resource configuration on your behalf. You provide your VPC, subnets, and optional security groups. This is the simpler approach for in-account VPC connectivity that plugs into existing network architectures such as hub-and-spoke.
+  **Self-managed Lattice** — You create and manage the VPC Lattice resource gateway and resource configuration yourself. This approach provides enhanced governance and visibility: you can see exactly which services are connected to which domains, who has access, and revoke connections at a granular level. It also enables direct cross-account connectivity via AWS RAM without requiring VPC peering or Transit Gateways.

The following table summarizes the key differences:


| Dimension | Managed Lattice | Self-managed Lattice | 
| --- | --- | --- | 
|  Complexity  |  Simple — provide VPC, subnets, and security groups. Amazon Bedrock AgentCore manages the rest.  |  Advanced — you create and manage VPC Lattice resource gateways and resource configurations yourself.  | 
|  Cross-account connectivity  |  Not supported. Use with existing network architectures such as hub-and-spoke (VPC peering or AWS Transit Gateway) for cross-account or cross-VPC scenarios.  |  Supported via AWS RAM. Enables direct cross-account connectivity without requiring VPC peering or Transit Gateways.  | 
|  VPC Lattice pricing  |  Data processing charges only (per GB processed through the resource gateway).  |  Hourly charge per VPC resource added to a service network, plus data processing charges (per GB).  | 
|  Resource lifecycle  |  Amazon Bedrock AgentCore creates, reuses, and deletes resource gateways on your behalf.  |  You own the full lifecycle of resource gateways and resource configurations.  | 
|  Governance and visibility  |  Resource configurations are managed in the Amazon Bedrock AgentCore service account. You do not see them in your VPC Lattice console.  |  Full visibility into resource configurations, service network associations, and connected domains. You can audit connections and revoke access at a granular level.  | 
|  IP consumption and throughput  |  Each managed resource gateway consumes 1 IP address per subnet. This is not configurable.  |  You can configure the number of IP addresses per ENI (up to the VPC Lattice maximum) when creating the resource gateway. More IPs allow higher throughput — the combination of port range and IP addresses determines the maximum number of concurrent connections for that service network resource association. Note that there is a 350-second port cooldown period after a connection ends before that port can be reused.  | 

For VPC Lattice pricing details, see [Amazon VPC Lattice pricing](https://aws.amazon.com/vpc/lattice/pricing/).

## Option 1: Managed Lattice
<a name="lattice-vpc-egress-managed-lattice"></a>

With managed Lattice, you provide your VPC, subnet, and optional security group information. AgentCore handles the creation and lifecycle management of the VPC Lattice resource gateway and resource configuration on your behalf, and does not require you to have VPC Lattice permissions in your own IAM policies.

AgentCore uses the `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` service-linked role to create and manage VPC Lattice resource gateways in your account. This role is created automatically the first time you create a gateway target with a managed private endpoint. For more information about this role, see [Gateway service-linked role](service-linked-roles.md#gateway-service-linked-role).

### Prerequisites
<a name="lattice-vpc-egress-managed-lattice-prereqs"></a>

Before creating a gateway target with a managed private endpoint, ensure the following:
+ Your private resource (MCP server or REST API) is running and accessible within your VPC.
+ You have at least one subnet in your VPC that has network access to the private resource.
+ Your security groups allow inbound traffic on the port used by your private resource (typically port 443 for HTTPS).
+ Your IAM principal has the `iam:CreateServiceLinkedRole` permission for `bedrock-agentcore.amazonaws.com` , so that AgentCore can create the service-linked role on your behalf if it does not already exist. For the required IAM policy, see [Gateway service-linked role](service-linked-roles.md#gateway-service-linked-role).
+ Your IAM principal has the following Amazon EC2 permissions, which are required for AgentCore to set up the VPC Lattice resource gateway in your VPC:
  +  `ec2:CreateNetworkInterface` 
  +  `ec2:DescribeVpcs` 
  +  `ec2:DescribeSecurityGroups` 
  +  `ec2:DescribeSubnets` 
+ If your private endpoint uses a domain that is not publicly resolvable, you must use the `routingDomain` field. For more information, see [Workaround for private DNS support: routing domain](#lattice-vpc-egress-routing-domain).
+ If your private resource uses a TLS certificate issued by a private certificate authority, you can place an internal Application Load Balancer with a public ACM certificate in front of it. For more information, see [Workaround for private certificates: ALB](#lattice-vpc-egress-private-certs).

### Create a target with a managed private endpoint
<a name="lattice-vpc-egress-managed-lattice-create"></a>

To create a resource with a managed private endpoint, include the `privateEndpoint.managedVpcResource` block in your create request.

```
{
  ...
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0abc123def456",
      "subnetIds": ["subnet-0abc123", "subnet-0def456"],
      "endpointIpAddressType": "IPV4",
      "securityGroupIds": ["sg-0abc123def"]
    }
  },
  ...
}
```

The `managedVpcResource` block accepts the following fields:

 `vpcIdentifier` (required)  
The ID of the VPC that contains your private resource.

 `subnetIds` (required)  
A list of subnet IDs within the VPC where the resource gateway will be placed.

 `endpointIpAddressType` (required)  
The IP address type for the resource configuration. Valid values are `IPV4` and `IPV6`.

 `securityGroupIds` (optional)  
A list of security group IDs to associate with the resource gateway. If not provided, the default security group for the VPC is used.

 `routingDomain` (optional)  
An intermediate publicly resolvable domain to use as the resource configuration endpoint. Required when your private endpoint domain is not publicly resolvable. For more information, see [Workaround for private DNS support: routing domain](#lattice-vpc-egress-routing-domain).

 `tags` (optional)  
Tags to apply to the managed VPC Lattice resource gateway. The tag key `BedrockAgentCoreGatewayManaged` is reserved and cannot be specified.

### View managed resources
<a name="lattice-vpc-egress-managed-lattice-response"></a>

After the resource is created, call the relevant Get API (for example, `GetGatewayTarget` ) to view the managed VPC Lattice resources that AgentCore created on your behalf. These are returned in the `privateEndpointManagedResources` field of the response:

```
{
  ...
  "status": "READY",
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0abc123def456",
      "subnetIds": ["subnet-0abc123", "subnet-0def456"],
      "endpointIpAddressType": "IPV4",
      "securityGroupIds": ["sg-0abc123def"]
    }
  },
  "privateEndpointManagedResources": [
    {
      "domain": "my-server.internal.example.com",
      "resourceGatewayArn": "arn:aws:vpc-lattice:us-east-1:123456789012:resourcegateway/rgw-abc123"
    }
  ]
}
```

The `resourceGatewayArn` is the ARN of the VPC Lattice resource gateway that AgentCore created in your account. AgentCore manages the full lifecycle of this resource: it reuses the same resource gateway for targets with matching VPC and subnet configurations, and deletes it when it is no longer used by any targets.

## Option 2: Self-managed Lattice
<a name="lattice-vpc-egress-self-managed-lattice"></a>

With self-managed Lattice, you create and manage the VPC Lattice resource gateway and resource configuration yourself, then provide the resource configuration identifier to AgentCore. Use this option if you already have VPC Lattice resources configured, need to share a resource configuration across multiple services, or require control over the Lattice resource lifecycle.

### Prerequisites
<a name="lattice-vpc-egress-self-managed-lattice-prereqs"></a>

Before creating a gateway target with a self-managed private endpoint, complete the following steps:
+ Your private resource (MCP server or REST API) is running and accessible within your VPC.
+ You have at least one subnet in your VPC that has network access to the private resource.
+ Your security groups allow inbound traffic on the port used by your private resource (typically port 443 for HTTPS).
+ If your private endpoint uses a domain that is not publicly resolvable, you must use the `routingDomain` field. For more information, see [Workaround for private DNS support: routing domain](#lattice-vpc-egress-routing-domain).
+ If your private resource uses a TLS certificate issued by a private certificate authority, you can place an internal Application Load Balancer with a public ACM certificate in front of it. For more information, see [Workaround for private certificates: ALB](#lattice-vpc-egress-private-certs).

 **Set up VPC Lattice resources for self-managed connectivity** 

1.  **Create a Resource Gateway** in your VPC using the VPC Lattice console or the `CreateResourceGateway` API. Associate it with the subnets and security groups that have access to your private resource.

   ```
   aws vpc-lattice create-resource-gateway \
     --name my-resource-gateway \
     --vpc-identifier vpc-0abc123def456 \
     --subnet-ids subnet-0abc123 subnet-0def456 \
     --security-group-ids sg-0abc123def \
     --ip-address-type IPV4
   ```

1.  **Create a Resource Configuration** that points to your private endpoint. Use the ARN of the resource gateway you created in the previous step.

   ```
   aws vpc-lattice create-resource-configuration \
     --name my-resource-config \
     --type SINGLE \
     --resource-gateway-identifier <resource-gateway-arn> \
     --resource-configuration-definition '{"dnsResource": {"domain": "my-service.internal.example.com", "ipAddressType": "IPV4"}}' \
     --port-ranges 443
   ```

1.  **If the resource is in a different account** than the AgentCore owner account, share the resource configuration with the AgentCore owner account using AWS RAM:

   ```
   aws ram create-resource-share \
     --name my-resource-config-share \
     --resource-arns <resource-configuration-arn> \
     --principals <gateway-owner-account-id>
   ```

   The AgentCore owner account must accept the resource share before creating the target.

1. Note the resource configuration ARN or ID. You will provide this as the `resourceConfigurationIdentifier` when creating the gateway target.

Your IAM principal also needs the following permissions to allow AgentCore to associate the resource configuration with the AgentCore service network on your behalf:

```
{
"Version": "2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "vpc-lattice:GetResourceConfiguration",
        "vpc-lattice:CreateServiceNetworkResourceAssociation",
        "vpc-lattice:GetServiceNetworkResourceAssociation",
        "vpc-lattice:ListServiceNetworkResourceAssociations",
        "vpc-lattice:AssociateViaAWSService"
      ],
      "Resource": "*"
    }
  ]
}
```

### Create a target with a self-managed private endpoint
<a name="lattice-vpc-egress-self-managed-lattice-create"></a>

To create a resource with a self-managed private endpoint, include the `privateEndpoint.selfManagedLatticeResource` block in your create request:

```
{
  ...
  "privateEndpoint": {
    "selfManagedLatticeResource": {
      "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123"
    }
  },
  ...
}
```

The `resourceConfigurationIdentifier` can be either the ARN or the ID of the VPC Lattice resource configuration. AgentCore uses your credentials (via [Forward Access Sessions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_forward_access_sessions.html) ) to associate the resource configuration with the AgentCore service network.

After the resource is created, the Get API response includes the `resourceAssociationArn` in the `privateEndpointManagedResources` field. If you create multiple resources pointing to the same resource configuration, AgentCore automatically reuses the existing service network resource association.

### Cross-account private resources
<a name="lattice-vpc-egress-cross-account"></a>

You can connect AgentCore to private resources in a different AWS account than the account that owns the gateway. This is a common pattern for platform teams that manage centralized gateways while individual service teams own the private resources.

The resource owner account must share the VPC Lattice resource configuration with the gateway owner account using AWS RAM. The gateway owner account then provides the shared resource configuration identifier when creating the gateway target.

The following steps summarize the cross-account setup:

 **Set up cross-account private connectivity** 

1.  **In the resource owner account** : Create a VPC Lattice resource gateway and resource configuration as described in [Prerequisites](#lattice-vpc-egress-self-managed-lattice-prereqs).

1.  **In the resource owner account** : Share the resource configuration with the gateway owner account using AWS RAM:

   ```
   aws ram create-resource-share \
     --name my-resource-config-share \
     --resource-arns <resource-configuration-arn> \
     --principals <gateway-owner-account-id>
   ```

1.  **In the gateway owner account** : Accept the resource share:

   ```
   aws ram accept-resource-share-invitation \
     --resource-share-invitation-arn <invitation-arn>
   ```

1.  **In the gateway owner account** : Create the gateway target using the shared resource configuration identifier, as described in [Create a target with a self-managed private endpoint](#lattice-vpc-egress-self-managed-lattice-create).

## Workaround for private DNS support: routing domain
<a name="lattice-vpc-egress-routing-domain"></a>

Amazon VPC Lattice requires that the domain used in a resource configuration be publicly resolvable. If your private endpoint uses a domain that is only resolvable within your VPC (for example, a private hosted zone in Route 53), you must use the `routingDomain` field.

When using a routing domain, the domain you specify for your target (in the MCP endpoint URL or OpenAPI server URL) should be the actual private DNS name of your resource - i.e. the name that is resolvable within your VPC. The `routingDomain` is a separate, publicly resolvable domain that AgentCore uses only to set up the VPC Lattice resource configuration. At invocation time, AgentCore routes traffic through the routing domain but sends requests with the private DNS name as the TLS SNI hostname, so your resource receives requests addressed to its actual private domain.

The routing domain can be any publicly resolvable domain that routes to your private resource within the VPC — including any existing component in your architecture that already has a publicly resolvable DNS name. Common options include:
+  **VPC endpoint (VPCE) domain for a private API Gateway** - Use the VPCE DNS name as the `routingDomain` , for example `<vpce-id>.execute-api.us-east-1.vpce.amazonaws.com` . Set the target URL in your OpenAPI spec to the private API Gateway hostname, for example `https://<api-id>.execute-api.us-east-1.amazonaws.com` . AgentCore routes traffic through the VPCE domain but sends requests with the private API hostname as the TLS SNI, ensuring correct routing within your VPC.
+  **Internal Application Load Balancer (ALB)** - Use the internal ALB DNS name as the `routingDomain` , for example `internal-<alb-name>-<id>.us-west-2.elb.amazonaws.com` . Set the target URL to the private DNS name of the resource behind the ALB.
+  **Internal Network Load Balancer (NLB)** - Use the internal NLB DNS name as the `routingDomain` , for example `internal-<nlb-name>-<id>.elb.us-west-2.amazonaws.com` . Set the target URL to the private DNS name of the resource behind the NLB.

The following steps describe the traffic flow when a routing domain is used:

1. AgentCore resolves the VPC Lattice-generated DNS name to reach the resource gateway.

1. Traffic enters your VPC through the resource gateway, addressed to the routing domain.

1. The routing domain (VPCE or ALB) forwards the request to your private resource. The TLS SNI header contains the actual target domain, so your resource receives the request with the correct hostname.

### Example: Private API Gateway with VPCE routing domain
<a name="lattice-vpc-egress-routing-domain-setup"></a>

The following example shows how to create a gateway target for a private API Gateway using its VPCE domain as the routing domain. The target URL is the private API Gateway hostname, and the `routingDomain` is the VPCE DNS name:

```
{
  "name": "my-private-apigw-target",
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "vpc-0123456789abcdef0",
      "subnetIds": ["subnet-0123456789abcdef0", "subnet-0abcdef1234567890"],
      "endpointIpAddressType": "IPV4",
      "routingDomain": "<vpce-id>.execute-api.us-east-1.vpce.amazonaws.com"
    }
  },
  "targetConfiguration": {
    "mcp": {
      "openApiSchema": {
        "inlinePayload": "<OpenAPI spec JSON with server URL matching the public certificate domain, for example https://<api-id>.execute-api.<region>.amazonaws.com>"
      }
    }
  }
}
```

**Note**  
The `routingDomain` field is only available for the `managedVpcResource` option. For self-managed Lattice, configure the routing domain directly in your resource configuration when you create it.

## Workaround for private certificates: ALB
<a name="lattice-vpc-egress-private-certs"></a>

VPC egress requires your target endpoint to have a publicly trusted TLS certificate. If your private resource uses a certificate issued by a private certificate authority (CA), the recommended workaround is to place an internal Application Load Balancer (ALB) in front of your resource.

The following steps describe the traffic flow:

1. Set the target URL to a domain that matches your public ACM certificate (for example, `https://my-server.my-company.com` ).

1. Set the `routingDomain` to the internal ALB DNS name (for example, `internal-my-alb-1234567890.us-west-2.elb.amazonaws.com` ).

1. VPC Lattice routes traffic to the ALB via the routing domain. The TLS SNI is set to `my-server.my-company.com` , which matches the ALB’s public ACM certificate, so the TLS handshake succeeds.

1. The ALB terminates TLS and applies a host header transform to rewrite the Host header from `my-server.my-company.com` to the private resource’s domain (for example, `my-server.my-company.internal` ).

1. The ALB forwards the request to your backend resource over HTTPS using the private certificate. All traffic stays inside your VPC.

 **Step 1: Request a public ACM certificate** 

Request a public certificate from ACM for a domain you own. This domain will be used as the target URL. For instructions, see [Request a public certificate](https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html) in the AWS Certificate Manager User Guide.

 **Step 2: Create an internal ALB** 

Create an internal Application Load Balancer in the same VPC as your private resource. For instructions, see [Create an Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-application-load-balancer.html) in the Elastic Load Balancing User Guide. Ensure you set the scheme to `internal`.

 **Step 3: Create an IP-based target group** 

Create a target group with target type `ip` that points to your private resource’s IP address on port 443 (HTTPS), and register your private resource as a target. For instructions, see [Create a target group](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-target-group.html) in the Elastic Load Balancing User Guide.

 **Step 4: Create an HTTPS listener with host header transform** 

Create an HTTPS listener on port 443 using the public ACM certificate. Add a listener rule that transforms the Host header from the public domain to the private resource’s domain before forwarding.

```
aws elbv2 create-listener \
  --load-balancer-arn <alb-arn> \
  --protocol HTTPS \
  --port 443 \
  --certificates CertificateArn=<acm-certificate-arn> \
  --default-actions '[{
    "Type": "forward",
    "TargetGroupArn": "<target-group-arn>",
    "ForwardConfig": {
      "TargetGroups": [{"TargetGroupArn": "<target-group-arn>", "Weight": 1}]
    }
  }]'
```

Then modify the listener rule to add the host header transform:

```
aws elbv2 modify-rule \
  --rule-arn <default-rule-arn> \
  --actions '[{
    "Type": "forward",
    "TargetGroupArn": "<target-group-arn>",
    "ForwardConfig": {
      "TargetGroups": [{"TargetGroupArn": "<target-group-arn>", "Weight": 1}]
    }
  }]' \
  --transforms '[{
    "Type": "host-header",
    "HostHeaderConfig": {
      "Values": ["my-server.my-company.internal"]
    }
  }]'
```

 **Step 5: Configure the private endpoint** 

Use the ALB DNS name as the `routingDomain` and the public cert domain as the target URL.

```
{
  ...
  "privateEndpoint": {
    "managedVpcResource": {
      "vpcIdentifier": "<vpc-id>",
      "subnetIds": ["<subnet-id-1>", "<subnet-id-2>"],
      "endpointIpAddressType": "IPV4",
      "routingDomain": "internal-my-alb-1234567890.us-west-2.elb.amazonaws.com"
    }
  },
  ...
}
```

The target URL in your target configuration should use `https://my-server.my-company.com` (the public cert domain), not the private domain.

## Service-linked role for VPC egress
<a name="lattice-vpc-egress-slr"></a>

When you create a gateway target with a managed private endpoint ( `managedVpcResource` ), AgentCore uses the `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` service-linked role to create and manage VPC Lattice resource gateways in your account. This role is created automatically the first time you create a managed private endpoint target, provided your IAM principal has the required `iam:CreateServiceLinkedRole` permission.

The service-linked role has the following key characteristics:
+ It can only create and delete VPC Lattice resource gateways that are tagged with `BedrockAgentCoreGatewayManaged: true` . It cannot modify resource gateways that you create and manage yourself.
+ AgentCore reuses the same managed resource gateway for targets that share the same VPC, subnet, security group, and IP address type configuration. The resource gateway is deleted only when no gateway targets are using it.
+ Resource configurations for managed Lattice are created in the AgentCore service account, not in your account. You will not see them in your VPC Lattice console.

For the full policy document and instructions for creating, editing, and deleting this role, see [Gateway service-linked role](service-linked-roles.md#gateway-service-linked-role).

## Target status and troubleshooting
<a name="lattice-vpc-egress-target-status"></a>

After you create a resource with a private endpoint, the resource goes through a `CREATING` state while AgentCore sets up the VPC Lattice resources and establishes the service network association. You can monitor the status by calling the relevant Get API (for example, `GetGatewayTarget` ) and checking the `status` and `statusReasons` fields.

The following table describes common status values and their meanings:


| Status | Description | 
| --- | --- | 
|   `CREATING`   |  AgentCore is setting up VPC Lattice resources and establishing the service network association. This can take up to a few minutes.  | 
|   `READY`   |  The private endpoint is configured and the target is ready to receive requests.  | 
|   `FAILED`   |  Target creation failed. Check the `statusReasons` field for details. Common causes include missing IAM permissions or an invalid resource configuration identifier.  | 

The following table describes common issues and their solutions:


| Issue | Solution | 
| --- | --- | 
|  Target creation fails with an IAM permission error  |  Ensure your IAM principal has the `iam:CreateServiceLinkedRole` permission for `bedrock-agentcore.amazonaws.com` . For self-managed Lattice, ensure you have the required VPC Lattice permissions listed in [Prerequisites](#lattice-vpc-egress-self-managed-lattice-prereqs).  | 
|  Tool invocations fail with a connection error after target creation  |  Verify that the security groups associated with the resource gateway allow inbound traffic on the port used by your private resource. Also verify that the private resource is running and accessible from the specified subnets.  | 
|  Tool invocations fail with a TLS error  |  If your private resource uses a certificate issued by a private CA, ensure that the certificate’s Subject Alternative Name (SAN) matches the domain in your MCP endpoint or OpenAPI server URL. If using a routing domain, ensure the routing domain correctly forwards TLS to your private resource.  | 
|  Resource configuration not found (self-managed)  |  For cross-account scenarios, ensure the AWS RAM resource share has been accepted in the gateway owner account before creating the target.  | 

## Limitations and considerations
<a name="lattice-vpc-egress-limitations"></a>

Be aware of the following limitations during the public preview of VPC egress for AgentCore:
+  **Private DNS** : Amazon VPC Lattice requires publicly resolvable DNS for resource configurations. If your private endpoint uses a domain that is only resolvable within your VPC, you must use the `routingDomain` field with a publicly resolvable intermediate domain such as a VPCE domain or internal ALB DNS name.
+  **Cross-account** : Cross-account private connectivity requires the self-managed Lattice option. Managed Lattice does not support cross-account scenarios.
+  **DNS TTL configuration** : VPC Lattice uses IP-based routing. Ensure that DNS TTLs for your resource configuration domain are configured appropriately so that IP address changes during rolling deployments do not cause connectivity disruption.

# Configure Amazon Bedrock AgentCore Runtime and tools for VPC
<a name="agentcore-vpc"></a>

You can configure Amazon Bedrock AgentCore Runtime and built-in tools (Code Interpreter and Browser Tool) to connect to resources in your Amazon Virtual Private Cloud (VPC). By configuring VPC connectivity, you enable secure access to private resources such as databases, internal APIs, and services within your VPC.

## VPC connectivity for Amazon Bedrock AgentCore Runtime and tools
<a name="vpc-connectivity-agentcore"></a>

To enable Amazon Bedrock AgentCore Runtime and built-in tools to securely access resources in your private VPC, AgentCore provides VPC connectivity capabilities. This feature allows your runtime and tools to:
+ Connect to private resources without exposing them to the internet
+ Maintain secure communications within your organization’s network boundaries
+ Access enterprise data stores and internal services while preserving security

When you configure VPC connectivity for Amazon Bedrock AgentCore Runtime and tools:
+ Amazon Bedrock creates elastic network interfaces (ENIs) in your VPC using the service-linked role `AWSServiceRoleForBedrockAgentCoreNetwork` 
+ These ENIs enable your Amazon Bedrock AgentCore Runtime and tools to securely communicate with resources in your VPC
+ Each ENI is assigned a private IP address from the subnets you specify
+ Security groups attached to the ENIs control which resources your runtime and tools can communicate with

**Note**  
ENIs are shared resources across agents that use the same subnet and security group configuration. When you delete an agent, the associated ENI may persist in your VPC for up to 8 hours before it is automatically removed.

**Note**  
VPC connectivity impacts inbound and outbound network traffic from AgentCore services. When you host your application in an AWS VPC, you can establish private connectivity to the AgentCore Runtime and AgentCore Gateway APIs by adding the AgentCore VPC endpoint to your VPC. This enables secure API calls, without internet traversal, through VPC PrivateLink inbound connections.

## Prerequisites
<a name="agentcore-prerequisites"></a>

Before configuring Amazon Bedrock AgentCore Runtime and tools for VPC access, ensure you have:
+ An Amazon VPC with appropriate subnets for your runtime and tool requirements. For example, to configure your subnets to have internet access, see [Internet access considerations](#agentcore-internet-access).
+ Subnets located in supported Availability Zones for your region. For information about supported Availability Zones, see [Supported Availability Zones](#agentcore-supported-azs).
+ Appropriate security groups defined in your VPC for runtime and tool access patterns. For example, to configure your security groups to connect to Amazon RDS, see [Example: Connecting to an Amazon RDS database](#agentcore-security-groups-example).
+ Required IAM permissions to create and manage the service-linked role (already included in the AWS managed policy [BedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html) ). For information about required permissions, see [IAM permissions](#agentcore-iam-permissions).
+ Required VPC endpoints if your VPC doesn’t have internet access. For example, to configure your VPC endpoints, see [VPC endpoint configuration](#agentcore-vpc-endpoints).
+ Understanding of your runtime and tool network requirements (databases, APIs, web resources). If you need to use Browser tool which requires internet access, then your VPC should have internet access through NAT Gateway. For example, see [Security group considerations](#agentcore-security-groups).

**Important**  
AgentCore creates a network interface in your account with a private IP address. Using a public subnet does not provide internet connectivity. To enable internet access, place it in private subnets with a route to a NAT Gateway.

## Supported Availability Zones
<a name="agentcore-supported-azs"></a>

AgentCore supports VPC connectivity in specific Availability Zones within each supported region. When configuring subnets for your Amazon Bedrock AgentCore Runtime and built-in tools, ensure that your subnets are located in the supported Availability Zones for your region.

The following table shows the supported Availability Zone IDs for each region:


| Region | Region Code | Supported Availability Zones | 
| --- | --- | --- | 
|  US East (N. Virginia)  |  us-east-1  |  use1-az1 use1-az2 use1-az4  | 
|  US East (Ohio)  |  us-east-2  |  use2-az1 use2-az2 use2-az3  | 
|  US West (Oregon)  |  us-west-2  |  usw2-az1 usw2-az2 usw2-az3  | 
|  Asia Pacific (Sydney)  |  ap-southeast-2  |  apse2-az1 apse2-az2 apse2-az3  | 
|  Asia Pacific (Mumbai)  |  ap-south-1  |  aps1-az1 aps1-az2 aps1-az3  | 
|  Asia Pacific (Singapore)  |  ap-southeast-1  |  apse1-az1 apse1-az2 apse1-az3  | 
|  Asia Pacific (Tokyo)  |  ap-northeast-1  |  apne1-az1 apne1-az2 apne1-az4  | 
|  Europe (Ireland)  |  eu-west-1  |  euw1-az1 euw1-az2 euw1-az3  | 
|  Europe (Frankfurt)  |  eu-central-1  |  euc1-az1 euc1-az2 euc1-az3  | 
|  Europe (Stockholm)  |  eu-north-1  |  eun1-az1 eun1-az2 eun1-az3  | 
|  Europe (Paris)  |  eu-west-3  |  euw3-az1 euw3-az2 euw3-az3  | 
|  Asia Pacific (Seoul)  |  ap-northeast-2  |  apne2-az1 apne2-az2 apne2-az3  | 
|  Europe (London)  |  eu-west-2  |  euw2-az1 euw2-az2 euw2-az3  | 
|  Canada (Central)  |  ca-central-1  |  cac1-az1 cac1-az2 cac1-az4  | 

**Important**  
Subnets must be located in the supported Availability Zones listed above. If you specify subnets in unsupported Availability Zones, the configuration will fail during resource creation.

To identify the Availability Zone ID of your subnets, you can use the following CLI command:

```
aws ec2 describe-subnets --subnet-ids subnet-12345678 --query 'Subnets[0].AvailabilityZoneId'
```

## IAM permissions
<a name="agentcore-iam-permissions"></a>

AgentCore uses the service-linked role `AWSServiceRoleForBedrockAgentCoreNetwork` to create and manage network interfaces in your VPC. This role is automatically created when you first configure Amazon Bedrock AgentCore Runtime or AgentCore built-in tools to use VPC connectivity.

If you need to create this role manually, your IAM entity needs the following permissions:

```
{
    "Action": "iam:CreateServiceLinkedRole",
    "Effect": "Allow",
    "Resource": "arn:aws:iam::*:role/aws-service-role/network.bedrock-agentcore.amazonaws.com/AWSServiceRoleForBedrockAgentCoreNetwork",
    "Condition": {
        "StringLike": {
            "iam:AWSServiceName": "network.bedrock-agentcore.amazonaws.com"
        }
    }
}
```

This permission is already included in the AWS managed policy [BedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html).

## Best practices
<a name="agentcore-best-practices"></a>

For optimal performance and security with VPC-connected Amazon Bedrock AgentCore Runtime and built-in tools:
+  **High Availability** :
  + Configure at least two private subnets in different Availability Zones. For a list of supported Availability Zones, see [Supported Availability Zones](#agentcore-supported-azs).
  + Deploy dependent resources (such as databases or caches) with multi-AZ support to avoid single points of failure.
+  **Network Performance** :
  + Place Amazon Bedrock AgentCore Runtime or built-in tools subnets in the same Availability Zones as the resources they connect to. This reduces cross-AZ latency and data transfer costs.
  + Use VPC endpoints for AWS services whenever possible. Endpoints provide lower latency, higher reliability, and avoid NAT gateway charges for supported services.
+  **Security** :
  + Apply the principle of least privilege when creating security group rules.
  + Enable VPC Flow Logs for auditing and monitoring. Review logs regularly to identify unexpected traffic patterns.
+  **Internet Access** :
  + To provide internet access from Amazon Bedrock AgentCore Runtime or built-in tools inside a VPC, configure a NAT gateway in a public subnet. Update the route table for private subnets to send outbound traffic (0.0.0.0/0) to the NAT gateway.
  + We recommend using VPC endpoints for AWS services instead of internet routing to improve security and reduce costs.

## Configuring VPC access for runtime and tools
<a name="agentcore-configuration"></a>

You can configure VPC access for Amazon Bedrock AgentCore Runtime and built-in tools using the AWS Management Console, AWS CLI, or AWS SDKs.

### Runtime configuration
<a name="runtime-config"></a>

**Example**  

1. Open the AgentCore console at [https://console.aws.amazon.com/bedrock-agentcore/home\$1](https://console.aws.amazon.com/bedrock-agentcore/home#).

1. Navigate to the AgentCore section

1. Select or create an Amazon Bedrock AgentCore Runtime configuration

1. Choose your ECR image

1. Under the Network configuration section, choose **VPC** 

1. Select your VPC from the dropdown list

1. Select the appropriate subnets for your application needs

1. Select one or more security groups to apply to the ENIs

1. Save your configuration

1. 

   ```
   aws bedrock-agentcore-control create-agent-runtime \
     --agent-runtime-name "MyAgentRuntime" \
     --network-configuration '{
         "networkMode": "VPC",
         "networkModeConfig": {
           "subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"],
           "securityGroups": ["sg-0123456789abcdef0"]
         }
       }'
   ```

1. 

   ```
   import boto3
   
   client = boto3.client('bedrock-agentcore')
   
   response = client.create_runtime(
       runtimeName='MyAgentRuntime',
       networkConfiguration={
           'networkMode': 'VPC',
           'networkModeConfig': {
               'subnets': ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1'],
               'securityGroups': ['sg-0123456789abcdef0']
           }
       },
       lifecycleConfiguration={
           'idleRuntimeSessionTimeout': 300,  # 5 min, configurable
           'maxLifetime': 1800                # 30 minutes, configurable
       },
   )
   ```

### Code Interpreter configuration
<a name="code-interpreter-config"></a>

**Example**  

1. Open the AgentCore console at [https://console.aws.amazon.com/bedrock-agentcore/home\$1](https://console.aws.amazon.com/bedrock-agentcore/home#).

1. Navigate to AgentCore → Built-in Tools → Code Interpreter

1. Select **Create Code Interpreter** or modify existing configuration

1. Provide a tool name (optional)

1. Configure execution role with necessary permissions

1. Under Network configuration, choose **VPC** 

1. Select your VPC from the dropdown

1. Choose appropriate subnets (recommend private subnets across multiple AZs with NAT gateway)

1. Select security groups for ENI access control

1. Configure execution role with necessary permissions

1. Save your configuration

1. 

   ```
   aws bedrock-agentcore-control create-code-interpreter \
     --region <Region> \
     --name "my-code-interpreter" \
     --description "My Code Interpreter with VPC mode for data analysis" \
     --execution-role-arn "arn:aws:iam::123456789012:role/my-execution-role" \
     --network-configuration '{
       "networkMode": "VPC",
       "networkModeConfig": {
         "subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"],
         "securityGroups": ["sg-0123456789abcdef0"]
       }
     }'
   ```

1. 

   ```
   import boto3
   
   # Initialize the boto3 client
   cp_client = boto3.client(
       'bedrock-agentcore-control',
       region_name="<Region>",
       endpoint_url="https://bedrock-agentcore-control.<Region>.amazonaws.com"
   )
   
   # Create a Code Interpreter
   response = cp_client.create_code_interpreter(
       name="myTestVpcCodeInterpreter",
       description="Test code sandbox for development",
       executionRoleArn="arn:aws:iam::123456789012:role/my-execution-role",
       networkConfiguration={
           'networkMode': 'VPC',
           'networkModeConfig': {
               'subnets': ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1'],
               'securityGroups': ['sg-0123456789abcdef0']
           }
       }
   )
   
   # Print the Code Interpreter ID
   code_interpreter_id = response["codeInterpreterId"]
   print(f"Code Interpreter ID: {code_interpreter_id}")
   ```

### Browser Tool configuration
<a name="browser-tool-config"></a>

**Example**  

1. Open the AgentCore console at [https://console.aws.amazon.com/bedrock-agentcore/home\$1](https://console.aws.amazon.com/bedrock-agentcore/home#).

1. In the navigation pane, choose **Built-in tools** 

1. Choose **Create Browser tool** 

1. Provide a tool name (optional) and description (optional)

1. Set execution role permissions

1. Under the Network configuration section, choose **VPC** mode

1. Select your VPC and subnets

1. Configure security groups for web access requirements

1. Set execution role permissions

1. Save your configuration

1. 

   ```
   aws bedrock-agentcore-control create-browser \
     --region <Region> \
     --name "my-browser" \
     --description "My browser for web interaction" \
     --network-configuration '{
       "networkMode": "VPC",
       "networkModeConfig": {
         "subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"],
         "securityGroups": ["sg-0123456789abcdef0"]
       }
     }' \
     --recording '{
       "enabled": true,
       "s3Location": {
         "bucket": "my-bucket-name",
         "prefix": "sessionreplay"
       }
     }' \
     --execution-role-arn "arn:aws:iam::123456789012:role/my-execution-role"
   ```

1. 

   ```
   import boto3
   
   # Initialize the boto3 client
   cp_client = boto3.client(
       'bedrock-agentcore-control',
       region_name="<Region>",
       endpoint_url="https://bedrock-agentcore-control.<Region>.amazonaws.com"
   )
   
   # Create a Browser
   response = cp_client.create_browser(
       name="myTestVpcBrowser",
       description="Test browser with VPC mode for development",
       networkConfiguration={
           'networkMode': 'VPC',
           'networkModeConfig': {
               'subnets': ['subnet-0123456789abcdef0', 'subnet-0123456789abcdef1'],
               'securityGroups': ['sg-0123456789abcdef0']
           }
       },
       executionRoleArn="arn:aws:iam::123456789012:role/Sessionreplay",
       recording={
           "enabled": True,
           "s3Location": {
               "bucket": "session-record-123456789012",
               "prefix": "replay-data"
           }
       }
   )
   ```

## Security group considerations
<a name="agentcore-security-groups"></a>

Security groups act as virtual firewalls for your Amazon Bedrock AgentCore Runtime or built-in tool when connected to a VPC. They control inbound and outbound traffic at the instance level. To configure security groups for your runtime:
+  **Outbound rules** – Define outbound rules to allow your Amazon Bedrock AgentCore Runtime to connect to required VPC resources.
+  **Inbound rules** – Ensure that the target resource’s security group allows inbound connections from the security group associated with your Amazon Bedrock AgentCore Runtime.
+  **Least privilege** – Apply the principle of least privilege by allowing only the minimum required traffic.

### Example: Connecting to an Amazon RDS database
<a name="agentcore-security-groups-example"></a>

When your Amazon Bedrock AgentCore Runtime connects to an Amazon RDS database, configure the security groups as follows:

 **Amazon Bedrock AgentCore Runtime security group** 
+  **Outbound** – Allow TCP traffic to the RDS database’s security group on port 3306 (MySQL).
+  **Inbound** – Not required. The runtime only initiates outbound connections.

 **Amazon RDS database security group** 
+  **Inbound** – Allow TCP traffic from the Amazon Bedrock AgentCore Runtime security group on port 3306.
+  **Outbound** – Not required. Return traffic is automatically allowed because security groups are stateful.

## VPC endpoint configuration
<a name="agentcore-vpc-endpoints"></a>

When running Amazon Bedrock AgentCore Runtime in a VPC, we strongly recommend configuring the following VPC endpoints. These endpoints are **required** if your VPC does not have internet access, and **strongly recommended** even if your VPC has a NAT gateway, to avoid NAT gateway data processing charges.

### Required VPC endpoints
<a name="agentcore-required-endpoints"></a>
+  **Amazon ECR Requirements** :
  + Docker endpoint: `com.amazonaws.region.ecr.dkr` 
  + ECR API endpoint: `com.amazonaws.region.ecr.api` 
+  **Amazon S3 Requirements** :
  + Gateway endpoint for ECR docker layer storage: `com.amazonaws.region.s3` 
**Important**  
For container agents, AgentCore periodically refreshes your container image from ECR, which stores image layers in Amazon S3. Without an S3 Gateway VPC Endpoint, this traffic routes through your NAT gateway and incurs data processing charges. An S3 Gateway VPC Endpoint is free and eliminates these charges. We strongly recommend adding this endpoint for all VPC-mode container agents, even if your VPC has internet access via NAT.
+  **CloudWatch Requirements** :
  + Logs endpoint: `com.amazonaws.region.logs` 

**Note**  
Be sure to replace *region* with your specific region if different.

**Note**  
If you are using [Persist session state across stop/resume with a filesystem configuration (Preview)](runtime-persistent-filesystems.md) , ensure your VPC meets the [Networking requirements](runtime-persistent-filesystems.md#session-storage-networking).

### Internet access considerations
<a name="agentcore-internet-access"></a>

When you connect Amazon Bedrock AgentCore Runtime or a built-in tool to a Virtual Private Cloud (VPC), it does not have internet access by default. By default, these resources can communicate only with resources inside the same VPC. If your runtime or tool requires access to both VPC resources and the internet, you must configure your VPC accordingly.

#### Internet access architecture
<a name="agentcore-internet-architecture"></a>

To enable internet access for your VPC-connected Amazon Bedrock AgentCore Runtime or built-in tool, configure your VPC with the following components:
+  **Private subnets** – Place the Amazon Bedrock AgentCore Runtime or tool’s network interfaces in private subnets.
+  **Public subnets with a NAT gateway** – Deploy a NAT gateway in one or more public subnets to provide outbound internet access for private resources.
+  **Internet gateway (IGW)** – Attach an internet gateway to your VPC to enable communication between the NAT gateway and the internet.

#### Routing configuration
<a name="agentcore-routing-configuration"></a>

Update your subnet route tables as follows:
+  **Private subnet route table** – Add a default route (0.0.0.0/0) that points to the NAT gateway. This allows outbound traffic from the runtime or tool to reach the internet.
+  **Public subnet route table** – Add a default route (0.0.0.0/0) that points to the internet gateway. This allows the NAT gateway to communicate with the internet.

**Important**  
Connecting Amazon Bedrock AgentCore Runtime and built-in tools to public subnets does not provide internet access. Always use private subnets with NAT gateways for internet connectivity.

## Monitoring and troubleshooting
<a name="agentcore-monitoring"></a>

To monitor and troubleshoot your VPC-connected Amazon Bedrock AgentCore Runtime and tools:

### CloudWatch Logs
<a name="agentcore-cloudwatch-logs"></a>

Enable CloudWatch Logs for your Amazon Bedrock AgentCore Runtime to identify any connectivity issues:
+ Check error messages related to VPC connectivity
+ Look for timeout errors when connecting to VPC resources
+ Monitor initialization times (VPC connectivity may increase session startup times)

### Common issues and solutions
<a name="agentcore-common-issues"></a>
+  **Connection timeouts** :
  + Verify security group rules are correct
  + Ensure route tables are properly configured
  + Check that the target resource is running and accepting connections
+  **DNS resolution failures** :
  + Ensure that DNS resolution is enabled in your VPC
  + Verify that your DHCP options are configured correctly
+  **Missing ENIs** :
  + Check the IAM permissions to ensure the service-linked role has appropriate permissions
  + Look for any service quotas that may have been reached

### Code Interpreter issues
<a name="code-interpreter-issues"></a>
+  **Code Interpreter invoke call timeouts when trying to call a public endpoint** :
  + Verify that VPC is configured with NAT gateway for internet access
+  **Invoke calls for a Code Interpreter with private VPC endpoints throw "AccessDenied" errors** :
  + Make sure the execution role passed during Code Interpreter creation has the right permissions for AWS service for which VPC endpoint was configured
+  **Invoke calls for a Code Interpreter with some private VPC endpoints show "Unable to locate Credentials" error** :
  + Check that the execution role has been provided while creating the code interpreter

### Browser Tool issues
<a name="browser-tool-issues"></a>
+  **Live-View/Connection Stream is unable to load webpages and fails with connection timeouts** :
  + Check if the browser was created with Private Subnet with NAT Gateway

### Testing VPC connectivity
<a name="testing-connectivity"></a>

To verify that your AgentCore Runtime and tools have proper VPC connectivity, you can test connections to your private resources and verify that network interfaces are created correctly in your specified subnets.

To verify that your AgentCore tool has internet access, you can configure a Code Interpreter with your VPC configuration and use the `Invoke` API with `executeCommand` that attempts to connect to a public API or website using `curl` command and check the response. If the connection times out, review your VPC configuration, particularly your route tables and NAT gateway setup.

```
# Using awscurl
awscurl -X POST \
  "https://bedrock-agentcore.<Region>.amazonaws.com/code-interpreters/<code_interpreter_id>/tools/invoke" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "x-amzn-code-interpreter-session-id: your-session-id" \
  --service bedrock-agentcore \
  --region <Region> \
  -d '{
    "name": "executeCommand",
    "arguments": {
      "command": "curl amazon.com"
    }
  }'
```

# Use IAM condition keys with AgentCore Runtime and built-in tools VPC settings
<a name="security-vpc-condition"></a>

Use AgentCore-specific condition keys for VPC settings to provide additional permission controls for your AgentCore Runtime and built-in tools. For example, require that all runtimes in your organization are connected to a VPC. Specify the subnets and security groups that AgentCore Runtime users can and cannot use.

AgentCore supports the following condition keys in IAM policies:
+  **bedrock-agentcore:subnets** – Allow or deny one or more subnets.
+  **bedrock-agentcore:securityGroups** – Allow or deny one or more security groups.

The AgentCore Control Plane API operations `CreateAgentRuntime` , `UpdateAgentRuntime` , `CreateCodeInterpreter` , and `CreateBrowser` support these condition keys. For more information about using condition keys in IAM policies, see [IAM JSON Policy Elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the IAM User Guide.

## Example policies with condition keys for VPC settings
<a name="example-policies-vpc-condition"></a>

The following examples demonstrate how to use condition keys for VPC settings. Create a policy statement with the desired restrictions, then attach the policy statement to the target user or role.

### Require that users deploy only VPC-connected runtimes and tools
<a name="require-vpc-connected-runtimes"></a>

To require that all users deploy only VPC-connected AgentCore Runtime and built-in tools, deny runtime and tool create and update operations that don’t include valid subnets and security groups.

```
{
    "Sid": "EnforceVPCRuntime",
    "Action": [
        "bedrock-agentcore:CreateAgentRuntime",
        "bedrock-agentcore:UpdateAgentRuntime",
        "bedrock-agentcore:CreateCodeInterpreter",
        "bedrock-agentcore:CreateBrowser"
    ],
    "Effect": "Deny",
    "Resource": "*",
    "Condition": {
        "Null": {
            "bedrock-agentcore:subnets": "true",
            "bedrock-agentcore:securityGroups": "true"
        }
    }
}
```

### Enforce that users use only specific subnets and security groups
<a name="enforce-specific-subnets-security-groups"></a>

To enforce that users use only specific approved subnets and security groups, use the `ForAnyValue` set operator with `StringNotEquals` . The condition returns true if any one of the context key values in the request does not match the context key values in the policy, denying requests that include any unapproved values. The following example enforces that users can only use `subnet-0123456789abcdef0` and `subnet-0123456789abcdef1` for subnets, and `sg-0123456789abcdef0` and `sg-0123456789abcdef1` for security groups.

```
[
  {
    "Sid": "DenyIfNotSpecificSubnets",
    "Effect": "Deny",
    "Action": [
      "bedrock-agentcore:CreateAgentRuntime",
      "bedrock-agentcore:UpdateAgentRuntime",
      "bedrock-agentcore:CreateCodeInterpreter",
      "bedrock-agentcore:CreateBrowser"
    ],
    "Resource": "*",
    "Condition": {
      "ForAnyValue:StringNotEquals": {
        "bedrock-agentcore:subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"]
      }
    }
  },
  {
    "Sid": "DenyIfNotSpecificSecurityGroups",
    "Effect": "Deny",
    "Action": [
      "bedrock-agentcore:CreateAgentRuntime",
      "bedrock-agentcore:UpdateAgentRuntime",
      "bedrock-agentcore:CreateCodeInterpreter",
      "bedrock-agentcore:CreateBrowser"
    ],
    "Resource": "*",
    "Condition": {
      "ForAnyValue:StringNotEquals": {
        "bedrock-agentcore:securityGroups": ["sg-0123456789abcdef0", "sg-0123456789abcdef1"]
      }
    }
  }
]
```

### Deny users access to specific subnets or security groups
<a name="deny-specific-subnets-security-groups"></a>

To deny users access to specific subnets and security groups, use the `ForAnyValue` set operator with `StringEquals` . The condition returns true if any one of the context key values in the request matches any one of the context key values in the policy. The following example denies users access to `subnet-0123456789abcdef0` and `subnet-0123456789abcdef1` for subnets, and `sg-0123456789abcdef0` and `sg-0123456789abcdef1` for security groups.

```
[
  {
    "Sid": "EnforceOutOfSubnet",
    "Action": [
      "bedrock-agentcore:CreateAgentRuntime",
      "bedrock-agentcore:UpdateAgentRuntime",
      "bedrock-agentcore:CreateCodeInterpreter",
      "bedrock-agentcore:CreateBrowser"
    ],
    "Effect": "Deny",
    "Resource": "*",
    "Condition": {
      "ForAnyValue:StringEquals": {
        "bedrock-agentcore:subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"]
      }
    }
  },
  {
    "Sid": "EnforceOutOfSecurityGroups",
    "Action": [
      "bedrock-agentcore:CreateAgentRuntime",
      "bedrock-agentcore:UpdateAgentRuntime",
      "bedrock-agentcore:CreateCodeInterpreter",
      "bedrock-agentcore:CreateBrowser"
    ],
    "Effect": "Deny",
    "Resource": "*",
    "Condition": {
      "ForAnyValue:StringEquals": {
        "bedrock-agentcore:securityGroups": ["sg-0123456789abcdef0", "sg-0123456789abcdef1"]
      }
    }
  }
]
```

# Cross-region inference in Amazon Bedrock AgentCore Memory, Policy in Amazon Bedrock AgentCore, and AgentCore Evaluations
<a name="cross-region-inference"></a>

With cross-region inference, Amazon Bedrock AgentCore Memory, Policy in AgentCore, and AgentCore Evaluations will automatically select the optimal region within your geography (as described in more detail below) to process your inference request, maximizing available compute resources and model availability, and providing the best customer experience.

For AgentCore Memory, Policy in AgentCore, and AgentCore Evaluations, cross-region inference requests are kept within the AWS Regions that are part of the geography where the data originally resides. For example, a request made within the US is kept within the AWS Regions in the US. Although the data remains stored only in the primary region, when using cross-region inference, your input prompts and output results may move outside of your primary region. All data will be transmitted encrypted across Amazon’s secure network.

**Note**  
There’s no additional cost for using cross-region inference. Amazon CloudWatch and AWS CloudTrail logs won’t specify the AWS Region in which data inference occurs. For AgentCore Memory, if you don’t want cross-region inference, you can manage your model selection using a [built-in with overrides strategy](memory-custom-strategy.md) . For AgentCore Evaluations, if you don’t want cross-region inference, please see additional information on creating [custom evaluators](custom-evaluators.md) that operate without CRIS.

**Topics**
+ [Supported Regions for AgentCore Memory cross-region inference](#cross-region-inference-regions)
+ [Supported Regions for Policy in AgentCore cross-region inference](#cross-region-inference-policy-regions)
+ [Supported Regions for AgentCore Evaluations cross-region inference](#cross-region-inference-evaluations-regions)

## Supported Regions for AgentCore Memory cross-region inference
<a name="cross-region-inference-regions"></a>

For a list of Region codes and endpoints supported in AgentCore, see [Supported AWS Regions](agentcore-regions.md) . For endpoints, see [Amazon Bedrock AgentCore endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/bedrock_agentcore.html).


| Supported AgentCore Memory geography | Inference regions | 
| --- | --- | 
|  Canada (Effective 3/31)  |  Canada (Central) (ca-central-1) US East (N. Virginia) (us-east-1) US East (Ohio) (us-east-2) US West (Oregon) (us-west-2)  | 
|  United States  |  US East (N. Virginia) (us-east-1) US East (Ohio) (us-east-2) US West (Oregon) (us-west-2)  | 
|  Europe  |  Europe (Frankfurt) (eu-central-1) Europe (Stockholm) (eu-north-1) Europe (Ireland) (eu-west-1) Europe (London) (eu-west-2) Europe (Paris) (eu-west-3)  | 
|  Asia Pacific  |  Asia Pacific (Tokyo) (ap-northeast-1) Asia Pacific (Seoul) (ap-northeast-2) Asia Pacific (Mumbai) (ap-south-1) Asia Pacific (Singapore) (ap-southeast-1) Asia Pacific (Sydney) (ap-southeast-2)  | 

## Supported Regions for Policy in AgentCore cross-region inference
<a name="cross-region-inference-policy-regions"></a>

For a list of Region codes and endpoints supported in AgentCore, see [Supported AWS Regions](agentcore-regions.md) . For endpoints, see [Amazon Bedrock AgentCore endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/bedrock_agentcore.html).


| Supported Policy in AgentCore geography | Inference regions | 
| --- | --- | 
|  United States  |  US East (N. Virginia) (us-east-1) US East (Ohio) (us-east-2) US West (Oregon) (us-west-2)  | 
|  Europe  |  Europe (Frankfurt) (eu-central-1) Europe (Stockholm) (eu-north-1) Europe (Milan) (eu-south-1) Europe (Spain) (eu-south-2) Europe (Ireland) (eu-west-1) Europe (Paris) (eu-west-3)  | 
|  Asia Pacific  |  Asia Pacific (Tokyo) (ap-northeast-1) Asia Pacific (Seoul) (ap-northeast-2) Asia Pacific (Osaka) (ap-northeast-3) Asia Pacific (Mumbai) (ap-south-1) Asia Pacific (Hyderabad) (ap-south-2) Asia Pacific (Singapore) (ap-southeast-1) Asia Pacific (Sydney) (ap-southeast-2) Asia Pacific (Melbourne) (ap-southeast-4)  | 

## Supported Regions for AgentCore Evaluations cross-region inference
<a name="cross-region-inference-evaluations-regions"></a>

For a list of Region codes and endpoints supported in AgentCore, see [Supported AWS Regions](agentcore-regions.md) . For endpoints, see [Amazon Bedrock AgentCore endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/bedrock_agentcore.html).


| Supported AgentCore Evaluations geography | Inference regions | 
| --- | --- | 
|  United States  |  US East (N. Virginia) (us-east-1) US East (Ohio) (us-east-2) US West (Oregon) (us-west-2)  | 
|  Europe  |  Europe (Frankfurt) (eu-central-1) Europe (Stockholm) (eu-north-1) Europe (Milan) (eu-south-1) Europe (Spain) (eu-south-2) Europe (Ireland) (eu-west-1) Europe (London) (eu-west-2) Europe (Paris) (eu-west-3)  | 
|  Asia Pacific  |  Asia Pacific (Tokyo) (ap-northeast-1) Asia Pacific (Seoul) (ap-northeast-2) Asia Pacific (Osaka) (ap-northeast-3) Asia Pacific (Mumbai) (ap-south-1) Asia Pacific (Hyderabad) (ap-south-2) Asia Pacific (Singapore) (ap-southeast-1) Asia Pacific (Sydney) (ap-southeast-2) Asia Pacific (Melbourne) (ap-southeast-4)  | 

# Identity and access management for Amazon Bedrock AgentCore
<a name="security-iam"></a>

 AWS Identity and Access Management (IAM) is an AWS service that helps an administrator securely control access to AWS resources. IAM administrators control who can be *authenticated* (signed in) and *authorized* (have permissions) to use AgentCore resources. IAM is an AWS service that you can use with no additional charge.

**Topics**
+ [Audience](#security_iam_audience)
+ [Authenticating with identities](#security_iam_authentication)
+ [Managing access using policies](#security_iam_access-manage)
+ [How Amazon Bedrock AgentCore works with IAM](security_iam_service-with-iam.md)
+ [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md)
+ [AWS managed policies for Amazon Bedrock AgentCore](security-iam-awsmanpol.md)
+ [Using service-linked roles for Amazon Bedrock AgentCore](service-linked-roles.md)
+ [Understanding Credentials Management in Amazon Bedrock AgentCore](security-credentials-management.md)
+ [Troubleshooting Amazon Bedrock AgentCore identity and access](security_iam_troubleshoot.md)

## Audience
<a name="security_iam_audience"></a>

How you use AWS Identity and Access Management (IAM) differs based on your role:
+  **Service user** - request permissions from your administrator if you cannot access features (see [Troubleshooting Amazon Bedrock AgentCore identity and access](security_iam_troubleshoot.md) )
+  **Service administrator** - determine user access and submit permission requests (see [How Amazon Bedrock AgentCore works with IAM](security_iam_service-with-iam.md) )
+  **IAM administrator** - write policies to manage access (see [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md) )

## Authenticating with identities
<a name="security_iam_authentication"></a>

Authentication is how you sign in to AWS using your identity credentials. You must be authenticated as the AWS account root user, an IAM user, or by assuming an IAM role.

You can sign in as a federated identity using credentials from an identity source like AWS IAM Identity Center (IAM Identity Center), single sign-on authentication, or Google/Facebook credentials. For more information about signing in, see [How to sign in to your AWS account](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html) in the * AWS Sign-In User Guide*.

For programmatic access, AWS provides an SDK and CLI to cryptographically sign requests. For more information, see [AWS Signature Version 4 for API requests](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html) in the *IAM User Guide*.

### AWS account root user
<a name="security_iam_authentication-rootuser"></a>

When you create an AWS account, you begin with one sign-in identity called the AWS account *root user* that has complete access to all AWS services and resources. We strongly recommend that you don’t use the root user for everyday tasks. For tasks that require root user credentials, see [Tasks that require root user credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks) in the *IAM User Guide*.

### Federated identity
<a name="security_iam_authentication-federated"></a>

As a best practice, require human users to use federation with an identity provider to access AWS services using temporary credentials.

A *federated identity* is a user from your enterprise directory, web identity provider, or Directory Service that accesses AWS services using credentials from an identity source. Federated identities assume roles that provide temporary credentials.

For centralized access management, we recommend AWS IAM Identity Center. For more information, see [What is IAM Identity Center?](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html) in the * AWS IAM Identity Center User Guide*.

### IAM users and groups
<a name="security_iam_authentication-iamuser"></a>

An *IAM user* is an identity with specific permissions for a single person or application. We recommend using temporary credentials instead of IAM users with long-term credentials. For more information, see [Require human users to use federation with an identity provider to access AWS using temporary credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp) in the *IAM User Guide*.

An [IAM group](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) specifies a collection of IAM users and makes permissions easier to manage for large sets of users. For more information, see [Use cases for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html) in the *IAM User Guide*.

### IAM roles
<a name="security_iam_authentication-iamrole"></a>

An *IAM role* is an identity with specific permissions that provides temporary credentials. You can assume a role by [switching from a user to an IAM role (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html) or by calling an AWS CLI or AWS API operation. For more information, see [Methods to assume a role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage-assume.html) in the *IAM User Guide*.

IAM roles are useful for federated user access, temporary IAM user permissions, cross-account access, cross-service access, and applications running on Amazon EC2. For more information, see [Cross account resource access in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html) in the *IAM User Guide*.

## Managing access using policies
<a name="security_iam_access-manage"></a>

You control access in AWS by creating policies and attaching them to AWS identities or resources. A policy defines permissions when associated with an identity or resource. AWS evaluates these policies when a principal makes a request. Most policies are stored in AWS as JSON documents. For more information about JSON policy documents, see [Overview of JSON policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json) in the *IAM User Guide*.

Using policies, administrators specify who has access to what by defining which **principal** can perform **actions** on what **resources** , and under what **conditions**.

By default, users and roles have no permissions. An IAM administrator creates IAM policies and adds them to roles, which users can then assume. IAM policies define permissions regardless of the method used to perform the operation.

### Identity-based policies
<a name="security_iam_access-manage-id-based-policies"></a>

Identity-based policies are JSON permissions policy documents that you attach to an identity (user, group, or role). These policies control what actions identities can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see [Define custom IAM permissions with customer managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html) in the *IAM User Guide*.

Identity-based policies can be *inline policies* (embedded directly into a single identity) or *managed policies* (standalone policies attached to multiple identities). To learn how to choose between managed and inline policies, see [Choose between managed policies and inline policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-choosing-managed-or-inline.html) in the *IAM User Guide*.

### Resource-based policies
<a name="security_iam_access-manage-resource-based-policies"></a>

Resource-based policies are JSON policy documents that you attach to a resource. Examples include IAM *role trust policies* and Amazon S3 *bucket policies* . In services that support resource-based policies, service administrators can use them to control access to a specific resource. You must [specify a principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html) in a resource-based policy.

Resource-based policies are inline policies that are located in that service. You can’t use AWS managed policies from IAM in a resource-based policy.

### Other policy types
<a name="security_iam_access-manage-other-policies"></a>

 AWS supports additional policy types that can set the maximum permissions granted by more common policy types:
+  **Permissions boundaries** – Set the maximum permissions that an identity-based policy can grant to an IAM entity. For more information, see [Permissions boundaries for IAM entities](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) in the *IAM User Guide*.
+  **Service control policies (SCPs)** – Specify the maximum permissions for an organization or organizational unit in AWS Organizations. For more information, see [Service control policies](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html) in the * AWS Organizations User Guide*.
+  **Resource control policies (RCPs)** – Set the maximum available permissions for resources in your accounts. For more information, see [Resource control policies (RCPs)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html) in the * AWS Organizations User Guide*.
+  **Session policies** – Advanced policies passed as a parameter when creating a temporary session for a role or federated user. For more information, see [Session policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) in the *IAM User Guide*.

### Multiple policy types
<a name="security_iam_access-manage-multiple-policies"></a>

When multiple types of policies apply to a request, the resulting permissions are more complicated to understand. To learn how AWS determines whether to allow a request when multiple policy types are involved, see [Policy evaluation logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) in the *IAM User Guide*.

# How Amazon Bedrock AgentCore works with IAM
<a name="security_iam_service-with-iam"></a>

Before you use IAM to manage access to AgentCore, learn what IAM features are available to use with AgentCore.


| IAM feature | AgentCore support | 
| --- | --- | 
|   [Identity-based policies](#security_iam_service-with-iam-id-based-policies)   |  Yes  | 
|   [Resource-based policies](#security_iam_service-with-iam-resource-based-policies)   |  Partial  | 
|   [Policy actions](#security_iam_service-with-iam-id-based-policies-actions)   |  Yes  | 
|   [Policy resources](#security_iam_service-with-iam-id-based-policies-resources)   |  Yes  | 
|   [Policy condition keys](#security_iam_service-with-iam-id-based-policies-conditionkeys)   |  Yes  | 
|   [ACLs](#security_iam_service-with-iam-acls)   |  No  | 
|   [ABAC (tags in policies)](#security_iam_service-with-iam-tags)   |  Partial  | 
|   [Temporary credentials](#security_iam_service-with-iam-roles-tempcreds)   |  Yes  | 
|   [Principal permissions](#security_iam_service-with-iam-principal-permissions)   |  Yes  | 
|   [Service roles](#security_iam_service-with-iam-roles-service)   |  Yes  | 
|   [Service-linked roles](#security_iam_service-with-iam-roles-service-linked)   |  Yes  | 

To get a high-level view of how AgentCore and other AWS services work with most IAM features, see [AWS services that work with IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) in the *IAM User Guide*.

## Identity-based policies for AgentCore
<a name="security_iam_service-with-iam-id-based-policies"></a>

 **Supports identity-based policies:** Yes

Identity-based policies are JSON permissions policy documents that you can attach to an identity, such as an IAM user, group of users, or role. These policies control what actions users and roles can perform, on which resources, and under what conditions. To learn how to create an identity-based policy, see [Define custom IAM permissions with customer managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html) in the *IAM User Guide*.

With IAM identity-based policies, you can specify allowed or denied actions and resources as well as the conditions under which actions are allowed or denied. To learn about all of the elements that you can use in a JSON policy, see [IAM JSON policy elements reference](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html) in the *IAM User Guide*.

### Identity-based policy examples for AgentCore
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>

To view examples of AgentCore identity-based policies, see [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md).

## Resource-based policies within AgentCore
<a name="security_iam_service-with-iam-resource-based-policies"></a>

 **Supports resource-based policies:** Partial

Resource-based policies are JSON policy documents that you attach to a resource. Examples of resource-based policies are IAM *role trust policies* and Amazon S3 *bucket policies* . In services that support resource-based policies, service administrators can use them to control access to a specific resource. For the resource where the policy is attached, the policy defines what actions a specified principal can perform on that resource and under what conditions. You must [specify a principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html) in a resource-based policy. Principals can include accounts, users, roles, federated users, or AWS services.

To enable cross-account access, you can specify an entire account or IAM entities in another account as the principal in a resource-based policy. For more information, see [Cross account resource access in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html) in the *IAM User Guide*.

Amazon Bedrock AgentCore supports resource-based policies for Agent Runtime and Gateway resources. These policies are attached directly to your resources and define which principals can perform actions on them.

To learn how to create and manage resource-based policies for Amazon Bedrock AgentCore resources, see [Resource-based policies for Amazon Bedrock AgentCore](resource-based-policies.md).

### Resource-based policy examples within AgentCore
<a name="security_iam_service-with-iam-resource-based-policies-examples"></a>

To view examples of AgentCore resource-based policies, see [Common use cases and examples](resource-based-policies.md#resource-based-policies-examples).

## Policy actions for AgentCore
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

 **Supports policy actions:** Yes

Administrators can use AWS JSON policies to specify who has access to what. That is, which **principal** can perform **actions** on what **resources** , and under what **conditions**.

The `Action` element of a JSON policy describes the actions that you can use to allow or deny access in a policy. Include actions in a policy to grant permissions to perform the associated operation.

To see a list of AgentCore actions, see [Actions Defined by Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html#amazonbedrockagentcore-actions-as-permissions) in the *Service Authorization Reference*.

Policy actions in AgentCore use the following prefix before the action:

```
bedrock-agentcore
```

To specify multiple actions in a single statement, separate them with commas.

```
"Action": [
      "bedrock-agentcore:action1",
      "bedrock-agentcore:action2"
         ]
```

To view examples of AgentCore identity-based policies, see [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md).

## Policy resources for AgentCore
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

 **Supports policy resources:** Yes

Administrators can use AWS JSON policies to specify who has access to what. That is, which **principal** can perform **actions** on what **resources** , and under what **conditions**.

The `Resource` JSON policy element specifies the object or objects to which the action applies. As a best practice, specify a resource using its [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) . For actions that don’t support resource-level permissions, use a wildcard (\$1) to indicate that the statement applies to all resources.

```
"Resource": "*"
```

To see a list of AgentCore resource types and their ARNs, see [Resources Defined by Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html#amazonbedrockagentcore-resources-for-iam-policies) in the *Service Authorization Reference* . To learn with which actions you can specify the ARN of each resource, see [Actions Defined by Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html#amazonbedrockagentcore-actions-as-permissions).

To view examples of AgentCore identity-based policies, see [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md).

## Policy condition keys for AgentCore
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

 **Supports service-specific policy condition keys:** Yes

Administrators can use AWS JSON policies to specify who has access to what. That is, which **principal** can perform **actions** on what **resources** , and under what **conditions**.

The `Condition` element specifies when statements execute based on defined criteria. You can create conditional expressions that use [condition operators](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) , such as equals or less than, to match the condition in the policy with values in the request. To see all AWS global condition keys, see [AWS global condition context keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html) in the *IAM User Guide*.

To see a list of AgentCore condition keys, see [Condition Keys for Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html#amazonbedrockagentcore-policy-keys) in the *Service Authorization Reference* . To learn with which actions and resources you can use a condition key, see [Actions Defined by Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html#amazonbedrockagentcore-actions-as-permissions).

The following condition keys are especially useful when working with Amazon Bedrock AgentCore:
+  `bedrock-agentcore:InboundJwtClaim/iss` - You can use this condition key to restrict access to APIs that accept a JWT representing an enduser to work with specific issuer (iss) claim values present in the JWT passed in the request. You can apply this condition key to the `GetWorkloadAccessTokenForJwt` and `CompleteResourceTokenAuth` operations.
+  `bedrock-agentcore:InboundJwtClaim/sub` - You can use this condition key to restrict access to APIs that accept a JWT to work with specific subject (sub) claim values present in the JWT passed in the request. You can apply this condition key to the `GetWorkloadAccessTokenForJwt` and `CompleteResourceTokenAuth` operations.
+  `bedrock-agentcore:InboundJwtClaim/aud` - You can use this condition key to restrict access to APIs that accept a JWT to work with specific audience (aud) claim values present in the JWT passed in the request. You can apply this condition key to the `GetWorkloadAccessTokenForJwt` and `CompleteResourceTokenAuth` operations.
+  `bedrock-agentcore:userid` - You can use this condition key to restrict access to APIs that accept a static user ID to work only with the defined user ID values in your policy statement. You can apply this condition key to the `GetWorkloadAccessTokenForUserId` and `CompleteResourceTokenAuth` operations.
+  `bedrock-agentcore:InboundJwtClaim/scope` - You can use this condition key to restrict access based on the scope claim in the JWT passed in the request.
+  `bedrock-agentcore:InboundJwtClaim/client_id` - You can use this condition key to restrict access to APIs that accept a JWT to work with specific `client_id` claim values present in the JWT passed in the request. This key is only available when the JWT has the `client_id` claim exactly and is not available when the information is communicated in other similar claims. You can apply this condition key to the `GetWorkloadAccessTokenForJwt` and `CompleteResourceTokenAuth` operations.

To view examples of AgentCore identity-based policies, see [Identity-based policy examples for Amazon Bedrock AgentCore](security_iam_id-based-policy-examples.md).

## ACLs in AgentCore
<a name="security_iam_service-with-iam-acls"></a>

 **Supports ACLs:** No

Access control lists (ACLs) control which principals (account members, users, or roles) have permissions to access a resource. ACLs are similar to resource-based policies, although they do not use the JSON policy document format.

## ABAC with AgentCore
<a name="security_iam_service-with-iam-tags"></a>

 **Supports ABAC (tags in policies):** Partial

Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes called tags. You can attach tags to IAM entities and AWS resources, then design ABAC policies to allow operations when the principal’s tag matches the tag on the resource.

To control access based on tags, you provide tag information in the [condition element](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) of a policy using the `aws:ResourceTag/key-name` , `aws:RequestTag/key-name` , or `aws:TagKeys` condition keys.

If a service supports all three condition keys for every resource type, then the value is **Yes** for the service. If a service supports all three condition keys for only some resource types, then the value is **Partial**.

For more information about ABAC, see [Define permissions with ABAC authorization](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction_attribute-based-access-control.html) in the *IAM User Guide* . To view a tutorial with steps for setting up ABAC, see [Use attribute-based access control (ABAC)](https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html) in the *IAM User Guide*.

## Using temporary credentials with AgentCore
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

 **Supports temporary credentials:** Yes

Temporary credentials provide short-term access to AWS resources and are automatically created when you use federation or switch roles. AWS recommends that you dynamically generate temporary credentials instead of using long-term access keys. For more information, see [Temporary security credentials in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) and [AWS services that work with IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) in the *IAM User Guide*.

## Cross-service principal permissions for AgentCore
<a name="security_iam_service-with-iam-principal-permissions"></a>

 **Supports forward access sessions (FAS):** Yes

Forward access sessions (FAS) use the permissions of the principal calling an AWS service, combined with the requesting AWS service to make requests to downstream services. For policy details when making FAS requests, see [Forward access sessions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_forward_access_sessions.html).

## Service roles for AgentCore
<a name="security_iam_service-with-iam-roles-service"></a>

 **Supports service roles:** Yes

A service role is an [IAM role](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) that a service assumes to perform actions on your behalf. An IAM administrator can create, modify, and delete a service role from within IAM. For more information, see [Create a role to delegate permissions to an AWS service](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-service.html) in the *IAM User Guide*.

**Warning**  
Changing the permissions for a service role might break AgentCore functionality. Edit service roles only when AgentCore provides guidance to do so.

## Service-linked roles for AgentCore
<a name="security_iam_service-with-iam-roles-service-linked"></a>

 **Supports service-linked roles:** Yes

A service-linked role is a type of service role that is linked to an AWS service. The service can assume the role to perform an action on your behalf. Service-linked roles appear in your AWS account and are owned by the service. An IAM administrator can view, but not edit the permissions for service-linked roles.

For details about creating or managing service-linked roles, see [AWS services that work with IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) . Find a service in the table that includes a `Yes` in the **Service-linked role** column. Choose the **Yes** link to view the service-linked role documentation for that service.

# Identity-based policy examples for Amazon Bedrock AgentCore
<a name="security_iam_id-based-policy-examples"></a>

By default, users and roles don’t have permission to create or modify AgentCore resources. To grant users permission to perform actions on the resources that they need, an IAM administrator can create IAM policies.

To learn how to create an IAM identity-based policy by using these example JSON policy documents, see [Create IAM policies (console)](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create-console.html) in the *IAM User Guide*.

For details about actions and resource types defined by AgentCore, including the format of the ARNs for each of the resource types, see [Actions, Resources, and Condition Keys for Amazon Bedrock AgentCore](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonbedrockagentcore.html) in the *Service Authorization Reference*.

**Topics**
+ [Policy best practices](#security_iam_service-with-iam-policy-best-practices)
+ [Using the AgentCore console](#security_iam_id-based-policy-examples-console)
+ [Allow users to view their own permissions](#security_iam_id-based-policy-examples-view-own-permissions)

## Policy best practices
<a name="security_iam_service-with-iam-policy-best-practices"></a>

Identity-based policies determine whether someone can create, access, or delete AgentCore resources in your account. These actions can incur costs for your AWS account. When you create or edit identity-based policies, follow these guidelines and recommendations:
+  **Get started with AWS managed policies and move toward least-privilege permissions** – To get started granting permissions to your users and workloads, use the * AWS managed policies* that grant permissions for many common use cases. They are available in your AWS account. We recommend that you reduce permissions further by defining AWS customer managed policies that are specific to your use cases. For more information, see [AWS managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies) or [AWS managed policies for job functions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html) in the *IAM User Guide*.
+  **Apply least-privilege permissions** – When you set permissions with IAM policies, grant only the permissions required to perform a task. You do this by defining the actions that can be taken on specific resources under specific conditions, also known as *least-privilege permissions* . For more information about using IAM to apply permissions, see [Policies and permissions in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) in the *IAM User Guide*.
+  **Use conditions in IAM policies to further restrict access** – You can add a condition to your policies to limit access to actions and resources. For example, you can write a policy condition to specify that all requests must be sent using SSL. You can also use conditions to grant access to service actions if they are used through a specific AWS service, such as CloudFormation. For more information, see [IAM JSON policy elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the *IAM User Guide*.
+  **Use IAM Access Analyzer to validate your IAM policies to ensure secure and functional permissions** – IAM Access Analyzer validates new and existing policies so that the policies adhere to the IAM policy language (JSON) and IAM best practices. IAM Access Analyzer provides more than 100 policy checks and actionable recommendations to help you author secure and functional policies. For more information, see [Validate policies with IAM Access Analyzer](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-validation.html) in the *IAM User Guide*.
+  **Require multi-factor authentication (MFA)** – If you have a scenario that requires IAM users or a root user in your AWS account, turn on MFA for additional security. To require MFA when API operations are called, add MFA conditions to your policies. For more information, see [Secure API access with MFA](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html) in the *IAM User Guide*.

For more information about best practices in IAM, see [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) in the *IAM User Guide*.

## Using the AgentCore console
<a name="security_iam_id-based-policy-examples-console"></a>

To access the Amazon Bedrock AgentCore console, you must have a minimum set of permissions. These permissions must allow you to list and view details about the AgentCore resources in your AWS account. If you create an identity-based policy that is more restrictive than the minimum required permissions, the console won’t function as intended for entities (users or roles) with that policy.

You don’t need to allow minimum console permissions for users that are making calls only to the AWS CLI or the AWS API. Instead, allow access to only the actions that match the API operation that they’re trying to perform.

To ensure that users and roles can still use the AgentCore console, also attach the AgentCore *ConsoleAccess* or *ReadOnly* AWS managed policy to the entities. For more information, see [Adding permissions to a user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_change-permissions.html#users_change_permissions-add-console) in the *IAM User Guide*.

## Allow users to view their own permissions
<a name="security_iam_id-based-policy-examples-view-own-permissions"></a>

This example shows how you might create a policy that allows IAM users to view the inline and managed policies that are attached to their user identity. This policy includes permissions to complete this action on the console or programmatically using the AWS CLI or AWS API.

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewOwnUserInfo",
            "Effect": "Allow",
            "Action": [
                "iam:GetUserPolicy",
                "iam:ListGroupsForUser",
                "iam:ListAttachedUserPolicies",
                "iam:ListUserPolicies",
                "iam:GetUser"
            ],
            "Resource": ["arn:aws:iam::*:user/${aws:username}"]
        },
        {
            "Sid": "NavigateInConsole",
            "Effect": "Allow",
            "Action": [
                "iam:GetGroupPolicy",
                "iam:GetPolicyVersion",
                "iam:GetPolicy",
                "iam:ListAttachedGroupPolicies",
                "iam:ListGroupPolicies",
                "iam:ListPolicyVersions",
                "iam:ListPolicies",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}
```

# AWS managed policies for Amazon Bedrock AgentCore
<a name="security-iam-awsmanpol"></a>

An AWS managed policy is a standalone policy that is created and administered by AWS. AWS managed policies are designed to provide permissions for many common use cases so that you can start assigning permissions to users, groups, and roles.

Keep in mind that AWS managed policies might not grant least-privilege permissions for your specific use cases because they’re available for all AWS customers to use. We recommend that you reduce permissions further by defining [customer managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies) that are specific to your use cases.

You cannot change the permissions defined in AWS managed policies. If AWS updates the permissions defined in an AWS managed policy, the update affects all principal identities (users, groups, and roles) that the policy is attached to. AWS is most likely to update an AWS managed policy when a new AWS service is launched or new API operations become available for existing services.

For more information, see [AWS managed policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies) in the *IAM User Guide*.

**Topics**
+ [AWS managed policy: BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess)
+ [AWS managed policy: BedrockAgentCoreNetworkServiceRolePolicy](#security-iam-awsmanpol-BedrockAgentCoreNetworkServiceRolePolicy)
+ [AWS managed policy: AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy](#security-iam-awsmanpol-AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy)
+ [AWS managed policy: BedrockAgentCoreRuntimeIdentityServiceRolePolicy](#security-iam-awsmanpol-BedrockAgentCoreRuntimeIdentityServiceRolePolicy)
+ [AgentCore updates to AWS managed policies](#security-iam-awsmanpol-updates)

## AWS managed policy: BedrockAgentCoreFullAccess
<a name="security-iam-awsmanpol-BedrockAgentCoreFullAccess"></a>

You can attach [BedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html) to your users, groups, and roles.

This policy grants permissions that allow full access to the Amazon Bedrock AgentCore.

 **Permissions details** 

This policy includes the following permissions:
+  `bedrock-agentcore` (Amazon Bedrock Agent Core) – Allows principals full access to all Amazon Bedrock Agent Core resources.
+  `iam` (AWS Identity and Access Management) – Allows principals to list and get information about roles and policies, and to pass roles with "BedrockAgentCore" in the name to the bedrock-agentcore service. Also allows creating service-linked roles for CloudWatch Application Signals, Amazon Bedrock AgentCore network, and Amazon Bedrock AgentCore runtime identity.
+  `secretsmanager` (AWS Secrets Manager) – Allows principals to create, update, retrieve, and delete secrets with names that begin with "bedrock-agentcore".
+  `kms` (AWS Key Management Service) – Allows principals to list and describe keys, and to decrypt data within the same AWS account when called via the Amazon Bedrock AgentCore service.
+  `s3` (Amazon Simple Storage Service) – Allows principals to get objects from S3 buckets with names that begin with "bedrock-agentcore-gateway-" when called via the Amazon Bedrock AgentCore service.
+  `lambda` (AWS Lambda) – Allows principals to list Lambda functions.
+  `logs` (Amazon CloudWatch Logs) – Allows principals to access, query, and manage log data in log groups related to Amazon Bedrock AgentCore and Application Signals, including creating log groups and streams.
+  `application-autoscaling` (Application Auto Scaling) – Allows principals to describe scaling policies.
+  `application-signals` (Amazon CloudWatch Application Signals) – Allows principals to retrieve information about application signals and start discovery.
+  `autoscaling` (Amazon EC2 Auto Scaling) – Allows principals to describe Auto Scaling resources.
+  `cloudwatch` (Amazon CloudWatch) – Allows principals to retrieve and list metrics, generate queries, and access other CloudWatch resources.
+  `oam` (Amazon CloudWatch Observability Access Manager) – Allows principals to list sinks.
+  `rum` (Amazon CloudWatch RUM) – Allows principals to retrieve and list RUM resources.
+  `synthetics` (Amazon CloudWatch Synthetics) – Allows principals to describe and get information about Synthetics resources.
+  `xray` (AWS X-Ray) – Allows principals to retrieve trace information, manage trace segment destinations, and work with indexing rules.
+  `ecr` (Amazon Elastic Container Registry) – Allows principals to describe repositories, list images, and describe images.
+  `bedrock` (Amazon Bedrock) – Allows principals to invoke foundation models and inference profiles for evaluation purposes.

## AWS managed policy: BedrockAgentCoreNetworkServiceRolePolicy
<a name="security-iam-awsmanpol-BedrockAgentCoreNetworkServiceRolePolicy"></a>

This policy is attached to a service-linked role that allows the service to perform actions on your behalf. You cannot attach this policy to your users, groups, or roles.

This policy grants permissions that allow AgentCore to create and manage network interfaces in your VPC when running in VPC mode.

 **Permissions details** 

This policy includes the following permissions:
+  `ec2` (Amazon Elastic Compute Cloud) – Allows the service to create, manage, and delete network interfaces in your VPC, assign and unassign private IP addresses, and describe VPC resources. Network interfaces are tagged with "AmazonBedrockAgentCoreManaged" to ensure the service only manages resources it creates.

You can view this policy at [BedrockAgentCoreNetworkServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreNetworkServiceRolePolicy.html).

For more information about the service-linked role that uses this policy, see [Using service-linked roles for Amazon Bedrock AgentCore](service-linked-roles.md).

## AWS managed policy: AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy
<a name="security-iam-awsmanpol-AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy"></a>

You can attach [AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy.html) to your users, groups, and roles.

This policy grants permissions that allow full access to the Amazon Bedrock Agent Core Memory.

 **Permissions details** 

This policy includes the following permissions.
+  `bedrock` – Allows principals to call the Amazon Bedrock `Invokemodel` and `InvokeModelWithResponseStream` actions. This is required so that an agent can store memories.

## AWS managed policy: BedrockAgentCoreRuntimeIdentityServiceRolePolicy
<a name="security-iam-awsmanpol-BedrockAgentCoreRuntimeIdentityServiceRolePolicy"></a>

This policy is attached to a service-linked role that allows the service to perform actions on your behalf. You cannot attach this policy to your users, groups, or roles.

This policy grants permissions that allow access to identity and token management resources that are required for AgentCore Runtime authentication and authorization.

 **Permissions details** 

This policy includes the following permissions:
+  `bedrock-agentcore` (Amazon Bedrock Agent Core) – Allows the service to get workload access tokens for JWT authentication and user ID-based authentication. Specifically allows `GetWorkloadAccessToken` , `GetWorkloadAccessTokenForJWT` , and `GetWorkloadAccessTokenForUserId` actions on the default workload identity directory and its associated workload identities.

 **Policy contents** 

You can view the complete policy at [BedrockAgentCoreRuntimeIdentityServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreRuntimeIdentityServiceRolePolicy.html).

For more information about the service-linked role that uses this policy, see [Using service-linked roles for Amazon Bedrock AgentCore](service-linked-roles.md).

## AgentCore updates to AWS managed policies
<a name="security-iam-awsmanpol-updates"></a>

View details about updates to AWS managed policies for AgentCore since this service began tracking these changes. For automatic alerts about changes to this page, subscribe to the RSS feed on the AgentCore Document history page.


| Change | Description | Date | 
| --- | --- | --- | 
|   [BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess) – Updated policy  |  Added Amazon Elastic Container Registry permissions ( `ecr:DescribeRepositories` , `ecr:DescribeImages` , `ecr:ListImages` ) to allow Amazon Bedrock AgentCore to access container images for runtime deployments. Added Amazon Bedrock permissions ( `bedrock:InvokeModel` , `bedrock:InvokeModelWithResponseStream` ) to allow Amazon Bedrock AgentCore Evaluations to invoke foundation models and inference profiles for evaluation purposes. Added CloudWatch Logs permissions for evaluations ( `logs:CreateLogGroup` for /aws/bedrock-agentcore/evaluations/\$1 log groups, `logs:PutIndexPolicy` , `logs:DescribeIndexPolicies` ) to support evaluation logging and indexing.  |  December 2, 2025  | 
|   [BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess) – Updated policy  |  Added the `cloudtrail:CreateServiceLinkedChannel` permission to allow Amazon Bedrock AgentCore to create a CloudTrail service-linked channel for the Application Signals feature. Added `kms:CreateGrant` permission to allow the Amazon Bedrock AgentCore Gateway service to create grants on customer managed keys for the S3 vectors service used for semantic search. Added `kms:ListGrants` permission to check if previously created grants exist. Added S3 permissions to create bucket, put bucket policy, versioning, put object for buckets with prefix bedrock-agentcore-runtime-. Added list buckets, list objects in the bucket, and get object permissions. Added ECR permissions to describe repositories, list images, and describe images. Added logs `PutResourcePolicy` permissions to enable transaction search.  |  November 3, 2025  | 
|   [BedrockAgentCoreRuntimeIdentityServiceRolePolicy](#security-iam-awsmanpol-BedrockAgentCoreRuntimeIdentityServiceRolePolicy) – New policy  |  Added a new AWS managed policy that allows AgentCore to manage workload identity access tokens and OAuth credentials for agent runtimes.  |  October 10, 2025  | 
|   [BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess) – Updated policy  |  Added permission to create the Amazon Bedrock AgentCore runtime identity service-linked role.  |  October 9, 2025  | 
|   [BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess) – Updated policy  |  Added permission to create the Amazon Bedrock AgentCore runtime identity service-linked role.  |  October 8, 2025  | 
|   [BedrockAgentCoreFullAccess](#security-iam-awsmanpol-BedrockAgentCoreFullAccess) – Updated policy  |  Added permission to create the Amazon Bedrock AgentCore network service-linked role.  |  September 19, 2025  | 
|   [BedrockAgentCoreNetworkServiceRolePolicy](#security-iam-awsmanpol-BedrockAgentCoreNetworkServiceRolePolicy) – New policy  |  Added a new AWS managed policy that allows AgentCore to create and manage network interfaces in your VPC when running in VPC mode.  |  September 19, 2025  | 
|  AgentCore started tracking changes  |  AgentCore started tracking changes for its AWS managed policies.  |  July 16, 2025  | 

# Using service-linked roles for Amazon Bedrock AgentCore
<a name="service-linked-roles"></a>

Amazon Bedrock AgentCore uses AWS Identity and Access Management (IAM) service-linked roles. A service-linked role is a unique type of IAM role that is linked directly to AgentCore. Service-linked roles are predefined by AgentCore and include all the permissions that the service requires to call other AWS services on your behalf.

A service-linked role makes using AgentCore easier because you don’t have to manually add the necessary permissions. AgentCore defines the permissions of its service-linked roles, and unless defined otherwise, only AgentCore can assume its roles. The defined permissions include the trust policy and the permissions policy, and that permissions policy cannot be attached to any other IAM entity.

You can delete the roles only after first deleting their related resources. This protects your AgentCore resources because you can’t inadvertently remove permission to access the resources.

AgentCore uses the following service-linked roles:
+  `AWSServiceRoleForBedrockAgentCoreNetwork` - Manages network interfaces in your VPC
+  `AWSServiceRoleForBedrockAgentCoreRuntimeIdentity` - Manages workload identity access tokens and OAuth credentials for agent runtimes
+  `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` - Manages Amazon VPC Lattice resources for AgentCore Gateway private connectivity

## AgentCore service-linked role permissions
<a name="service-linked-role-permissions"></a>

### Network service-linked role
<a name="network-service-linked-role"></a>

AgentCore uses the service-linked role named `AWSServiceRoleForBedrockAgentCoreNetwork` to allow AgentCore to create and manage network interfaces in your VPC on your behalf.

The `AWSServiceRoleForBedrockAgentCoreNetwork` service-linked role trusts the following services to assume the role:
+  `network.bedrock-agentcore.amazonaws.com` 

The role permissions policy allows AgentCore to complete the following actions on the specified resources:

You can view the complete policy at [BedrockAgentCoreNetworkServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreNetworkServiceRolePolicy.html).

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowCreateEniInAnySubnet",
            "Effect": "Allow",
            "Action": "ec2:CreateNetworkInterface",
            "Resource": "arn:aws:ec2:*:*:subnet/*"
        },
        {
            "Sid": "AllowCreateEniWithSecurityGroups",
            "Effect": "Allow",
            "Action": "ec2:CreateNetworkInterface",
            "Resource": "arn:aws:ec2:*:*:security-group/*"
        },
        {
            "Sid": "AllowCreateEniWithBedrockManagedRequestTag",
            "Effect": "Allow",
            "Action": "ec2:CreateNetworkInterface",
            "Resource": "arn:aws:ec2:*:*:network-interface/*",
            "Condition": {
                "ForAllValues:StringEquals": {
                    "aws:TagKeys": [
                        "AmazonBedrockAgentCoreManaged"
                    ]
                },
                "StringEquals": {
                    "aws:RequestTag/AmazonBedrockAgentCoreManaged": "true"
                }
            }
        },
        {
            "Sid": "AllowTagEniOnCreate",
            "Effect": "Allow",
            "Action": "ec2:CreateTags",
            "Resource": "arn:aws:ec2:*:*:network-interface/*",
            "Condition": {
                "StringEquals": {
                    "ec2:CreateAction": "CreateNetworkInterface"
                }
            }
        },
        {
            "Sid": "AllowManageEniWhenBedrockManaged",
            "Effect": "Allow",
            "Action": [
                "ec2:DeleteNetworkInterface",
                "ec2:AssignPrivateIpAddresses",
                "ec2:UnassignPrivateIpAddresses",
                "ec2:CreateNetworkInterfacePermission"
            ],
            "Resource": "arn:aws:ec2:*:*:network-interface/*",
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/AmazonBedrockAgentCoreManaged": "true"
                }
            }
        },
        {
            "Sid": "AllowGetSecurityGroupsForVpc",
            "Effect": "Allow",
            "Action": [
                "ec2:GetSecurityGroupsForVPC"
            ],
            "Resource": "arn:aws:ec2:*:*:vpc/*"
        },
        {
            "Sid": "AllowDescribeNetworkingResources",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeNetworkInterfaces",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcs"
            ],
            "Resource": "*"
        }
    ]
}
```

### Identity service-linked role
<a name="identity-service-linked-role"></a>

AgentCore uses the service-linked role named `AWSServiceRoleForBedrockAgentCoreRuntimeIdentity` to allow AgentCore to manage workload identity access tokens and OAuth credentials on your behalf.

The `AWSServiceRoleForBedrockAgentCoreRuntimeIdentity` service-linked role trusts the following services to assume the role:
+  `runtime-identity.bedrock-agentcore.amazonaws.com` 

The role permissions policy allows AgentCore to complete these actions on the specified resources.

You can view the complete policy at [BedrockAgentCoreRuntimeIdentityServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreRuntimeIdentityServiceRolePolicy.html).

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": {
        "Sid": "AllowWorkloadIdentityAccess",
        "Effect": "Allow",
        "Action": [
            "bedrock-agentcore:GetWorkloadAccessToken",
            "bedrock-agentcore:GetWorkloadAccessTokenForJWT",
            "bedrock-agentcore:GetWorkloadAccessTokenForUserId"
        ],
        "Resource": [
            "arn:aws:bedrock-agentcore:*:*:workload-identity-directory/default",
            "arn:aws:bedrock-agentcore:*:*:workload-identity-directory/default/workload-identity/*"
        ]
    }
}
```

For information about changes to this policy, see [AgentCore updates to AWS managed policies](security-iam-awsmanpol.md#security-iam-awsmanpol-updates).

 **Understanding the Identity Feature** 

The service-linked role is used to support OAuth authentication and JWT bearer token features for AgentCore Runtime resources. This feature allows agent runtimes to securely manage workload identities and access external OAuth providers on behalf of users.

 **Key Benefits of Identity Management** 
+  **Simplified Permission Management** : Eliminates the need to manually configure IAM policies for workload identity access
+  **Secure Token Management** : Provides secure access to workload access tokens for OAuth flows
+  **User Federation** : Enables three-legged OAuth flows for accessing external services like Google Drive, Microsoft Graph, etc.
+  **Automatic Provisioning** : Service-linked role is created automatically when needed

 **How Identity Management Works** 

When you invoke an AgentCore Runtime with OAuth authentication or JWT bearer tokens:

1. You configure JWT authorizer settings (discovery URL, allowed clients, allowed audiences) during runtime creation

1. AgentCore creates the service-linked role automatically to manage workload identity permissions

1. The runtime uses the service-linked role to exchange JWT tokens for workload access tokens

1. Your agent code can use these tokens to access external OAuth providers and services

1. All token management is handled securely through the AgentCore Identity service

 **Migration from Legacy Approach** 

For existing agents (created before October 13, 2025)  
+ Continue to use manual IAM policies attached to the agent execution role
+ No automatic migration - existing behavior is preserved

For new agents (created on or after October 13, 2025)  
+ Automatically use the service-linked role approach
+ No manual IAM policy configuration required
+ Simplified setup and management

The service-linked role ensures that AgentCore can only access workload identity resources that are explicitly associated with your agent runtimes, maintaining secure isolation and clear resource attribution.

For implementation details, see [Authenticate and authorize with Inbound Auth and Outbound Auth](runtime-oauth.md).

### Gateway service-linked role
<a name="gateway-service-linked-role"></a>

AgentCore uses the service-linked role named `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` to allow AgentCore Gateway to create and manage Amazon VPC Lattice resources in your account on your behalf. This role is used when you configure a gateway target with a managed private endpoint, enabling AgentCore Gateway to set up the necessary VPC Lattice resource gateways for private connectivity to resources in your VPC.

The `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` service-linked role trusts the following services to assume the role:
+  `bedrock-agentcore.amazonaws.com` 

The role permissions policy allows AgentCore to complete the following actions on the specified resources:

You can view the complete policy at [BedrockAgentCoreGatewayNetworkServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreGatewayNetworkServiceRolePolicy.html).

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowSLRActionsForLattice",
            "Effect": "Allow",
            "Action": [
                "iam:CreateServiceLinkedRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/aws-service-role/vpc-lattice.amazonaws.com/AWSServiceRoleForVpcLattice"
            ],
            "Condition": {
                "StringEquals": {
                    "iam:AWSServiceName": "vpc-lattice.amazonaws.com"
                }
            }
        },
        {
            "Sid": "AllowResourceGatewayCreate",
            "Effect": "Allow",
            "Action": [
                "vpc-lattice:CreateResourceGateway",
                "vpc-lattice:TagResource"
            ],
            "Resource": [
                "arn:aws:vpc-lattice:*:*:resourcegateway/*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:RequestTag/BedrockAgentCoreGatewayManaged": "true",
                    "aws:ResourceTag/BedrockAgentCoreGatewayManaged": "true"
                }
            }
        },
        {
            "Sid": "AllowEC2PermissionsForResourceGatewayCreate",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcs",
                "ec2:DescribeSecurityGroups"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "AllowResourceGatewayDelete",
            "Effect": "Allow",
            "Action": [
                "vpc-lattice:DeleteResourceGateway",
                "vpc-lattice:GetResourceGateway"
            ],
            "Resource": [
                "*"
            ],
            "Condition": {
                "StringEquals": {
                    "aws:ResourceTag/BedrockAgentCoreGatewayManaged": "true"
                }
            }
        }
    ]
}
```

 **Understanding the Gateway Managed Lattice Feature** 

The service-linked role is used to support the managed private endpoint feature for AgentCore Gateway targets. When you create a gateway target with a managed private endpoint, AgentCore uses this role to create and manage VPC Lattice resource gateways in your account on your behalf. These managed resource gateways enable private connectivity between AgentCore Gateway and resources in your VPC without requiring you to set up VPC Lattice resources manually.

 **Key Benefits of Managed Lattice Resources** 
+  **Simplified Setup** : Eliminates the need to manually create and configure VPC Lattice resource gateways
+  **Scoped-down Networking permissions** : Application developers don’t need VPC Lattice networking permissions in their own IAM policies
+  **Managed Lifecycle** : AgentCore manages the full lifecycle of the Lattice resources, including creation, reuse, and cleanup
+  **Automatic Provisioning** : The service-linked role is created automatically when you create a gateway target with a managed private endpoint

 **How Managed Lattice Resources Work** 

When you create a gateway target with a managed private endpoint:

1. You specify the VPC, subnets, and optional security groups for the private endpoint in the `managedVpcResource` configuration

1. AgentCore creates the service-linked role automatically if it does not already exist

1. AgentCore uses the role to create a managed VPC Lattice resource gateway in your account, tagged with `BedrockAgentCoreGatewayManaged` 

1. AgentCore sets up the necessary VPC Lattice resources to enable private connectivity

1. When you delete the gateway target, AgentCore cleans up the managed Lattice resources that are no longer in use

**Note**  
The service-linked role can only manage VPC Lattice resource gateways that are tagged with `BedrockAgentCoreGatewayManaged` . It cannot modify or delete resource gateways that you create and manage yourself. If you use the self-managed Lattice resource option for your gateway targets, this service-linked role is not required.

## Creating a service-linked role for AgentCore
<a name="create-service-linked-role"></a>

You don’t need to manually create service-linked roles. AgentCore creates them automatically when needed:
+  **Network service-linked role** : Created when you create an AgentCore Runtime, Code Interpreter, or Browser resources with VPC configuration
+  **Identity service-linked role** : Created when you create or update an AgentCore Runtime on or after **October 13, 2025** 
+  **Gateway service-linked role** : Created when you create a AgentCore Gateway target with a managed private endpoint ( `managedVpcResource` ) configuration

If you delete a service-linked role and then need to create it again, you can use the same process to re-create the role in your account. When you create the appropriate AgentCore resources, AgentCore creates the service-linked role for you again.

### Permissions required to create a service-linked role
<a name="create-service-linked-role-permissions"></a>

You must configure permissions to allow an IAM entity (such as a user, group, or role) to create, edit, or delete a service-linked role. The IAM entity needs to have the following permissions:

 **For the Network service-linked role** 

```
{
    "Action": "iam:CreateServiceLinkedRole",
    "Effect": "Allow",
    "Resource": "arn:aws:iam::*:role/aws-service-role/network.bedrock-agentcore.amazonaws.com/AWSServiceRoleForBedrockAgentCoreNetwork",
    "Condition": {
        "StringLike": {
            "iam:AWSServiceName": "network.bedrock-agentcore.amazonaws.com"
        }
    }
}
```

 **For the Identity service-linked role** 

```
{
    "Sid": "CreateBedrockAgentCoreRuntimeIdentityServiceLinkedRolePermissions",
    "Effect": "Allow",
    "Action": "iam:CreateServiceLinkedRole",
    "Resource": "arn:aws:iam::*:role/aws-service-role/runtime-identity.bedrock-agentcore.amazonaws.com/AWSServiceRoleForBedrockAgentCoreRuntimeIdentity",
    "Condition": {
        "StringEquals": {
            "iam:AWSServiceName": "runtime-identity.bedrock-agentcore.amazonaws.com"
        }
    }
}
```

 **For the Gateway service-linked role** 

```
{
    "Effect": "Allow",
    "Action": "iam:CreateServiceLinkedRole",
    "Resource": "arn:aws:iam::*:role/aws-service-role/bedrock-agentcore.amazonaws.com/AWSServiceRoleForBedrockAgentCoreGatewayNetwork",
    "Condition": {
        "StringEquals": {
            "iam:AWSServiceName": "bedrock-agentcore.amazonaws.com"
        }
    }
}
```

These permissions are already included in the AWS managed policy [BedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html).

## Editing a service-linked role for AgentCore
<a name="edit-service-linked-role"></a>

AgentCore does not allow you to edit the `AWSServiceRoleForBedrockAgentCoreNetwork` , `AWSServiceRoleForBedrockAgentCoreRuntimeIdentity` , or `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` service-linked roles. After you create a service-linked role, you cannot change the name of the role because various entities might reference the role. However, you can edit the description of the role using IAM. For more information, see [Editing a service-linked role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role).

## Deleting a service-linked role for AgentCore
<a name="delete-service-linked-role"></a>

If you no longer need to use a feature or service that requires a service-linked role, we recommend that you delete that role. That way you don’t have an unused entity that is not actively monitored or maintained. However, you must delete all your AgentCore resources that use the service-linked role before you can delete the role:
+  **Network service-linked role** : Delete all AgentCore Runtime, Code Interpreter, and Browser resources with VPC configuration
+  **Identity service-linked role** : Delete all AgentCore Runtime resources
+  **Gateway service-linked role** : Delete all AgentCore Gateway targets that use managed private endpoints ( `managedVpcResource` configuration)

### Cleaning up a service-linked role
<a name="service-linked-role-review-before-delete"></a>

Before you can use IAM to delete a service-linked role, you must first confirm that the role has no active sessions and remove any resources used by the role.

 **To check whether the service-linked role has an active session in the IAM console** 

1. Sign in to the AWS Management Console and open the IAM console at [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/).

1. In the navigation pane of the IAM console, choose **Roles** , and then choose the name (not the check box) of the `AWSServiceRoleForBedrockAgentCoreNetwork` role.

1. On the **Summary** page for the selected role, choose the **Access Advisor** tab.

1. On the **Access Advisor** tab, review the recent activity for the service-linked role.

**Note**  
If you are unsure whether AgentCore is using a service-linked role, you can try to delete the role. If the service is using the role, then the deletion fails and you can view the Regions where the role is being used. If the role is being used, then you must wait for the session to end before you can delete the role. You cannot revoke the session for a service-linked role.

If you want to remove a service-linked role, you must first delete the appropriate AgentCore resources:
+  `AWSServiceRoleForBedrockAgentCoreNetwork` : Delete all AgentCore Runtime, Code Interpreter, and Browser resources with VPC configuration
+  `AWSServiceRoleForBedrockAgentCoreRuntimeIdentity` : Delete all AgentCore Runtime resources
+  `AWSServiceRoleForBedrockAgentCoreGatewayNetwork` : Delete all AgentCore Gateway targets that use managed private endpoints. After all managed targets are deleted, AgentCore releases the managed VPC Lattice resource gateways that are no longer in use.

### Manually delete the service-linked role
<a name="service-linked-role-delete-service"></a>

Use the IAM console, the AWS CLI, or the IAM API to delete service-linked roles. For more information, see [Deleting a service-linked role](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role).

# Understanding Credentials Management in Amazon Bedrock AgentCore
<a name="security-credentials-management"></a>

## MicroVM Metadata Service (MMDS)
<a name="mmds"></a>

When you configure an execution role with Amazon Bedrock AgentCore Browser, AgentCore Code Interpreter, or AgentCore Runtime, the underlying compute uses MMDS to access credentials, similar to how EC2 instances use the [Instance Metadata Service (IMDS)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) . This allows the service within the VM to retrieve temporary AWS credentials for operations like S3 access. This is independent of the network mode that the AgentCore Code Interpreter, AgentCore Browser, or AgentCore Runtime is running in.

**Important**  
When configuring the execution role permissions, use careful consideration since any code or actor running inside the VM can access these credentials by calling the metadata endpoint.

## Best Practices for Role Setup
<a name="role-setup-best-practices"></a>
+ Follow the principle of least privilege when setting up the execution role. Especially when using these tools with LLMs, that can generate arbitrary code, it’s crucial to limit permissions to only what you intend.
+ Avoid privilege escalation by ensuring that the execution role associated with your resource has equal or fewer privileges than the users who can invoke it.

The following shows an example of properly scoped permissions:

```
{
  "Effect": "Allow",
  "Action": ["s3:GetObject", "s3:PutObject"],
  "Resource": "arn:aws:s3:::<your-specific-bucket>/*"
}
```

# Troubleshooting Amazon Bedrock AgentCore identity and access
<a name="security_iam_troubleshoot"></a>

Use the following information to help you diagnose and fix common issues that you might encounter when working with AgentCore and IAM.

**Topics**
+ [I am not authorized to perform an action in AgentCore](#security_iam_troubleshoot-no-permissions)
+ [I am not authorized to perform iam:PassRole](#security_iam_troubleshoot-passrole)
+ [I want to allow people outside of my AWS account to access my AgentCore resources](#security_iam_troubleshoot-cross-account-access)

## I am not authorized to perform an action in AgentCore
<a name="security_iam_troubleshoot-no-permissions"></a>

If you receive an error that you’re not authorized to perform an action, your policies must be updated to allow you to perform the action.

The following example error occurs when the `mateojackson` IAM user tries to use the console to view details about a fictional *my-example-widget* resource but doesn’t have the fictional `bedrock-agentcore:GetWidget` permissions.

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: bedrock-agentcore:GetWidget on resource: my-example-widget
```

In this case, the policy for the `mateojackson` user must be updated to allow access to the *my-example-widget* resource by using the `bedrock-agentcore:GetWidget` action.

If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials.

## I am not authorized to perform iam:PassRole
<a name="security_iam_troubleshoot-passrole"></a>

If you receive an error that you’re not authorized to perform the `iam:PassRole` action, your policies must be updated to allow you to pass a role to AgentCore.

Some AWS services allow you to pass an existing role to that service instead of creating a new service role or service-linked role. To do this, you must have permissions to pass the role to the service.

The following example error occurs when an IAM user named `marymajor` tries to use the console to perform an action in AgentCore. However, the action requires the service to have permissions that are granted by a service role. Mary does not have permissions to pass the role to the service.

```
User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole
```

In this case, Mary’s policies must be updated to allow her to perform the `iam:PassRole` action.

If you need help, contact your AWS administrator. Your administrator is the person who provided you with your sign-in credentials.

## I want to allow people outside of my AWS account to access my AgentCore resources
<a name="security_iam_troubleshoot-cross-account-access"></a>

You can create a role that users in other accounts or people outside of your organization can use to access your resources. You can specify who is trusted to assume the role. For services that support resource-based policies or access control lists (ACLs), you can use those policies to grant people access to your resources.

To learn more, consult the following:
+ To learn whether AgentCore supports these features, see [How Amazon Bedrock AgentCore works with IAM](security_iam_service-with-iam.md).
+ To learn how to provide access to your resources across AWS accounts that you own, see [Providing access to an IAM user in another AWS account that you own](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html) in the *IAM User Guide*.
+ To learn how to provide access to your resources to third-party AWS accounts, see [Providing access to AWS accounts owned by third parties](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html) in the *IAM User Guide*.
+ To learn how to provide access through identity federation, see [Providing access to externally authenticated users (identity federation)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_federated-users.html) in the *IAM User Guide*.
+ To learn the difference between using roles and resource-based policies for cross-account access, see [Cross account resource access in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html) in the *IAM User Guide*.

# Resource-based policies for Amazon Bedrock AgentCore
<a name="resource-based-policies"></a>

Resource-based policies in Amazon Bedrock AgentCore allow you to control which principals (AWS accounts, IAM users, or IAM roles) can invoke and manage your Amazon Bedrock AgentCore resources (currently supported for Runtime, Gateway and Memory). You can attach IAM-style policies directly to your resources to define rules around who can start runtime sessions, invoke a gateway, access memory or perform other management and invocation actions.

Resource-based policies work in conjunction with identity-based IAM policies to provide access control for your Amazon Bedrock AgentCore resources. While identity-based policies are attached to IAM identities and specify what actions they can perform, resource-based policies are attached directly to resources and specify who can access them.

**Topics**
+ [Supported resources](#resource-based-policies-supported-resources)
+ [How resource-based policies work](#resource-based-policies-how-they-work)
+ [Policy structure](#resource-based-policies-structure)
+ [Supported actions](#resource-based-policies-supported-actions)
+ [Condition keys](#resource-based-policies-condition-keys)
+ [Common use cases and examples](#resource-based-policies-examples)
+ [Managing resource policies](#resource-based-policies-managing)
+ [Security best practices](#resource-based-policies-best-practices)
+ [Troubleshooting](#resource-based-policies-troubleshooting)

## Supported resources
<a name="resource-based-policies-supported-resources"></a>

Amazon Bedrock AgentCore supports resource-based policies for the following resources:
+  **Agent Runtime and Agent Endpoints** - Control access to agent invocation and management operations
+  **Gateway** - Control access to gateway invocation operations
+  **Memory** - Control access to memory operations

## How resource-based policies work
<a name="resource-based-policies-how-they-work"></a>

### Identity-based vs resource-based policies
<a name="resource-based-policies-vs-identity-based"></a>


| Aspect | Identity-Based Policy | Resource-Based Policy | 
| --- | --- | --- | 
|  Attachment  |  Attached to IAM users, roles, or groups  |  Attached directly to Amazon Bedrock AgentCore resources  | 
|  Management  |  Managed through AWS IAM  |  Managed through Amazon Bedrock AgentCore APIs  | 
|  Specifies  |  Actions and Resources (Principal is implicit)  |  Principals, Actions, and Conditions (Resource is implicit)  | 
|  Use Case  |  Define what an identity can do  |  Define who can access a resource  | 

### Policy evaluation
<a name="resource-based-policies-evaluation"></a>

When a request is made to a Amazon Bedrock AgentCore resource, AWS evaluates both identity-based and resource-based policies. The following table shows how different policy combinations affect access:


| IAM Policy | Resource Policy | Result | 
| --- | --- | --- | 
|  Grants access  |  Silent  |  Allowed  | 
|  Grants access  |  Grants access  |  Allowed  | 
|  Grants access  |  Denies access  |  Denied  | 
|  Silent  |  Silent  |  Denied  | 
|  Silent  |  Grants access  |  Allowed  | 
|  Silent  |  Denies access  |  Denied  | 
|  Denies access  |  Silent  |  Denied  | 
|  Denies access  |  Allows access  |  Denied  | 
|  Denies access  |  Denies access  |  Denied  | 

Key principles:
+  **Explicit Deny Always Wins** : If any policy explicitly denies the action, access is denied regardless of other policies
+  **Either Policy Can Allow** : If either identity-based or resource-based policy allows the action (and no policy denies it), access is granted
+  **Default Deny** : If no policy explicitly permits an action, access is denied

### Hierarchical authorization for agent runtime and endpoint
<a name="resource-based-policies-hierarchical-authorization"></a>

Agent endpoints are addressable access points to specific versions of an agent runtime. Each endpoint points to a particular version of the runtime configuration, with a DEFAULT endpoint automatically routing to the latest version. When authorizing runtime API operations such as `InvokeAgentRuntime` and `InvokeAgentRuntimeCommand` , AWS evaluates both identity-based and resource-based policies for both the agent runtime and the agent endpoint being invoked.

For a request to be authorized, the following conditions must be met:
+ The identity-based policies attached to the calling principal must allow the action on both the agent runtime and agent endpoint resources
+ The resource-based policy on the agent runtime must allow the action (if a policy exists)
+ The resource-based policy on the agent endpoint must allow the action (if a policy exists)

**Important**  
To provide cross-account access to a principal, you must create resource-based policies granting access for **both** the agent runtime and the agent endpoint. If either resource denies access or lacks an explicit allow statement, the request will be denied.

Example: Granting cross-account access requires policies on both resources:

```
// Policy for Agent Runtime (attached to
// arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID)
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/CrossAccountRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID"
        }
    ]
}

// Policy for Agent Endpoint (attached to
// arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID/endpoint/ENDPOINTID)
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/CrossAccountRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID/endpoint/ENDPOINTID"
        }
    ]
}
```

### Authentication type considerations
<a name="resource-based-policies-authentication-types"></a>

The way you write resource-based policies depends on the authentication type configured for your Agent Runtime or Gateway:

SigV4 Authentication  
Use specific AWS principals (IAM users, roles, or accounts) in the `Principal` element. For example: `"Principal": {"AWS": "arn:aws:iam::123456789012:role/MyRole"}` . The policy is evaluated in conjunction with the caller’s IAM permissions.

OAuth Authentication  
Must use wildcard principal ( "Principal": "\$1" ) in policy statements. OAuth tokens are validated by AWS Identity Service before policy evaluation. Only authenticated OAuth users with valid JWT tokens from the registered Identity Provider (IdP) can invoke the resource. Anonymous or unauthenticated requests are rejected before policy evaluation. Use condition keys to restrict access (e.g., `aws:SourceVpc` , `aws:SourceVpce` ).

**Important**  
An Agent Runtime or Gateway can only be configured with either SigV4 OR OAuth authentication at creation time, not both simultaneously. This means a single resource-based policy applies to only one authentication type.

## Policy structure
<a name="resource-based-policies-structure"></a>

A resource-based policy is a JSON document with the following structure:

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "StatementId",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::account-id:role/role-name"
            },
            "Action": "bedrock-agentcore:ActionName",
            "Resource": "arn:aws:bedrock-agentcore:region:account-id:resource-type/resource-id",
            "Condition": {
                "ConditionOperator": {
                    "ConditionKey": "ConditionValue"
                }
            }
        }
    ]
}
```

**Important**  
The `Resource` field in the policy document must contain the exact ARN of the resource to which the policy is attached. Using "Resource": "\$1" is not supported and will result in a validation error.

## Supported actions
<a name="resource-based-policies-supported-actions"></a>

### Agent Runtime actions
<a name="resource-based-policies-runtime-actions"></a>
+  `bedrock-agentcore:InvokeAgentRuntime` - Invoke an agent runtime
+  `bedrock-agentcore:InvokeAgentRuntimeForUser` - Invoke an agent runtime endpoint with X-Amzn-Bedrock-AgentCore-Runtime-User-Id header
+  `bedrock-agentcore:InvokeAgentRuntimeCommand` - Execute a shell command in an active runtime session
+  `bedrock-agentcore:InvokeAgentRuntimeWithWebSocketStream` - Invoke an agent runtime with WebSocket stream
+  `bedrock-agentcore:InvokeAgentRuntimeWithWebSocketStreamForUser` - Invoke an agent runtime with WebSocket stream with X-Amzn-Bedrock-AgentCore-Runtime-User-Id header
+  `bedrock-agentcore:StopRuntimeSession` - Stop an active runtime session
+  `bedrock-agentcore:GetAgentCard` - Retrieve agent card information

### Gateway actions
<a name="resource-based-policies-gateway-actions"></a>
+  `bedrock-agentcore:InvokeGateway` - Invoke a gateway

### Memory actions
<a name="resource-based-policies-memory-actions"></a>
+  `bedrock-agentcore:GetMemory` - Retrieve a Memory resource
+  `bedrock-agentcore:UpdateMemory` - Update a Memory resource
+  `bedrock-agentcore:DeleteMemory` - Delete a Memory resource
+  `bedrock-agentcore:CreateEvent` - Create an event in a Memory resource
+  `bedrock-agentcore:GetEvent` - Retrieve an event from a Memory resource
+  `bedrock-agentcore:DeleteEvent` - Delete an event from a Memory resource
+  `bedrock-agentcore:ListEvents` - List Events from a Memory resource
+  `bedrock-agentcore:ListActors` - List actors from a Memory resource
+  `bedrock-agentcore:ListSessions` - List sessions from a Memory resource
+  `bedrock-agentcore:GetMemoryRecord` - Get a memory record from a Memory resource
+  `bedrock-agentcore:ListMemoryRecords` - List memory records from a Memory resource
+  `bedrock-agentcore:RetrieveMemoryRecords` - Search memory records from a Memory resource
+  `bedrock-agentcore:DeleteMemoryRecord` - Delete a memory record from a Memory resource
+  `bedrock-agentcore:BatchCreateMemoryRecords` - Batch create memory records in a Memory resource
+  `bedrock-agentcore:BatchUpdateMemoryRecords` - Batch update memory records in a Memory resource
+  `bedrock-agentcore:BatchDeleteMemoryRecords` - Batch delete memory records in a Memory resource
+  `bedrock-agentcore:StartMemoryExtractionJob` - Start an extraction job within a Memory Resource
+  `bedrock-agentcore:ListMemoryExtractionJobs` - List extraction jobs within a Memory Resource

## Condition keys
<a name="resource-based-policies-condition-keys"></a>

You can use condition keys to further refine access control in your policies. For a complete list of available condition keys, see [Bedrock AgentCore Condition Keys](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonbedrockagentcore.html) and [AWS Global Condition Context Keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html).

## Common use cases and examples
<a name="resource-based-policies-examples"></a>

This section provides practical examples of resource-based policies for common scenarios. The `Resource` field in each example must contain the exact ARN of the resource to which the policy is attached. Replace the example ARNs with your actual resource ARNs.

### Allow roles in another AWS account
<a name="resource-based-policies-cross-account-example"></a>

Grant API access to specific roles in a different AWS account:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::123456789012:role/DeveloperRole",
                    "arn:aws:iam::123456789012:role/AdminRole"
                ]
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID"
        }
    ]
}
```

### Deny traffic based on source IP address
<a name="resource-based-policies-ip-restriction-example"></a>

Block incoming traffic from specific IP address ranges:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/ApplicationRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID"
        },
        {
            "Effect": "Deny",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/ApplicationRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID",
            "Condition": {
                "IpAddress": {
                    "aws:SourceIp": [
                        "192.0.2.0/24",
                        "198.51.100.0/24"
                    ]
                }
            }
        }
    ]
}
```

### Allow traffic only from specific VPC
<a name="resource-based-policies-vpc-restriction-example"></a>

Restrict access to requests from a specific VPC:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/ApplicationRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID"
        },
        {
            "Effect": "Deny",
            "Principal": {
                "AWS": "arn:aws:iam::123456789012:role/ApplicationRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID",
            "Condition": {
                "StringNotEquals": {
                    "aws:SourceVpc": "vpc-1a2b3c4d"
                }
            }
        }
    ]
}
```

### OAuth authentication with VPC restriction
<a name="resource-based-policies-oauth-example"></a>

When your Agent Runtime or Gateway is configured with OAuth authentication, you must use a wildcard principal. This example restricts OAuth-authenticated requests to a specific VPC:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowOAuthFromVPC",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID",
            "Condition": {
                "StringEquals": {
                    "aws:SourceVpc": "vpc-1a2b3c4d"
                }
            }
        }
    ]
}
```

**Important**  
The wildcard principal ( "Principal": "\$1" ) is **required** for OAuth authentication. OAuth tokens are validated by AWS Identity Service before policy evaluation. Only users with valid JWT tokens from your registered Identity Provider can access the resource. Anonymous or unauthenticated requests are rejected before reaching policy evaluation. Use condition keys (like `aws:SourceVpc` , `aws:SourceVpce` ) to further restrict access

## Managing resource policies
<a name="resource-based-policies-managing"></a>

Select one of the following methods:

**Example**  

1. ====== Create or update a resource policy

   Use the `put-resource-policy` command:

   ```
   aws bedrock-agentcore-control put-resource-policy \
       --resource-arn arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID \
       --policy file://policy.json
   ```

    **Get a resource policy** 

   Use the `get-resource-policy` command:

   ```
   aws bedrock-agentcore-control get-resource-policy \
       --resource-arn arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
   ```

    **Delete a resource policy** 

   Use the `delete-resource-policy` command:

   ```
   aws bedrock-agentcore-control delete-resource-policy \
       --resource-arn arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
   ```

1. The following examples show how to manage resource policies using the AWS Python SDK (Boto3):

   ```
   import boto3
   import json
   
   client = boto3.client('bedrock-agentcore-control', region_name='us-west-2')
   
   # Define the resource ARN
   resource_arn = 'arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID'
   
   # Put resource policy
   # Note: The Resource field must match the resource ARN to which the policy is attached
   policy = {
   "Version": "2012-10-17",		 	 	 
       "Statement": [
           {
               "Effect": "Allow",
               "Principal": {"AWS": "arn:aws:iam::123456789012:role/MyRole"},
               "Action": "bedrock-agentcore:InvokeAgentRuntime",
               "Resource": resource_arn
           }
       ]
   }
   
   response = client.put_resource_policy(
       resourceArn=resource_arn,
       policy=json.dumps(policy)
   )
   
   # Get resource policy
   response = client.get_resource_policy(
       resourceArn='arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID'
   )
   print(response['policy'])
   
   # Delete resource policy
   response = client.delete_resource_policy(
       resourceArn='arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID'
   )
   ```

## Security best practices
<a name="resource-based-policies-best-practices"></a>

### Grant least privilege
<a name="resource-based-policies-least-privilege"></a>

Grant only the minimum permissions necessary for your use case:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::111122223333:role/ApplicationRole"
            },
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID"
        }
    ]
}
```

### Prevent confused deputy
<a name="resource-based-policies-confused-deputy"></a>

Always use condition keys when granting access to AWS services:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:gateway/GATEWAYID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "lambda.amazonaws.com"
            },
            "Action": "bedrock-agentcore:InvokeGateway",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:gateway/GATEWAYID",
            "Condition": {
                "StringEquals": {
                    "aws:SourceAccount": "111122223333"
                },
                "ArnEquals": {
                    "aws:SourceArn": "arn:aws:lambda:us-west-2:111122223333:function/SpecificFunction"
                }
            }
        }
    ]
}
```

### Use explicit deny for critical controls
<a name="resource-based-policies-explicit-deny"></a>

Use explicit deny statements for security-critical restrictions:

```
// Policy attached to arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "DenyAllExceptVPC",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "bedrock-agentcore:InvokeAgentRuntime",
            "Resource": "arn:aws:bedrock-agentcore:us-west-2:111122223333:runtime/AGENTID",
            "Condition": {
                "StringNotEquals": {
                    "aws:SourceVpc": "vpc-12345678"
                },
                "Bool": {
                    "aws:ViaAWSService": "false"
                }
            }
        }
    ]
}
```

## Troubleshooting
<a name="resource-based-policies-troubleshooting"></a>

### Access denied errors
<a name="resource-based-policies-access-denied"></a>

If you receive an "Access Denied" error:
+  **Check both policies** : Verify both identity-based and resource-based policies
+  **Look for explicit denies** : An explicit deny in any policy overrides all allows
+  **Verify principal ARN** : Ensure the principal ARN in the policy matches the caller
+  **Check conditions** : Verify all condition keys evaluate to true
+  **Review SCPs** : Organization service control policies can override resource policies

### Policy validation errors
<a name="resource-based-policies-validation-errors"></a>

Common policy validation errors:
+  **Invalid JSON** : Ensure your policy is valid JSON
+  **Invalid ARN format** : Verify all ARNs follow the correct format
+  **Unsupported actions** : Check that all actions are supported for the resource type
+  **Missing required elements** : Ensure Version, Statement, Effect, Principal, and Action are present

# Compliance validation for Amazon Bedrock AgentCore
<a name="compliance-validation"></a>

 AWS has completed its internal assessment to validate that Amazon Bedrock AgentCore aligns with the following AWS compliance programs: BIO, C5, CISPE, CPSTIC, ENS High, FINMA, GNS, GSMA, HITRUST, IRAP, ISMAP, ISO (ISO/IEC 27001, 27017, 27018, 27701, 22301, 20000, 9001), CSA STAR, MTCS, OSPAR, PCI, Pinakes, PiTuKri, and SOC. In addition, Amazon Bedrock AgentCore is HIPAA eligible and is pursuing FedRAMP compliance. Our third-party auditors will review and test Amazon Bedrock AgentCore during the next audit cycles for these compliance programs.

To learn whether an AWS service is within the scope of specific compliance programs, see [AWS services in Scope by Compliance Program](https://aws.amazon.com/compliance/services-in-scope/) and choose the compliance program that you are interested in. For general information, see [AWS Compliance Programs](https://aws.amazon.com/compliance/programs/).

You can download third-party audit reports using AWS Artifact. For more information, see [Downloading Reports in AWS Artifact](https://docs.aws.amazon.com/artifact/latest/ug/downloading-documents.html).

Your compliance responsibility when using AWS services is determined by the sensitivity of your data, your company’s compliance objectives, and applicable laws and regulations. For more information about your compliance responsibility when using AWS services, see [AWS Security Documentation](https://docs.aws.amazon.com/security/).

# Resilience in Amazon Bedrock AgentCore
<a name="disaster-recovery-resiliency"></a>

The AWS global infrastructure is built around AWS Regions and Availability Zones. AWS Regions provide multiple physically separated and isolated Availability Zones, which are connected with low-latency, high-throughput, and highly redundant networking. With Availability Zones, you can design and operate applications and databases that automatically fail over between zones without interruption. Availability Zones are more highly available, fault tolerant, and scalable than traditional single or multiple data center infrastructures.

For more information about AWS Regions and Availability Zones, see [AWS Global Infrastructure](https://aws.amazon.com/about-aws/global-infrastructure/).

In addition to the AWS global infrastructure, AgentCore offers several features to help support your data resiliency and backup needs.

# Cross-service confused deputy prevention
<a name="cross-service-confused-deputy-prevention"></a>

The confused deputy problem is a security issue where an entity that doesn’t have permission to perform an action can coerce a more-privileged entity to perform the action. In AWS, cross-service impersonation can result in the confused deputy problem. Cross-service impersonation can occur when one service (the *calling service* ) calls another service (the *called service* ). The calling service can be manipulated to use its permissions to act on another customer’s resources in a way it should not otherwise have permission to access. To prevent this, AWS provides tools that help you protect your data for all services with service principals that have been given access to resources in your account.

We recommend using the [aws:SourceArn](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn) and [aws:SourceAccount](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount) global condition context keys in resource policies to limit the permissions that Amazon Bedrock AgentCore gives another service to the resource. Use `aws:SourceArn` if you want only one resource to be associated with the cross-service access. Use `aws:SourceAccount` if you want to allow any resource in that account to be associated with the cross-service use.

The most effective way to protect against the confused deputy problem is to use the `aws:SourceArn` global condition context key with the full ARN of the resource. If you don’t know the full ARN of the resource or if you are specifying multiple resources, use the `aws:SourceArn` global context condition key with wildcard characters ( \$1 ) for the unknown portions of the ARN. For example, arn:aws:servicename:\$1:123456789012:\$1.

If the `aws:SourceArn` value does not contain the account ID, such as an Amazon S3 bucket ARN, you must use both global condition context keys to limit permissions.

The following example shows how you can use the `aws:SourceArn` and `aws:SourceAccount` global condition context keys in AgentCore to prevent the confused deputy problem.

```
{
"Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AssumeRolePolicy",
      "Effect": "Allow",
      "Principal": {
        "Service": "bedrock-agentcore.amazonaws.com"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
            "StringEquals": {
                "aws:SourceAccount": "123456789012"
            },
            "ArnLike": {
                "aws:SourceArn": "arn:aws:bedrock-agentcore:us-east-1:123456789012:*"
            }
       }
    }
  ]
}
```