Lambda
Last updated
Last updated
Lambda provides you a capability to write your business logic code in form of lambda functions that can be used/executed via API Gateway or Schedules. Think of it like the functions/methods that are written in service layer of a backend application to interact with databases and executing business logic.
To create a Lambda Function just go to Code > Lambda and click on Add New. Enter the basic details - Name, Description, Interpreter & Docker Image - pymongo (Refer Lambda Runtime Section for creating docker runtime images) & select runtime memory accordingly.
In this example we will fetch data from MongoDB that is being created by Bidata Pipeline. Get the MongoDB connection details from Market Place > MongoDB and use the same in Lambda code to connect to MongoDB.
Add a new parameter in upper right corner of the screen to pass it into lambda function when it will be called.
Write your MongoDB code in the available main function to get data for a specific device id which can be passed into function using parameters, all the parameters will be available in args variable of main function.
Once you are done with the code then save the details, and navigate to Lambda List page.
To test the functionality of this lambda function click on {} Invoke button available in actions of Lambda. Then click on Try It Out and click on Execute button, wait for a few seconds to see the output in the Result tab.