Infrastructure

Infrastructure Documentation #

BonsAI runs on AWS infrastructure managed with Terraform and Kubernetes. This section covers deployment, architecture, and operational procedures.

Infrastructure Overview #

Cloud Provider: AWS Infrastructure as Code: Terraform Container Orchestration: Amazon EKS (Kubernetes) Development Environment: Coder (on Kubernetes)

Key Services:

  • EKS cluster for application workloads
  • RDS PostgreSQL for database
  • S3 for document storage
  • ECR for container images
  • Route 53 for DNS
  • ALB for load balancing

Documentation Sections #

  • Overview - Complete infrastructure architecture, AWS services, and networking
  • Kubernetes - EKS cluster management, deployments, and operations
  • Coder - Cloud development environment administration and troubleshooting

Deploying Infrastructure #

Main Application Infrastructure #

The main infrastructure is defined in /tools/app-infra:

cd tools/app-infra/environments/dev
terraform init
terraform apply

EKS Cluster Resources #

Set up Kubernetes resources in the EKS cluster:

cd tools/app-infra/eks-resources
./init.sh -e dev \
  -a <AWS_ACCOUNT_ID> \
  -v <VPC_ID> \
  -c <ACM_ARN> \
  -d <DOPPLER_TOKEN> \
  -t <DATADOG_API_KEY>

For Developers #

Most developers won’t need to interact with infrastructure directly:

  • Development: Use Coder for cloud-based development
  • Preview Environments: Automatically deployed via GitHub Actions (see Preview Environments)
  • Production: Deployed via CI/CD pipeline

For DevOps #

  • Coder Administration: See Coder documentation for managing the development environment
  • Kubernetes Operations: See Kubernetes documentation for cluster management
  • Infrastructure Changes: Use Terraform in /tools/app-infra