Skip to content

Commit 8766602

Browse files
authored
Merge pull request #8 from aws-ia/feat/updates
feat: AgentCore Gateway
2 parents dc5ce33 + 7df2de3 commit 8766602

File tree

13 files changed

+1420
-31
lines changed

13 files changed

+1420
-31
lines changed

.header.md

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ The [Amazon Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/) Terraf
44

55
## Overview
66

7-
The module provides support for Amazon Bedrock AgentCore Runtime and Runtime Endpoints. This allows you to deploy custom container-based runtimes for your Bedrock agents. You can extend agent capabilities with custom code that runs in your own container, giving you full control over the agent's behavior and integration capabilities.
7+
The module provides support for Amazon Bedrock AgentCore Runtime, Runtime Endpoints, and Gateways. This allows you to deploy custom container-based runtimes for your Bedrock agents and create gateways, which serve as integration points between agents and external services.
88

99
This module simplifies the process of:
1010

1111
- Creating and configuring Bedrock AgentCore Runtimes
1212
- Setting up AgentCore Runtime Endpoints
13-
- Managing IAM permissions for your runtimes
13+
- Creating and managing AgentCore Gateways
14+
- Managing IAM permissions for your runtimes and gateways
1415
- Configuring network access and security settings
1516

1617
## Features
@@ -21,10 +22,16 @@ This module simplifies the process of:
2122
- **Environment Variables**: Pass configuration to your runtime container
2223
- **JWT Authorization**: Optional JWT authorizer configuration for secure access
2324
- **Endpoint Management**: Create and manage runtime endpoints for client access
25+
- **Gateway Support**: Create and manage AgentCore Gateways for model context communication
26+
- **Protocol Configuration**: Configure MCP protocol settings for gateways
27+
- **Gateway Security**: Implement JWT authorization and KMS encryption for gateways
28+
- **Granular Permissions**: Control gateway create, read, update, and delete permissions
29+
- **OAuth2 Outbound Authorization**: Configure OAuth client for gateway outbound authorization
30+
- **API Key Outbound Authorization**: Configure API key for gateway outbound authorization
2431

2532
## Usage
2633

27-
### Basic Runtime and Endpoint
34+
### AgentCore Runtime and Endpoint
2835

2936
```hcl
3037
module "agentcore" {
@@ -49,7 +56,7 @@ module "agentcore" {
4956
}
5057
```
5158

52-
### With JWT Authorization
59+
#### With JWT Authorization
5360

5461
```hcl
5562
module "agentcore" {
@@ -75,7 +82,7 @@ module "agentcore" {
7582
}
7683
```
7784

78-
### With Custom IAM Role
85+
#### With Custom IAM Role
7986

8087
```hcl
8188
module "agentcore" {
@@ -94,13 +101,82 @@ module "agentcore" {
94101
}
95102
```
96103

104+
### AgentCore Gateway
105+
106+
Create and configure an MCP gateway:
107+
108+
```hcl
109+
module "agentcore" {
110+
source = "aws-ia/agentcore/aws"
111+
version = "0.0.1"
112+
113+
# Enable Agent Core Gateway
114+
create_gateway = true
115+
gateway_name = "MyMCPGateway"
116+
gateway_description = "Gateway for Model Context Protocol connections"
117+
118+
# Configure the gateway protocol (MCP)
119+
gateway_protocol_type = "MCP"
120+
gateway_protocol_configuration = {
121+
mcp = {
122+
instructions = "Custom instructions for MCP tools and resources"
123+
search_type = "DEFAULT"
124+
supported_versions = ["1.0.0"]
125+
}
126+
}
127+
128+
# Optional JWT authorization
129+
gateway_authorizer_type = "CUSTOM_JWT"
130+
gateway_authorizer_configuration = {
131+
custom_jwt_authorizer = {
132+
discovery_url = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_example/.well-known/jwks.json"
133+
allowed_audience = ["client-id-1", "client-id-2"]
134+
}
135+
}
136+
137+
# Optional KMS encryption
138+
gateway_kms_key_arn = "<INSERT_KEY_HERE>"
139+
140+
# Manage gateway permissions
141+
gateway_allow_create_permissions = true
142+
gateway_allow_update_delete_permissions = true
143+
}
144+
```
145+
146+
### Automatic Cognito User Pool Creation
147+
148+
The module can automatically create a Cognito User Pool to handle JWT authentication when no JWT auth information is provided:
149+
150+
```hcl
151+
module "agentcore" {
152+
source = "aws-ia/agentcore/aws"
153+
version = "0.0.1"
154+
155+
# Enable Agent Core Gateway
156+
create_gateway = true
157+
gateway_name = "GatewayWithAutoCognito"
158+
gateway_authorizer_type = "CUSTOM_JWT"
159+
# No gateway_authorizer_configuration - a Cognito User Pool will be created automatically
160+
161+
}
162+
```
163+
164+
In this scenario, the module will:
165+
166+
1. Create a Cognito User Pool
167+
2. Configure a domain for the User Pool
168+
3. Set up a User Pool client with the necessary OAuth configuration
169+
4. Configure the gateway's JWT authorizer to use the User Pool
170+
97171
## Architecture
98172

99173
The module creates the following resources:
100174

101175
1. **Agent Core Runtime**: A container-based runtime environment for your Bedrock agent
102176
2. **IAM Role and Policy**: Permissions for the runtime to access AWS services
103177
3. **Agent Core Runtime Endpoint**: An endpoint for client applications to interact with the runtime
178+
4. **Agent Core Gateway**: A gateway for Model Context Protocol (MCP) connections
179+
5. **Gateway IAM Role and Policy**: Permissions for the gateway to access AWS services
104180

105181
The IAM role includes permissions for:
106182

@@ -182,4 +258,10 @@ runtime_endpoint_tags = {
182258
Project = "ai-assistants"
183259
Owner = "data-science-team"
184260
}
261+
262+
gateway_tags = {
263+
Environment = "production"
264+
Project = "ai-assistants"
265+
Owner = "data-science-team"
266+
}
185267
```

0 commit comments

Comments
 (0)