Member-only story
Super easy load testing for your Serverless APIs and Functions
Serverless moves your unit of scale from servers to number of requests you’re serving concurrently. This means that testing your APIs and functions must be handled differently — you need to test your request or “TPS” concurrency at peak rather than worry about total volume.
One of the most common things you need to do when working with Amazon API Gateway or AWS Lambda functions is to drive load at your serverless resources. One of the best and easiest ways to accomplish this is to use a free Node program called Artillery.
Simply start by installing Artillery via npm:
npm install -g artillery
Then you can use the following command to execute a load test:
artillery run [config file here.yaml]
Testing Lambda
In order to invoke a Lambda function, you’ll need to submit an HTTP POST to the Lambda service endpoint. The endpoint looks like this:
https://lambda.us-east-2.amazonaws.com
(this is region specific, so replace with your region)
You’ll need to provide a valid AWS v4 signature as the Authorization header. Its possible to generate that manually, but we’re going to use an Artillery plugin called artillery-plugin-aws-sigv4.
Just npm install it like this:
npm install artillery-plugin-aws-sigv4