This CDK project deploys Locust, an Open Source load tesing framework using AWS CDK. This uses CDK in Typescript and is inspired by the CDK Python Locust project.
The this will deploy:
- Amazon VPC with NAT Gateways
- ECS on Fargate with two services:
- Locust Primary - Single Primary (master) container, behind an ALB
- Locust Workers - Multiple workers (slave) containers (10 by default)
- VPC Security Group permissions - all necessary secgroups to allow primary/worker communication
- IAM roles and policies required for running the AWS services
- AWS CloudMap - for service discovery between primary and workers
- Locust Containers - built as an asset by CDK from the DockerHub container and stored in ECR
git clone https://github.com/tomellis/cdk-locust
clone the repocd cdk-locust && npm install
install npm dependenciesnpm run build
compile typescript to jscdk synth
emits the synthesized CloudFormation templatecdk deploy
deploy this stack to your default AWS account/regioncdk deploy --require-approval never
deploy the stack without cli nagging you to approve- Customise by adding your Locust tests to
locust-container/locustfile.py
and these will be added to the container on build