git clone https://github.com/synacktraa/clickhouse-on-ec2-using-tf.git
cd clickhouse-on-ec2-using-tf
terraform init
ssh-keygen -t rsa -b 4096 -f ec2-clickhouse
terraform apply
instance_type - Change Instance’s type (Default: t3.small)volume_size - Modify storage size of the device (Default: 20gb)allowed_cidr_blocks - Restrict access to certain IPs (Default: 0.0.0.0/0)Type yes when prompted to confirm the deployment.
After deployment, get the connection details:
# Get public IP and connection info
terraform output
# Get the generated password of clickhouse server (sensitive output)
terraform output -raw clickhouse_password
$(terraform output -raw ssh_command)
# Basic health check
curl http://$(terraform output -raw public_ip):8123/ping
# Run a simple query
curl -u "default:$(terraform output -raw clickhouse_password)" "http://$(terraform output -raw public_ip):8123/?query=SELECT+version()"
clickhouse-client --host $(terraform output -raw public_ip) --port 9000 --user default --password $(terraform output -raw clickhouse_password)
To destroy all resources:
terraform destroy
Type yes when prompted to confirm destruction.
netstat -tlnp | grep :8123curl localhost:8123/pingWe use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.