This repository provides an example project for deploying an AWS Bedrock Agent using Terraform and GitHub Actions. It also includes a sample Python Lambda function that the agent can invoke to perform custom actions.
.
├── lambda/ # Python source code for the Lambda function
│ ├── app.py # Lambda handler
│ └── requirements.txt # Python dependencies
├── terraform/ # Terraform configuration to deploy the agent and Lambda
│ ├── main.tf
│ ├── outputs.tf
│ ├── provider.tf
│ └── variables.tf
└── .github/workflows/ # GitHub Actions workflows
└── terraform.yml # CI/CD pipeline
The Terraform configuration creates an IAM role, deploys the Lambda function and provides a placeholder for future Bedrock Agent resources. Customize terraform/main.tf
once the Bedrock Agent Terraform resources become available.
Run the following commands locally to deploy:
terraform -chdir=terraform init
terraform -chdir=terraform plan
terraform -chdir=terraform apply
The workflow defined in .github/workflows/terraform.yml
automatically packages the Lambda code, initializes Terraform and applies the configuration after a pull request is merged into the main
branch.
The sample Lambda function located in lambda/app.py
simply logs the incoming event and returns a JSON payload. Extend this file with any custom logic needed by your Bedrock Agent.
- Ensure you have Terraform installed.
- Configure AWS credentials in your environment (e.g., using
aws configure
). - Package the Lambda function and apply the Terraform configuration.
This setup demonstrates how infrastructure as code and automation can be combined to manage Bedrock Agents on AWS.