This repository contains Terraform configurations and a Locust file to create a Locust instance on AWS to execute load tests. ⚡️
Before using this repository, you need to authenticate with AWS. You can either export your AWS access key and secret access key in your terminal:
export AWS_ACCESS_KEY_ID=AKIAXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=T9HyXXXXXXXXXXXXXXXXXXXXXXXXXXXX
In the variables.tf file, you need to configure several variables to customize your provisioning:
- node_size: to define the number of nodes you want to create.
- loadtest_dir_source: to define the location and file of your Locust plan script.
- locust_plan_filename: to define the name of your Locust plan file.
- subnet_name: to provide the correct subnet name in the variable file.
variable "node_size" {
description = "Size of total nodes"
default = 2
}
variable "loadtest_dir_source" {
default = "plan/"
}
variable "locust_plan_filename" {
default = "basic.py"
}
variable "subnet_name" {
default = "subnet-prd-a"
description = "Subnet name"
}
To create the infrastructure for your Locust instance, you need to execute the following commands on your terminal or CLI:
terraform init
terraform apply --auto-approve
Once the process completes, you can access the UI to load Locust and perform your load tests.
Execute the following command to delete all AWS resources that were created:
terraform destroy --auto-approve
For more information about this repository and how to use it, please refer to the following resources:
[Terraform aws-get-started >> install-terraform-on-linux 🔗](https://learn.hashicorp.com/tutorials/terraform/install-cli?