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.
These Terraform scripts are currently specific to ENSNode instances hosted by NameHash Labs. While they provide a good starting point for deploying your own ENSNode instance, you will need to make modifications to suit your specific deployment needs. We plan to generalize these scripts in the future to better support community deployments.
What you must bring
Section titled “What you must bring”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-terraformto store Terraform state
ENSIndexer runs CREATE EXTENSION IF NOT EXISTS pg_trgm at startup to back partial-name search indexes. Render’s managed Postgres has pg_trgm available by default; if you adapt this configuration to a different provider, confirm the extension is available for installation on your Postgres plan.
Configuration
Section titled “Configuration”Copy the sample environment file and fill in your values:
cp terraform/.env.sample terraform/.env.localEdit terraform/.env.local. Terraform reads variables that start with TF_VAR_ and passes them into the configuration automatically:
# ENSNode versionTF_VAR_ensnode_version="v0.0.0" # pin to a release from https://github.com/namehash/ensnode/releases
# ENSRainbow Searchlight label set versionTF_VAR_ensrainbow_searchlight_label_set_version="1" # see https://ensnode.io/ensrainbow/concepts/glossary#label_set_version
# Optional: ENSAdmin server connection library URLsTF_VAR_next_public_server_connection_library=""
# Optional: used by some Render service modulesTF_VAR_anthropic_api_key=""TF_VAR_alchemy_api_key=""TF_VAR_quicknode_api_key=""TF_VAR_quicknode_endpoint_name=""
# RenderTF_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 URLsTF_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 URLsTF_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"What it creates
Section titled “What it creates”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)
Deployment steps
Section titled “Deployment steps”- Initialize Terraform:
cd terraformterraform init- Review the planned changes:
terraform plan- Apply the configuration:
terraform applyCleanup
Section titled “Cleanup”To destroy the infrastructure:
terraform destroy