Setup Locust on Linux using Docker
Updated: May 31
This post details steps to set up locust in stand-alone & distributed mode with the help of docker.
Locust can be installed independently without docker by making sure we install dependencies first. With docker, we don't need to worry about dependencies. With one single command, we can make locust up both in standalone & distributed mode. With this post, we will be achieving the same.
Putty - To connect to AWS instance & puttygen utility to generate a private key in PPK format
WinSCP - To upload locust file from windows to Linux
Make sure you save generated private key at a safe place.
Change the permissions of the key as indicated here
Make sure instance gets into the running state. Note Public DNS from instance status window.
Use puttygen to convert private key file to.ppk format. Steps can be referred here
In case you don't have a Linux machine:
AWS Console Login - To Launch EC2 instance
Please follow steps to connect AWS EC2 instance using putty
MILESTONE STEPS TO SETUP LOCUST ON LINUX USING DOCKER
Include the ec2-user on your docker set and execute the command without having to use sudo.
Right-click on top of terminal and select duplicate terminal to open a fresh new terminal
Type command :
You get to see a lot of information. Your docker is installed.
Next step is to pull official docker image for locust
Locust Official image is available on docker hub. Give pull command:
Verify image is available on aws machine using docker image command:
Run below command:
This command will execute locust in standalone mode & locust UI could be opened at Http://<machineIp>:8089
To run locust in distributed mode extra port binding is required for master-slave communication: