Skip to content

Module 6: Deploy to AWS

  • Understand Amazon Bedrock AgentCore Runtime
  • Wrap a Strands agent for production deployment
  • Deploy using the AgentCore starter toolkit
  • Understand alternative deployment options (FastAPI + Docker)

AgentCore is AWS’s managed platform for deploying AI agents. Key features:

FeatureDescription
RuntimeServerless hosting, up to 8-hour execution windows
GatewayConvert APIs to MCP tools automatically
IdentityAuth via Cognito, Okta, Entra ID
MemoryPersistent cross-session memory
ObservabilityCloudWatch dashboards
PolicyNatural language guardrails
Evaluations13 pre-built eval metrics

The fastest way to deploy.

  1. Install the toolkit

    Terminal window
    pip install bedrock-agentcore-starter-toolkit
  2. Review the deployment entry point

    Terminal window
    code module_06_deploy/app.py

    The key addition is the BedrockAgentCoreApp wrapper:

    from bedrock_agentcore.runtime import BedrockAgentCoreApp
    agent = Agent(
    system_prompt=SYSTEM_PROMPT,
    tools=[lookup_order, search_products, search_faq, create_support_ticket],
    )
    app = BedrockAgentCoreApp(agent=agent)
  3. Configure the deployment

    Terminal window
    cd workshop
    agentcore configure -e module_06_deploy/app.py

    This creates deployment configuration files targeting us-east-1.

  4. Deploy to AgentCore

    Terminal window
    agentcore launch

    Wait for deployment to complete (typically 2-5 minutes).

  5. Check deployment status

    Terminal window
    agentcore status
  6. Invoke the deployed agent

    Terminal window
    agentcore invoke '{"prompt": "What is your return policy?"}'
    agentcore invoke '{"prompt": "Check order ORD-10001"}'

For full control over the HTTP interface.

  1. Review the FastAPI app

    Terminal window
    code module_06_deploy/app_fastapi.py

    Key endpoints:

    • GET /ping: Health check (required by AgentCore)
    • POST /invocations: Invoke the agent
  2. Run locally

    Terminal window
    pip install fastapi uvicorn
    uvicorn module_06_deploy.app_fastapi:app --host 0.0.0.0 --port 8080
  3. Test with curl

    Terminal window
    curl -X POST http://localhost:8080/invocations \
    -H "Content-Type: application/json" \
    -d '{"prompt": "What is your return policy?"}'
  4. Build Docker container (optional)

    Terminal window
    docker build -t supportbot -f module_06_deploy/Dockerfile .
    docker run -p 8080:8080 supportbot
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
TargetHowBest For
AgentCoreagentcore launchManaged, serverless
AWS LambdaWrap with Lambda handlerShort tasks, event-driven
AWS FargateDocker container on ECSLong-running, custom infra
AWS EKSKubernetes deploymentLarge-scale, existing K8s
DockerAny container platformPortability

For automated deployments, use the GitHub Actions workflow from AWS:

.github/workflows/deploy-agent.yml
name: Deploy SupportBot
on:
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 launch
  • AgentCore provides managed, serverless agent hosting
  • The BedrockAgentCoreApp wrapper 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