Skip to content

Deploying ENSNode with Terraform

This guide walks through deploying ENSNode using Terraform to Render, with AWS-managed DNS. The Terraform configuration provides a complete infrastructure setup including database, ENSIndexer, ENSRainbow, and other required services.

Before starting, make sure you have:

  • Terraform installed
  • A Render account and an API token (create one)
  • Your Render owner ID and an environment name
  • RPC URLs for every chain you want to index (Mainnet, Sepolia, Base, Linea, and optionally Optimism, Arbitrum, and Scroll)
  • An AWS account and credentials for DNS management
  • An AWS S3 bucket named ensnode-terraform to store Terraform state

Copy the sample environment file and fill in your values:

Terminal window
cp terraform/.env.sample terraform/.env.local

Edit terraform/.env.local. Terraform reads variables that start with TF_VAR_ and passes them into the configuration automatically:

Terminal window
# ENSNode version
TF_VAR_ensnode_version="v0.0.0" # pin to a release from https://github.com/namehash/ensnode/releases
# ENSRainbow Searchlight label set version
TF_VAR_ensrainbow_searchlight_label_set_version="1" # see https://ensnode.io/ensrainbow/concepts/glossary#label_set_version
# Optional: ENSAdmin server connection library URLs
TF_VAR_next_public_server_connection_library=""
# Optional: used by some Render service modules
TF_VAR_anthropic_api_key=""
TF_VAR_alchemy_api_key=""
TF_VAR_quicknode_api_key=""
TF_VAR_quicknode_endpoint_name=""
# Render
TF_VAR_render_api_key="your_render_api_key"
TF_VAR_render_owner_id="your_render_owner_id"
TF_VAR_render_environment="your_render_environment"
# Mainnet RPC URLs
TF_VAR_ethereum_mainnet_rpc_url="your_ethereum_mainnet_rpc_url"
TF_VAR_base_mainnet_rpc_url="your_base_mainnet_rpc_url"
TF_VAR_linea_mainnet_rpc_url="your_linea_mainnet_rpc_url"
TF_VAR_optimism_mainnet_rpc_url="your_optimism_mainnet_rpc_url"
TF_VAR_arbitrum_mainnet_rpc_url="your_arbitrum_mainnet_rpc_url"
TF_VAR_scroll_mainnet_rpc_url="your_scroll_mainnet_rpc_url"
# Sepolia RPC URLs
TF_VAR_ethereum_sepolia_rpc_url="your_ethereum_sepolia_rpc_url"
TF_VAR_base_sepolia_rpc_url="your_base_sepolia_rpc_url"
TF_VAR_linea_sepolia_rpc_url="your_linea_sepolia_rpc_url"
TF_VAR_optimism_sepolia_rpc_url="your_optimism_sepolia_rpc_url"
TF_VAR_arbitrum_sepolia_rpc_url="your_arbitrum_sepolia_rpc_url"
TF_VAR_scroll_sepolia_rpc_url="your_scroll_sepolia_rpc_url"

The Terraform configuration creates the following components:

  • Render
    • Render project and environment
    • PostgreSQL server for hosting ENSDb
    • ENSIndexer and ENSApi instances for each supported configuration template (Alpha, Alpha-Sepolia, v2-Sepolia, Mainnet, and Sepolia)
    • ENSRainbow instance for each supported label set (searchlight, subgraph)
  1. Initialize Terraform:
Terminal window
cd terraform
terraform init
  1. Review the planned changes:
Terminal window
terraform plan
  1. Apply the configuration:
Terminal window
terraform apply

To destroy the infrastructure:

Terminal window
terraform destroy