This repo contains the automation code to deploy a substrate.io cluster in AWS with EC2 instances in dev mode. Terraform is used for the infrastructure deployment, and Ansible will be used for the configuration of said infrastructure.
To execute the example, inspect the terraform/example_substrate_cluster folder:
-
main.tf:cluster_name: the name for all the AWS resources to be prefixedssh_key_name: ssh key name of the key to assign to the EC2 instances (it must already exist in the AWS region)node_count: number of EC2 instances to launch
-
providers.tf:bucket: S3 bucket (pre-existent) for terraform state to be stored inkey: path to the file where to store the terraform state inside the S3 bucketregion: region of the bucket
Also inspect the Makefile and make sure the AWS_ASG_NAME and ANSIBLE_SSH_PKEY` variables are correctly set:
AWS_ASG_NAME: use the same value formcluster_nameabove, plus suffixing_nodes.ANSIBLE_SSH_PKEY: absolute path to the SSH private key used to access the EC2 instances
These last two variables usage needs to be improved to not have to edit the Makefile.
- Ansible 2.12.1 or newer
- Terraform 1.3.6 or newer
- AWS CLI 2.7.17 or newer
After setting the required variables and having the requirements met, to run this automation, cd to the root of this repo, and execute:
make allYou will be prompted to confirm when creating the AWS resources, but after that, the rest of the script will run on an unattended fashion.