Use Lambda
Vanus supports sending direct events to AWS Lambda. The following page will teach you how to use Lambda with vsctl command in Vanus.
Prerequisites
Before using Lambda, you must meet the following prerequisites:
- Have a running Vanus cluster.
- Have vsctl.
- An AWS account configured with Access Keys.
- Have a Lambda function
- The "lambda:InvokeFunction" permission grant for your AWS user account
Create a Subscription to Use with Lambda
When you create a subscription setting the protocol
flag as "aws-lambda", Vanus will send all available events to your aws-lambda.
Use the command below to create your Subscription:
vsctl subscription create \
--name=test-lambda \
--eventbus=test-lambda \
--sink "arn:aws:lambda:us-west-2:843378899134:function:eventecho" \
--protocol aws-lambda \
--credential-type aws \
--credential '{"access_key_id":"xxxxxx","secret_access_key":"xxxxxxx"}'
The following params are also required:
sink
: your lambda function ARN.credential-type
: must be "aws".credential
: AWS account Access Keys,JSON format use properties "access_key_id" and "secret_access_key".