Example how with AWS CDK you can deploy a load test infrastructure using Locust.io
The infrastructure code is written in Python, it executes a master\slave Locust infrastructure
I totally love LOCUST and CDK!
Install the CDK framework
npm install -g aws-cdk
Install the Python dependencies
pip install -r requirements.txt
Authenticate in your AWS account:
Follow this guide: Configuring the AWS CLI
Bootstrap AWS CDK (if needed)
cdk bootstrap --region eu-west-1
Deploy locust:
export AWS_PROFILE="profilename"
export AWS_DEFAULT_REGION="eu-west-1"
cdk deploy locuster
.....
✅ locuster
Outputs:
locuster.LocustWebConsole = http://locus-nbala-15IY958M7LUVF-ab8bf6ee96743c80.elb.eu-west-1.amazonaws.com:8089
After the deployment you need to wait for a 1-minute maximum, you can start the load using the output address
Destroy locust:
cdk destroy locuster
Local test:
You can try locally the platform:
cd docker
docker-compose up --scale worker=2 --build
Customize the loucustfile test code:
You can customize the code inside the docker/code directory
Have fun!