Listen… While ago, I wrote the post Using Artillery to test REST Services showing how to install, configure and run some simple load tests. This post is a follow up showing how to configure Artillery.io to run Distributed Load Testing on AWS Lambda.
Getting What You Need

Before start, I suggest you read the post Using Artillery to test REST Services to know Artillery better.
You’ll need an AWS account with permissions to deal with S3 Buckets, Lambda Functions, SQS Queues and ECR (Elastic Container Registry).
I encourage you to use the AWS CLI tools, is much faster to configure what you’ll need. Check the AWS documentation here.
Artillery will create AWS resources to execute your tests. All resources are serverless and created on-demand. There are no long-running infrastructure components involved.
The AWS profile that will run Artillery, need to have sufficient permissions to be able to create the resources listed above.
Knowing Your Limitations
AWS Lambda is limited to 15 minutes of running time, which means that you test cannot run for longer than 15 minutes.
Once a load test starts, it will run to completion, the Lambda cannot be interrupted. Be mindful of this, and ramp up load on your applications gradually.
This is very important: before and after hooks run once in each Lambda worker rather than once per test run.
Options like --target, and --insecure flags for the run command are unavailable in Lambda tests.
Running Tests
To run a test just call Artillety passing some extra parameters like
artillery run-lambda --region us-west-1 my-test.yml
I used a docker image to run tests so I had to pass AWS credentials to the container environemnt with variables, like so:
docker run --rm -it -e AWS_ACCESS_KEY_ID="YOUR-KEY" -e AWS_SECRET_ACCESS_KEY="YOUR-SECRET" -e AWS_SESSION_TOKEN="YOUR-TOKEN" -v /tmp/tc:/scripts artilleryio/artillery:latest run-lambda --region sa-east-1 --count 1 --lambda-role-arn 'arn:aws:iam::12345:role/Lambda_artillery' /scripts/my-test.yml
If you want to knwo more about docker, check this post: Deploying a Docker Service Stack
Here are some Lambda specific options:
| Option | Description |
--region <region> | The AWS region to run in (us-east-1, us-west-1, eu-west-1, eu-central-1, ap-south-1, ap-northeast-1) |
--count <num> | Number of load generators to launch. |
--tags <tags> | Comma-separated list of tags in key:value format to tag the test run, for example: --tags team:sre,service:foo |
--note <text> | Attach a note to a text, for example: --note "This is a spike test for service foo" |
--container | Use a container image for Lambda |
--memory-size <number> | Memory size of the Lambda function in bytes. Default: 4096. |
--lambda-role-arn <role> | ARN of the IAM role to use for the Lambda function. |
--security-group-ids <ids> | Comma-separated list of AWS VPC security group IDs to launch Lambda tasks in. |
--subnet-ids <ids> | Comma-separated list of subnet IDs to use for the Lambda function. |
--architecture <string> | Architecture of the Lambda function. Default: arm64 (Graviton(opens in a new tab)). Legacy x86 may be set with x86_64 |
Conclusion
Distributed load testing with AWS Lambda using Artillery opens up a powerful way to evaluate your application’s resilience under heavy traffic. By leveraging serverless resources, you can run tests at scale without managing infrastructure, keeping costs and complexity in check.
Until nex one!






