This is the improved setup, read my updated article about it here.
The old setup described in my original article can be found on the v1 branch.
- aws-cli
- Docker
- Maven >= 3.5
- Java >= 8
- Node >= 10.3.0
AWS SDK project for running the loadtest on AWS.
See README.md in project.
Contains AWS CDK project for creating needed infra for running loadtest on AWS.
See README.md in project.
Dockerfiles for realtime Gatling Monitoring
See README.md in project.
Mavenized Gatling project containing loadtest code.
Contains Dockerfile to build image to run on AWS.
See README.md in project.
Build the gatling-runner
project, so it creates the required jars needed for the Docker image.
Build the gatling-infra
project before calling cdk deploy
. The cdk tooling will not compile the code.
Now deploy the infra from the gatling-infra
project:
VPC_ID=<id> REPORT_BUCKET=<bucket> cdk deploy GatlingMonitoringEcsStack --profile <profile>
VPC_ID=<id> REPORT_BUCKET=<bucket> cdk deploy GatlingRunnerEcsStack --profile <profile>
Now run the loadtest on AWS using the aws-test-runner
project:
AWS_PROFILE=<profile> VPC_ID=<id> REPORT_BUCKET=<bucket> CLUSTER=gatling-cluster TASK_DEFINITION=gatling-runner SIMULATION=nl.codecontrol.gatling.simulations.BasicSimulation CONTAINERS=10 USERS=10 mvn clean compile exec:exec
When done with loadtesting the loadtest infra can easily be destroyed, saving on costs:
VPC_ID=<id> REPORT_BUCKET=<bucket> cdk destroy GatlingMonitoringEcsStack --profile <profile>
VPC_ID=<id> REPORT_BUCKET=<bucket> cdk destroy GatlingRunnerEcsStack --profile <profile>
Make sure the S3 bucket is empty before running cdk destroy
or it will fail since CloudFormation cannot delete S3 buckets that aren't empty.
When making changes to the Gatling code in the gatling-runner
project, don't forget to:
- build your
gatling-runner
project using Maven - and re-deploy your
GatlingRunnerEcsStack
fromgatling-infra
so AWS CDK will update your Docker image containing the Gatling code
Since this project uses many AWS services it can be a hassle to set all IAM permissions to get it to work if you dont want to run with admin rights.
In the root of this project is a IAM policy template: iam_policy_template.json
.
This template contains al the needed permissions to run this project. Just make sure to replace <result_bucket>
with your actual bucket name.