Artillery.io AWS Lambda Plugin
Load test AWS Lambda with Artillery.io
Based on the Kinesis Engine by Shoreditch.
Usage
Important: The plugin requires Artillery 1.5.8-3
or higher.
Install the plugin
# If Artillery is installed globally:
npm install -g artillery-engine-lambda
Use the plugin
- Set
config.target
to the name of the Lambda function - Specify additional options in
config.lambda
:region
- AWS region (default:us-east-1
)
- Set the
engine
property of the scenario tolambda
. - Use
invoke
in your scenario to invoke the Lambda function - Specify additional invocation parameters:
payload
- String or object with the payload to send to the Lambda functioninvocationType
- Lambda invocation type. One ofEvent
,RequestResponse
,DryRun
logType
- One ofNone
,Tail
qualifier
- Lambda qualifierclientContext
- client context to pass to the Lambda function as contexttarget
- invocation specific target overriding global default inconfig.target
.
Payload substitution
The Lambda payload can include variable and function placeholders in the form of {{ [VAR_NAME_OR_FUNC_CALL] }}
.
For example the payload might include a call to the built-in Artillery functions $randomNumber(min max)
or $randomString(length)
.
Use $contextUid()
to get the scenario unique ID in your payload.
Example Script
config: target: "lambda_function_name" lambda: region: "us-east-1" phases: arrivalCount: 10 duration: 1 engines: lambda: {} scenarios: - name: "Invoke function" engine: "lambda" flow: - loop: - invoke: # data may be a string or an object. Objects # will be JSON.stringified. clientContext: '{"app": "MyApp"}' invocationType: "Event" logType: "Tail" payload: "Some payload" qualifier: "1" - think: 1 count: 100
(See example.yml for a complete example.)
Run Your Script
AWS_PROFILE=dev artillery run my_script.yml