Terraform configuration to deploy OP stack with Flashblocks recipe on AWS EC2 using Docker Hub images.
- AWS CLI configured with appropriate credentials
brew install awscli
aws login
eval $(aws configure export-credentials --format env)- Terraform installed (>= 1.0)
brew install terraformCreate a terraform.tfvars file:
aws_region = "us-east-1"
instance_type = "t3.xlarge"
use_spot_instance = true # Use spot instances (60-70% cheaper, can be interrupted)
spot_max_price = "" # Empty = use on-demand price as max, or set custom max (e.g., "0.10")
flashblocks_rpc_image = "0xrampey/flashblocks-rpc:latest" # Docker Hub image (default)
allowed_ssh_cidr = "YOUR_IP/32" # Your public IP for SSH accessTerraform automatically generates an SSH key pair:
- Private key:
~/.ssh/builder-playground.pem(mode 0400) - Public key: Deployed to EC2 instance
- Used for SSH access to the instance
terraform init
terraform plan
terraform applyThe devnet starts automatically after EC2 provisioning and runs as a background daemon using nohup
Once connected via SSH:
# Check if daemon is running
ps aux | grep "go run main.go" | grep -v grep
# View live logs
tail -f /home/ec2-user/devnet.log
# Check Docker containers
docker ps
# Verify flashblocks-rpc container and ports
docker ps | grep flashblocks-rpc
# Should show: 0.0.0.0:8550->8545/tcpOnce the devnet is running, the Flashblocks RPC will be accessible on:
- Flashblocks RPC:
http://<public-ip>:8550
Note: Only port 8550 is exposed externally. Other services run internally on the EC2 instance.
When you update the Docker images on Docker Hub:
- SSH into the EC2 instance
- Pull the new images:
docker pull 0xrampey/flashblocks-rpc:latest - Restart the devnet:
/home/ec2-user/run-devnet.sh
To destroy all resources:
terraform destroyCheck the cloud-init logs:
sudo tail -100 /var/log/cloud-init-output.logCheck devnet logs:
tail -100 /home/ec2-user/devnet.logThe user data script installs Docker Compose v2.23.0 as a plugin to avoid compatibility issues with v5.0.0+.
If you see errors like unknown shorthand flag: 'f' in -f, the Docker Compose version is incompatible.
Verify version:
docker compose version # Should show: v2.23.0Spot instances are enabled by default and can save 60-70% compared to on-demand pricing. However:
If you need guaranteed availability, set use_spot_instance = false in terraform.tfvars.