Infrastructure as Code template for deploying Amazon Bedrock Agents with CDK, Terraform, or CloudFormation.
- Multi-IaC Support: Choose CDK (TypeScript), Terraform, or CloudFormation
- Action Groups: Lambda-backed tools for agent capabilities
- Knowledge Bases: RAG integration with your data sources
- Guardrails: Content filtering and safety controls
- CI/CD Ready: GitHub Actions workflows included
bedrock-template/
├── cdk/ # AWS CDK (TypeScript)
│ ├── lib/
│ │ └── bedrock-agent-stack.ts
│ ├── bin/
│ │ └── app.ts
│ └── package.json
├── terraform/ # Terraform
│ ├── main.tf
│ ├── variables.tf
│ └── outputs.tf
├── cloudformation/ # CloudFormation
│ └── template.yaml
├── lambda/ # Action handler functions
│ └── actions/
│ └── handler.py
├── schemas/ # OpenAPI schemas for action groups
│ └── openapi.yaml
├── prompts/ # Agent instructions
│ └── instructions.txt
└── .github/
└── workflows/
└── deploy.yaml
- AWS CLI configured with appropriate credentials
- Node.js 18+ (for CDK)
- Python 3.12+ (for Lambda)
- Terraform 1.5+ (if using Terraform)
cd cdk
npm install
npx cdk deploycd terraform
terraform init
terraform applyaws cloudformation deploy \
--template-file cloudformation/template.yaml \
--stack-name bedrock-agent \
--capabilities CAPABILITY_IAMEdit prompts/instructions.txt to customize your agent's behavior and personality.
- Define your API in
schemas/openapi.yaml - Implement the handler in
lambda/actions/handler.py - Update the IaC to include the new action group
Configure knowledge base integration by:
- Creating an S3 bucket with your documents
- Setting up the vector database (OpenSearch Serverless recommended)
- Updating the IaC with knowledge base association
| Variable | Description | Required |
|---|---|---|
AWS_REGION |
AWS region for deployment | Yes |
FOUNDATION_MODEL |
Bedrock model ID | Yes |
AGENT_NAME |
Name for your agent | Yes |
anthropic.claude-3-5-sonnet-20241022-v2:0anthropic.claude-3-sonnet-20240229-v1:0anthropic.claude-3-haiku-20240307-v1:0amazon.titan-text-premier-v1:0meta.llama3-70b-instruct-v1:0
MIT