Reputation: 2224
I am trying to pass some 'inputs' into my lambda function on a specific event and am researching ways of doing it. The serverless documentation shows examples of defining an input like such:
serverless.yml
functions:
aggregate:
handler: statistics.handler
events:
- schedule:
rate: rate(10 minutes)
enabled: false
input:
key1: value1
key2: value2
stageParams:
stage: dev
I am still unsure what exactly this is and how it can be accessed (if at all) from my handlers.js function.
If someone could de-mystify this, it would be highly appreciated.
Upvotes: 9
Views: 3911
Reputation: 4436
These values will be passed to your lambda function as part of event object.
nodejs lambda code:
exports.handler = (event, context, callback) =>{
console.log("key1 is", event.key1)
return 0
}
Upvotes: 10