Deployment of the ECS task definitions with Terraform¶
You can use Terraform to deploy the ECS task definitions needed for the Dask cluster.
Prerequisites¶
You need to have Terraform installed and configured with your AWS credentials.
Steps¶
Clone the LabCas workflows repository:
git clone https://github.com/jpl-labcas/workflows.git
Create an environment directory from the provided template:
cp -r workflows/terraform/environments/env_template workflows/terraform/environments/your_env_name
Edit the ml_cluster.tfvars file in your new environment directory to set your AWS region, VPC ID, subnet IDs, ECS cluster name, task CPU and memory, and desired count of tasks:
region = "your-aws-region" vpc_id = "your-vpc-id" subnet_ids = ["subnet-id-1", "subnet-id-2"] ecs_cluster_name = "your-ecs-cluster-name" task_cpu = "512" task_memory = "1024" desired_count = 2
Edit the terraform.tfvars file in the Terraform directory specify the backend configuration for storing the Terraform state.
Navigate to the Terraform directory for ECS task definitions:
cd workflows/terraform/application/ml_cluster
Initialize Terraform:
terraform init -backend-config=../../environments/your_env_name/terraform.tfvars
Review the Terraform plan:
terraform plan -var-file=../../environments/your_env_name/ml_cluster.tfvars
Apply the Terraform configuration to create the ECS task definitions:
terraform apply -var-file=../../environments/your_env_name/ml_cluster.tfvars
Confirm the apply action when prompted.