An example of deploying an AI SDK agent to Amazon Bedrock Agent Core using HTTP protocol.
- Node.js v22+
- Docker for containerization
- AWS CLI configured with Bedrock permissions
- ECR Repository for storing your Docker image
-
Install dependencies
npm install
-
Set up AWS credentials
# Option 1: AWS CLI aws configure # Option 2: Environment variables export AWS_ACCESS_KEY_ID=your_access_key export AWS_SECRET_ACCESS_KEY=your_secret_key export AWS_REGION=us-east-1
-
Start development server
npm run dev
-
Test locally
curl -X POST http://localhost:8080/invocations \ -H "Content-Type: application/octet-stream" \ -d '{"input": "Hello! What can you help me with?"}'
aws ecr create-repository --repository-name ai-agent --region us-east-1# Get login token
aws ecr get-login-password --region us-east-1 | \
docker login --username AWS --password-stdin [account-id].dkr.ecr.us-east-1.amazonaws.com
# Build for ARM64 (Graviton processors)
docker build --platform linux/arm64 \
-t [account-id].dkr.ecr.us-east-1.amazonaws.com/ai-agent:latest .
# Push to ECR
docker push [account-id].dkr.ecr.us-east-1.amazonaws.com/ai-agent:latest- Open Bedrock Console → Agent Core → Create Agent
- Configure Agent Runtime:
- Image URI:
[account-id].dkr.ecr.us-east-1.amazonaws.com/ai-agent:latest
- Image URI:
- Set IAM Permissions for Bedrock model access
- Deploy and test in the Agent Sandbox
Use the Bedrock console with this test payload:
{
"input": "What are the key benefits of using AWS Bedrock Agent Core?"
}"Unsupported Media Type" Error
- Ensure Content-Type is
application/octet-stream - Bedrock Agent Core sends requests in this format
Model Access Denied
- Verify Bedrock model access in your AWS region
- Check IAM permissions for
bedrock:InvokeModel
Container Won't Start
- Check Docker platform matches deployment target (linux/arm64)
- Verify all dependencies are installed in production stage