Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

EC2 + Docker Compose + ClickHouse (BYODB)

Low-cost AWS deployment. A single EC2 instance running eRPC and rindexer with your own external ClickHouse database. Best for analytics workloads on a budget.

Architecture

┌────────────────── AWS VPC ──────────────────┐
│                                              │
│  EC2 Instance (Docker Compose)               │
│  ├── eRPC proxy (port 4000)                  │
│  └── rindexer indexer                        │
│       └── writes to ────────────────────────────→ ClickHouse (external)
│                                              │
│  Secrets Manager (CH creds, RPC URL)         │
│  CloudWatch Logs (30-day retention)          │
└──────────────────────────────────────────────┘

What Gets Deployed

  • VPC with public/private subnets, Internet Gateway, security groups
  • EC2 instance with Docker + Compose pre-installed (cloud-init)
  • eRPC container -- RPC proxy with failover and caching (256m memory)
  • rindexer container -- EVM event indexer (512m memory)
  • IAM role (CloudWatch Logs + Secrets Manager access)
  • Secrets Manager secret for ClickHouse credentials
  • CloudWatch Log Group with 30-day retention

Not deployed: No database -- you bring your own ClickHouse instance (ClickHouse Cloud free tier works).

Prerequisites

  • Terraform >= 1.5.0
  • AWS CLI v2 with configured credentials (EC2, VPC, IAM, Secrets Manager)
  • SSH key pair
  • A ClickHouse instance (ClickHouse Cloud free tier or self-hosted)

Quick Start

git clone https://github.com/ExoMonk/evm-cloud.git
cd evm-cloud/examples/minimal_aws_byo_clickhouse
 
cp secrets.auto.tfvars.example secrets.auto.tfvars
# Edit secrets.auto.tfvars:
#   ssh_public_key             = "ssh-ed25519 AAAA..."
#   indexer_clickhouse_url      = "https://your-instance.clickhouse.cloud:8443"
#   indexer_clickhouse_password = "your-password"
 
terraform init
terraform plan -var-file=minimal_clickhouse.tfvars
terraform apply -var-file=minimal_clickhouse.tfvars
 
# Verify
terraform output -json workload_handoff | jq -r '.runtime.ec2.public_ip'
ssh -i ~/.ssh/evm-cloud ubuntu@<public-ip> 'sudo docker compose -f /opt/evm-cloud/docker-compose.yml ps'

Key Variables

VariableTypeDefaultDescription
ec2_instance_typestringt3.microEC2 instance size
indexer_clickhouse_urlstring-ClickHouse HTTP endpoint (sensitive)
indexer_clickhouse_userstringdefaultClickHouse username
indexer_clickhouse_passwordstring-ClickHouse password (sensitive)
indexer_clickhouse_dbstringdefaultClickHouse database name
ec2_rpc_proxy_mem_limitstring256meRPC container memory limit
ec2_indexer_mem_limitstring512mrindexer container memory limit

When to Use This

Choose this example when:
  • You want the cheapest AWS deployment (~$15-35/mo for the EC2 instance alone)
  • Your workload is analytics-heavy (ClickHouse excels at wide scans and aggregations)
  • You already have a ClickHouse instance or want to use the free tier
Consider alternatives when:

See examples/minimal_aws_byo_clickhouse for complete details.