Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

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.

1 Answer

0 votes
by (44.4k points)

As part of the event object mentioned, these values will be passed to your Lambda function.

nodejs lambda code:

exports.handler = (event, context, callback) =>{

  console.log("key1 is", event.key1)

  return 0

}

Related questions

Browse Categories

...