Module 6: Deploy to AWS
Learning Objectives
Section titled “Learning Objectives”- Understand Amazon Bedrock AgentCore Runtime
- Wrap a Strands agent for production deployment
- Deploy using the AgentCore starter toolkit
- Understand alternative deployment options (FastAPI + Docker)
Amazon Bedrock AgentCore
Section titled “Amazon Bedrock AgentCore”AgentCore is AWS’s managed platform for deploying AI agents. Key features:
| Feature | Description |
|---|---|
| Runtime | Serverless hosting, up to 8-hour execution windows |
| Gateway | Convert APIs to MCP tools automatically |
| Identity | Auth via Cognito, Okta, Entra ID |
| Memory | Persistent cross-session memory |
| Observability | CloudWatch dashboards |
| Policy | Natural language guardrails |
| Evaluations | 13 pre-built eval metrics |
Option A: AgentCore Starter Toolkit
Section titled “Option A: AgentCore Starter Toolkit”The fastest way to deploy.
-
Install the toolkit
Terminal window pip install bedrock-agentcore-starter-toolkit -
Review the deployment entry point
Terminal window code module_06_deploy/app.pyThe key addition is the
BedrockAgentCoreAppwrapper:from bedrock_agentcore.runtime import BedrockAgentCoreAppagent = Agent(system_prompt=SYSTEM_PROMPT,tools=[lookup_order, search_products, search_faq, create_support_ticket],)app = BedrockAgentCoreApp(agent=agent) -
Configure the deployment
Terminal window cd workshopagentcore configure -e module_06_deploy/app.pyThis creates deployment configuration files targeting
us-east-1. -
Deploy to AgentCore
Terminal window agentcore launchWait for deployment to complete (typically 2-5 minutes).
-
Check deployment status
Terminal window agentcore status -
Invoke the deployed agent
Terminal window agentcore invoke '{"prompt": "What is your return policy?"}'agentcore invoke '{"prompt": "Check order ORD-10001"}'
Option B: FastAPI + Docker
Section titled “Option B: FastAPI + Docker”For full control over the HTTP interface.
-
Review the FastAPI app
Terminal window code module_06_deploy/app_fastapi.pyKey endpoints:
GET /ping: Health check (required by AgentCore)POST /invocations: Invoke the agent
-
Run locally
Terminal window pip install fastapi uvicornuvicorn module_06_deploy.app_fastapi:app --host 0.0.0.0 --port 8080 -
Test with curl
Terminal window curl -X POST http://localhost:8080/invocations \-H "Content-Type: application/json" \-d '{"prompt": "What is your return policy?"}' -
Build Docker container (optional)
Terminal window docker build -t supportbot -f module_06_deploy/Dockerfile .docker run -p 8080:8080 supportbot
Deployment Architecture
Section titled “Deployment Architecture”flowchart TD
subgraph AC[Amazon Bedrock AgentCore]
subgraph RT[AgentCore Runtime]
Agent[🤖 Your Strands Agent\nSupportBot]
Agent --> Bedrock[Amazon Bedrock\nClaude Sonnet]
Agent --> Mem[AgentCore Memory]
Agent --> CW[CloudWatch Traces]
end
ID[🔐 Identity]
GW[🔌 Gateway]
POL[📋 Policy]
end
App[📱 Your Application\nWeb / Mobile / Slack] --> AC
Other Deployment Options
Section titled “Other Deployment Options”| Target | How | Best For |
|---|---|---|
| AgentCore | agentcore launch | Managed, serverless |
| AWS Lambda | Wrap with Lambda handler | Short tasks, event-driven |
| AWS Fargate | Docker container on ECS | Long-running, custom infra |
| AWS EKS | Kubernetes deployment | Large-scale, existing K8s |
| Docker | Any container platform | Portability |
CI/CD with GitHub Actions
Section titled “CI/CD with GitHub Actions”For automated deployments, use the GitHub Actions workflow from AWS:
name: Deploy SupportBoton: push: branches: [main]jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ROLE_ARN }} aws-region: us-east-1 - run: | pip install bedrock-agentcore-starter-toolkit agentcore configure -e module_06_deploy/app.py agentcore launchKey Takeaways
Section titled “Key Takeaways”- AgentCore provides managed, serverless agent hosting
- The
BedrockAgentCoreAppwrapper makes deployment straightforward - For custom HTTP interfaces, use FastAPI + Docker
- AgentCore includes identity, memory, gateway, policy, and observability out of the box
- Use CI/CD for automated, production-grade deployments