Skip to content

AWS Terraform Deployment

Fresh

Deploy Greptile on AWS with Terraform automation. One command creates VPC, EC2, RDS PostgreSQL, ElastiCache Redis, and bootstraps the full stack.

The Terraform stack provisions all AWS infrastructure and bootstraps Greptile automatically.

What Gets Created

ResourcePurpose
VPCPrivate network with public/private subnets
EC2Server running Docker Compose
RDS PostgreSQLApplication database with pgvector
ElastiCache RedisCaching layer
S3 BucketSecrets storage
Security GroupsNetwork access control
IAM RolesService permissions

Prerequisites

AWS Permissions

Your AWS user/role needs permissions for:

* EC2 (instances, security groups, key pairs)
* RDS (instances, subnet groups, parameter groups)
* ElastiCache (clusters, subnet groups)
* VPC (VPCs, subnets, route tables, NAT gateways, internet gateways)
* S3 (buckets, objects)
* IAM (roles, policies, instance profiles)

Local Tools

* Terraform 1.0+
* AWS CLI configured (`aws configure`)

From Greptile

* Container registry credentials (`CONTAINER_REGISTRY`, `GREPTILE_TAG`)
* License (contact [hello@greptile.com](mailto:hello@greptile.com))

GitHub App

Create a GitHub App with:

* Webhook URL: `http://<EC2_IP>:3007/webhook` (update after deployment)
* Permissions: Contents (read), Pull requests (read/write), Issues (read/write)
* Events: Pull request, Push, Issue comment

You'll need: App ID, Client ID, Client Secret, Private Key, Webhook Secret

LLM Provider

API keys for at least one provider:

* Anthropic, Claude models
* OpenAI, GPT models
* AWS Bedrock, Various models

Setup

Clone the repository

```bash theme={}
git clone https://github.com/greptileai/akupara.git
cd akupara/terraform/stacks/aws-ec2
```

Create configuration file

```bash theme={}
cp terraform.tfvars.example terraform.tfvars
```

Edit terraform.tfvars

```hcl theme={}
# AWS
aws_region  = "us-east-1"
aws_profile = "default"
app_name    = "greptile"

# GitHub App
github_client_id      = "Iv1.xxx"
github_client_secret  = "xxx"
github_webhook_secret = "xxx"
github_private_key    = <<-EOT
-----BEGIN RSA PRIVATE KEY-----
...your private key...
-----END RSA PRIVATE KEY-----
EOT

# LLM (set the ones you use)
openai_api_key    = "sk-..."
anthropic_api_key = "sk-ant-..."
```

See terraform.tfvars.example for all options.

Initialize and deploy

```bash theme={}
terraform init
terraform plan    # Review what will be created
terraform apply   # Type 'yes' to confirm
```

Deployment takes 10-15 minutes.

Get the URL

```bash theme={}
terraform output greptile_url
```

Update your GitHub App webhook URL to `http://<EC2_IP>:3007/webhook`.

Access

ServiceURL
Web UIhttp://<EC2_IP>:3000
Hatchet Adminhttp://<EC2_IP>:8080

Configuration

Instance Sizing

Modify `ec2_instance_type` in `terraform.tfvars`:

| Team Size | Instance     | vCPU | RAM   |
| --------- | ------------ | ---- | ----- |
| 5-10 devs | `t3.xlarge`  | 4    | 16GB  |
| \~50 devs | `m5.2xlarge` | 8    | 32GB  |
| 100 devs  | `m5.8xlarge` | 32   | 128GB |

```hcl theme={}
ec2_instance_type = "m5.2xlarge"
```

Database Sizing

Modify `db_instance_class`:

```hcl theme={}
db_instance_class = "db.r5.large"   # Default
db_instance_class = "db.r5.xlarge"  # Larger teams
```

Custom VPC CIDR

```hcl theme={}
vpc_cidr = "10.0.0.0/16"  # Default
```

SSH Key

To enable SSH access:

```hcl theme={}
key_name = "your-ec2-keypair-name"
```

Operations

SSH into EC2

```bash theme={}
ssh -i your-key.pem ec2-user@<EC2_IP>
cd /opt/greptile
```

View logs

```bash theme={}
ssh ec2-user@<EC2_IP>
cd /opt/greptile
docker compose logs -f              # All services
docker compose logs -f greptile-api # Specific service
```

Update Greptile

```bash theme={}
ssh ec2-user@<EC2_IP>
cd /opt/greptile
docker compose pull
docker compose up -d
```

Check service status

```bash theme={}
docker compose ps
sudo systemctl status greptile-app
```

Destroy

To remove all infrastructure:

bash
terraform destroy

Warning

This deletes everything including the database. Export data first if needed.

Troubleshooting

EC2 not accessible

* Verify security group allows inbound on ports 3000, 3007, 8080
* Check EC2 is in public subnet with internet gateway
* Confirm EC2 instance is running: `aws ec2 describe-instances`

Services not starting

SSH in and check:

```bash theme={}
sudo journalctl -u greptile-app -f
docker compose ps
docker compose logs
```

Database connection failed

* Verify RDS security group allows traffic from EC2 security group
* Check RDS instance is available: `aws rds describe-db-instances`

Webhooks not working

* Update GitHub App webhook URL to `http://<EC2_IP>:3007/webhook`
* Check security group allows inbound on port 3007
* Verify webhook secret matches `github_webhook_secret` in tfvars

Resources

  • Terraform stack source
  • Terraform modules

Source

Mirrored from the official Greptile documentation. Self-contained reference copy.