# Architecture Flow - Bedrock AgentCore Gateway MCP Integration --- ## πŸ“‹ Navigation **🏠 [README](../README.md)** | **πŸ“– [Setup Guide](SETUP.md)** | **πŸ—οΈ [Architecture](ARCHITECTURE-FLOW.md)** | **πŸ”§ [Scripts](../scripts/README.md)** | **πŸ€– [Client](../client/README.md)** | **βš™οΈ [Config](../configs/README.md)** | **πŸ” [Okta Setup](../okta-auth/OKTA-OPENID-PKCE-SETUP.md)** --- ## System Architecture ![Architecture Diagram](../images/architecture.png) ## Component Overview ### Client Application - **CLI Interface**: Interactive command-line client - **Authentication**: AWS SigV4 + Okta JWT - **Conversation Management**: Persistent chat history - **Natural Language**: Human-friendly AWS operations ### Function URL - **Direct Lambda Access**: No API Gateway required - **Authentication**: AWS SigV4 (IAM_AUTH) - **Streaming Support**: Real-time AI responses - **CORS Enabled**: For web client compatibility ### AWS Operations Agent Lambda - **Strands Agent**: AI-powered conversation manager - **MCP Client**: Connects to Bedrock AgentCore Gateway - **DynamoDB Integration**: Conversation persistence - **Streaming Responses**: Real-time AI output ### Bedrock AgentCore Gateway - **MCP Server**: Model Context Protocol implementation - **Authentication**: Okta JWT validation - **Target Management**: Lambda function invocation - **Tool Registration**: 20 AWS service tools ### MCP Tool Lambda - **Docker Container**: Consistent runtime environment - **AWS SDK**: Access to 20+ AWS services - **Tool Implementation**: Natural language AWS operations - **Security**: Read-only operations by default ### DynamoDB - **Conversation Storage**: Persistent chat history - **TTL Support**: Automatic expiration of old conversations - **On-Demand Capacity**: Cost-effective scaling - **Point-in-Time Recovery**: Data protection ## Detailed Component Diagrams ### Client Application ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Client Application β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Command Line Interface β”‚ β”‚ β”‚ β”‚ β€’ Interactive prompt with command history β”‚ β”‚ β”‚ β”‚ β€’ Streaming response display β”‚ β”‚ β”‚ β”‚ β€’ Tool invocation visualization β”‚ β”‚ β”‚ β”‚ β€’ Conversation management commands β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Authentication Manager β”‚ β”‚ β”‚ β”‚ β€’ AWS SigV4 signing for Lambda Function URL β”‚ β”‚ β”‚ β”‚ β€’ Okta token management for MCP authentication β”‚ β”‚ β”‚ β”‚ β€’ Token refresh and validation β”‚ β”‚ β”‚ β”‚ β€’ Profile selection (demo1, etc.) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ HTTP Client β”‚ β”‚ β”‚ β”‚ β€’ Streaming response handling β”‚ β”‚ β”‚ β”‚ β€’ Request retry with exponential backoff β”‚ β”‚ β”‚ β”‚ β€’ Timeout management β”‚ β”‚ β”‚ β”‚ β€’ Error handling and reporting β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ Client ID: cli-client- β”‚ β”‚ AWS Profile: demo1 β”‚ β”‚ AWS Region: us-east-1 β”‚ β”‚ Okta Token: eyJraWQiOiJxczFVSzFqWnN0NmZyZU... β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### Function URL ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Lambda Function URL β”‚ β”‚ β”‚ β”‚ URL: https://.lambda-url.us-east-1.on.aws/ β”‚ β”‚ Auth Type: AWS_IAM β”‚ β”‚ Invoke Mode: RESPONSE_STREAM β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Authentication β”‚ β”‚ β”‚ β”‚ β€’ AWS SigV4 validation β”‚ β”‚ β”‚ β”‚ β€’ IAM policy enforcement β”‚ β”‚ β”‚ β”‚ β€’ No additional authorization layer needed β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ CORS Configuration β”‚ β”‚ β”‚ β”‚ β€’ AllowOrigins: * β”‚ β”‚ β”‚ β”‚ β€’ AllowMethods: * β”‚ β”‚ β”‚ β”‚ β€’ AllowHeaders: * β”‚ β”‚ β”‚ β”‚ β€’ AllowCredentials: true β”‚ β”‚ β”‚ β”‚ β€’ MaxAge: 86400 β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Endpoints β”‚ β”‚ β”‚ β”‚ β€’ /stream - Streaming chat responses β”‚ β”‚ β”‚ β”‚ β€’ /chat - Non-streaming chat β”‚ β”‚ β”‚ β”‚ β€’ /api/conversations - Conversation management β”‚ β”‚ β”‚ β”‚ β€’ /api/tools/fetch - Available MCP tools β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### AWS Operations Agent Lambda ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ AWS Operations Agent Lambda β”‚ β”‚ β”‚ β”‚ Function Name: aws-operations-agent- β”‚ β”‚ Runtime: Python 3.11 (Container Image) β”‚ β”‚ Memory: 1536 MB β”‚ β”‚ Timeout: 300 seconds β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ FastAPI Application β”‚ β”‚ β”‚ β”‚ β€’ AWS Lambda Web Adapter integration β”‚ β”‚ β”‚ β”‚ β€’ Streaming response support β”‚ β”‚ β”‚ β”‚ β€’ API endpoints for conversation management β”‚ β”‚ β”‚ β”‚ β€’ Error handling and validation β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Strands Agent β”‚ β”‚ β”‚ β”‚ β€’ Claude 3.7 Sonnet integration β”‚ β”‚ β”‚ β”‚ β€’ Tool selection and execution β”‚ β”‚ β”‚ β”‚ β€’ Conversation context management β”‚ β”‚ β”‚ β”‚ β€’ Natural language understanding β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ MCP Client β”‚ β”‚ β”‚ β”‚ β€’ Bedrock AgentCore Gateway integration β”‚ β”‚ β”‚ β”‚ β€’ Tool discovery and invocation β”‚ β”‚ β”‚ β”‚ β€’ Authentication with Okta token β”‚ β”‚ β”‚ β”‚ β€’ Error handling and retries β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ DynamoDB Integration β”‚ β”‚ β”‚ β”‚ β€’ Conversation persistence β”‚ β”‚ β”‚ β”‚ β€’ Message history management β”‚ β”‚ β”‚ β”‚ β€’ TTL for automatic cleanup β”‚ β”‚ β”‚ β”‚ β€’ Optimistic locking for concurrent access β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### Bedrock AgentCore Gateway ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Bedrock AgentCore Gateway β”‚ β”‚ β”‚ β”‚ Gateway ID: example-gateway- β”‚ β”‚ Data Plane URL: https://.gateway.bedrock-agentcore.β”‚ β”‚ .amazonaws.com/mcp β”‚ β”‚ Execution Role: BedrockAgentCoreGatewayExecutionRole--bedrock-agentcore-mcp-tool β”‚ β”‚ β”‚ β”‚ β€’ Runtime: Container (Docker) β”‚ β”‚ β”‚ β”‚ β€’ Handler: mcp-tool-handler.lambda_handler β”‚ β”‚ β”‚ β”‚ β€’ Architecture: x86_64 β”‚ β”‚ β”‚ β”‚ β€’ Memory: 3008 MB (maximum for performance) β”‚ β”‚ β”‚ β”‚ β€’ Timeout: 15 minutes (for complex operations) β”‚ β”‚ β”‚ β”‚ β€’ Bedrock AgentCore Context Processing β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ Target ID: (docker-strands-target) β”‚ β”‚ ARN: arn:aws:lambda:::function: β”‚ β”‚ -bedrock-agentcore-mcp-tool β”‚ β”‚ β”‚ β”‚ Credential Provider: GATEWAY_IAM_ROLE β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Docker Container β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Tool Implementation β”‚ β”‚ β”‚ β”‚ β€’ hello_world: Basic greeting tool β”‚ β”‚ β”‚ β”‚ β€’ get_time: Server time tool β”‚ β”‚ β”‚ β”‚ β€’ ec2_read_operations: EC2 instance queries β”‚ β”‚ β”‚ β”‚ β€’ s3_read_operations: S3 bucket operations β”‚ β”‚ β”‚ β”‚ β€’ lambda_read_operations: Lambda function queries β”‚ β”‚ β”‚ β”‚ β€’ cloudformation_read_operations: Stack queries β”‚ β”‚ β”‚ β”‚ β€’ iam_read_operations: IAM role/policy queries β”‚ β”‚ β”‚ β”‚ β€’ rds_read_operations: Database queries β”‚ β”‚ β”‚ β”‚ β€’ cloudwatch_read_operations: Metrics and logs β”‚ β”‚ β”‚ β”‚ β€’ cost_explorer_read_operations: Cost analysis β”‚ β”‚ β”‚ β”‚ β€’ ecs_read_operations: Container queries β”‚ β”‚ β”‚ β”‚ β€’ eks_read_operations: Kubernetes queries β”‚ β”‚ β”‚ β”‚ β€’ sns_read_operations: Topic queries β”‚ β”‚ β”‚ β”‚ β€’ sqs_read_operations: Queue queries β”‚ β”‚ β”‚ β”‚ β€’ dynamodb_read_operations: Table queries β”‚ β”‚ β”‚ β”‚ β€’ route53_read_operations: DNS queries β”‚ β”‚ β”‚ β”‚ β€’ apigateway_read_operations: API queries β”‚ β”‚ β”‚ β”‚ β€’ ses_read_operations: Email queries β”‚ β”‚ β”‚ β”‚ β€’ bedrock_read_operations: Model queries β”‚ β”‚ β”‚ β”‚ β€’ sagemaker_read_operations: ML queries β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Configuration Management β”‚ β”‚ β”‚ β”‚ β€’ Config Source: configs/bedrock-agentcore-config.json β”‚ β”‚ β”‚ β”‚ β€’ Environment Support: dev, gamma, prod β”‚ β”‚ β”‚ β”‚ β€’ Endpoint Selection: production_endpoints (active) β”‚ β”‚ β”‚ β”‚ β€’ Tool Schema: 20 AWS service tools defined β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ### DynamoDB ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ DynamoDB Table β”‚ β”‚ β”‚ β”‚ Table Name: aws-operations-agent-conversations- β”‚ β”‚ Billing Mode: PAY_PER_REQUEST β”‚ β”‚ Capacity Mode: On-Demand β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Schema β”‚ β”‚ β”‚ β”‚ β€’ conversation_id: String (Partition Key) β”‚ β”‚ β”‚ β”‚ β€’ messages: List (Conversation history) β”‚ β”‚ β”‚ β”‚ β€’ metadata: Map (Client info, timestamps) β”‚ β”‚ β”‚ β”‚ β€’ ttl: Number (Auto-expiration) β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Features β”‚ β”‚ β”‚ β”‚ β€’ Point-in-Time Recovery: Enabled β”‚ β”‚ β”‚ β”‚ β€’ TTL: Enabled (30 days default) β”‚ β”‚ β”‚ β”‚ β€’ Stream: NEW_AND_OLD_IMAGES β”‚ β”‚ β”‚ β”‚ β€’ Encryption: AWS Owned CMK β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## Conversation Flow ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Conversation Flow β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ User Request β”‚ β”‚ β”‚ β”‚ β€’ "List my EC2 instances in us-east-1" β”‚ β”‚ β”‚ β”‚ β€’ conversation_id: "abc123" β”‚ β”‚ β”‚ β”‚ β€’ okta_token: "eyJhbGciOiJSUzI1..." β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ AWS Operations Agent Lambda β”‚ β”‚ β”‚ β”‚ β€’ Load conversation history from DynamoDB β”‚ β”‚ β”‚ β”‚ β€’ Process user message with Claude + Bedrock AgentCore toolsβ”‚ β”‚ β”‚ β€’ Store updated conversation back to DynamoDB β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Conversation Object: β”‚ β”‚ β”‚ β”‚ { β”‚ β”‚ β”‚ β”‚ "conversation_id": "abc123", β”‚ β”‚ β”‚ β”‚ "messages": [ β”‚ β”‚ β”‚ β”‚ {"role": "user", "content": "List my EC2..."}, β”‚ β”‚ β”‚ β”‚ {"role": "assistant", "content": "I'll help..."} β”‚ β”‚ β”‚ β”‚ ], β”‚ β”‚ β”‚ β”‚ "session_metadata": { β”‚ β”‚ β”‚ β”‚ "client_type": "cli", β”‚ β”‚ β”‚ β”‚ "bedrock_agentcore_gateway_url": "..", β”‚ β”‚ β”‚ β”‚ "tools_available": 20 β”‚ β”‚ β”‚ β”‚ } β”‚ β”‚ β”‚ β”‚ } β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Strands Agent β”‚ β”‚ β”‚ β”‚ β€’ Analyzes user intent β”‚ β”‚ β”‚ β”‚ β€’ Determines need for ec2_read_operations tool β”‚ β”‚ β”‚ β”‚ β€’ Formulates natural language query β”‚ β”‚ β”‚ β”‚ β€’ Prepares tool parameters β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ MCP Client β”‚ β”‚ β”‚ β”‚ β€’ Connects to Bedrock AgentCore Gateway β”‚ β”‚ β”‚ β”‚ β€’ Sends tool execution request β”‚ β”‚ β”‚ β”‚ β€’ Includes Okta token for authentication β”‚ β”‚ β”‚ β”‚ β€’ Receives tool execution results β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ Response Generation β”‚ β”‚ β”‚ β”‚ β€’ Combines tool results with AI reasoning β”‚ β”‚ β”‚ β”‚ β€’ Formats response for human readability β”‚ β”‚ β”‚ β”‚ β€’ Streams response back to client β”‚ β”‚ β”‚ β”‚ β€’ Updates conversation history β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## Authentication Flow ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ IAM Trust Relationships β”‚ β”‚ β”‚ β”‚ Bedrock AgentCore Service Account β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό AssumeRole β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚ β”‚ β”‚ -bedrock-agentcore-gateway-role β”‚β”‚ β”‚ β”‚ β€’ lambda:InvokeFunction β”‚β”‚ β”‚ β”‚ β€’ bedrock-agentcore-test:*, bedrock-agentcore:* β”‚β”‚ β”‚ β”‚ β€’ s3:*, logs:*, kms:* β”‚β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚ β”‚ β”‚ β”‚ β”‚ β–Ό InvokeFunction β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚ β”‚ β”‚ -bedrock-agentcore-mcp-tool Lambda β”‚β”‚ β”‚ β”‚ β€’ Resource Policy allows Gateway role β”‚β”‚ β”‚ β”‚ β€’ Execution role trusts Lambda + Bedrock AgentCore servicesβ”‚β”‚ β”‚ β”‚ β€’ ReadOnlyAccess policy for AWS service queries β”‚β”‚ β”‚ β”‚ β€’ Bedrock model access for Strands Agent β”‚β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## Security Model **Authentication Layers:** 1. **Function URL**: AWS SigV4 authentication (IAM) 2. **Bedrock AgentCore Gateway**: Okta JWT validation 3. **Lambda Target**: Resource policy + execution role **Permission Details:** 1. Bedrock AgentCore Service Account (996756280381) assumes your gateway role 2. Gateway role has permissions to invoke Lambda functions 3. Lambda function resource policy allows the gateway role 4. Lambda execution role trusts both Lambda and Bedrock AgentCore services ## Data Flow Example **Example: "List my EC2 instances"** 1. Client β†’ Function URL: POST /stream + AWS SigV4 + Okta token 2. API Gateway β†’ Agent Lambda: Lambda event + Authorization header 3. Agent Lambda: Extract token from headers 4. Agent Lambda β†’ Bedrock AgentCore Gateway: POST /mcp + "Authorization: Bearer " 5. Bedrock AgentCore Gateway: Validate Okta token 6. Bedrock AgentCore Gateway β†’ Lambda Target: Invoke with Bedrock AgentCore context 7. Lambda Target β†’ Bedrock AgentCore Gateway: Tool execution result 8. Bedrock AgentCore Gateway β†’ Agent Lambda: MCP response 9. Agent Lambda: Process with Bedrock AI 10. Agent Lambda β†’ API Gateway: AI response with tool results 11. API Gateway β†’ Client: Streaming response ## Example Tool Execution **Natural Language Query: "Show me my EC2 instances in us-east-1"** ``` β”œβ”€β”€ Client: β”‚ β”œβ”€β”€ Sends natural language query β”‚ └── Includes Okta token for authentication β”œβ”€β”€ AWS Operations Agent Lambda: β”‚ β”œβ”€β”€ Calls Bedrock AI to understand intent β”‚ β”œβ”€β”€ Identifies need for describe_ec2_instances tool β”‚ └── Calls Bedrock AgentCore Gateway with token β”œβ”€β”€ Bedrock AgentCore Gateway: β”‚ β”œβ”€β”€ Validates Okta token β”‚ β”œβ”€β”€ Invokes Lambda target with tool parameters β”‚ └── Returns results to AWS Operations Agent Lambda β”œβ”€β”€ MCP Tool Lambda: β”‚ β”œβ”€β”€ Executes ec2_read_operations tool β”‚ β”œβ”€β”€ Calls EC2 DescribeInstances API β”‚ β”œβ”€β”€ Formats results for human readability β”‚ └── Returns structured data to Gateway β”œβ”€β”€ AWS Operations Agent Lambda: β”‚ β”œβ”€β”€ Processes tool results with Claude β”‚ β”œβ”€β”€ Generates natural language response β”‚ └── Streams response back to client └── Client: └── Displays formatted instance information ``` ## Technical Reference ### Endpoints - **Function URL**: `https://.lambda-url..on.aws/` - **Bedrock AgentCore Gateway (Data Plane)**: `https://.gateway.bedrock-agentcore..amazonaws.com/mcp` - **Bedrock AgentCore Control Plane**: `https://bedrock-agentcore-control..amazonaws.com` - **AWS Operations Agent Lambda**: `aws-operations-agent-` (invoked by Function URL) - **Okta OAuth**: `https://dev-09210948.okta.com/oauth2/default` ### Resource Names - **DynamoDB Table**: `aws-operations-agent-conversations-` - **AWS Operations Agent Lambda**: `aws-operations-agent-` - **MCP Tool Lambda**: `-bedrock-agentcore-mcp-tool` - **Gateway Role**: `BedrockAgentCoreGatewayExecutionRole-` ### Protocols - **Client ↔ API Gateway**: HTTPS REST API - **API Gateway ↔ Agent Lambda**: AWS Lambda Proxy Integration - **Agent Lambda ↔ Bedrock AgentCore Gateway**: MCP (JSON-RPC 2.0 over HTTPS) - **Bedrock AgentCore Gateway ↔ Lambda Target**: AWS Lambda Invocation - **OAuth**: JWT Bearer tokens (Okta) ### AWS Resources - **Account**: `` - **Region**: `` (e.g., us-west-2) - **Bedrock AgentCore Service Account**: 996756280381 (trusted) ## Configuration Template ### Required Placeholders to Replace: - ``: Your API Gateway ID (auto-generated) - ``: Your Bedrock AgentCore Gateway ID (e.g., 18HDCHKLHI) - ``: Your Gateway Target ID (e.g., L2NAO6MQLZ) - ``: Your name/identifier for role naming - ``: Deployment environment (dev, staging, prod) - ``: AWS region (e.g., us-east-1) - ``: Your AWS account ID ---