Okay, so we've talked about a lot of the characteristics of a Lambda function, but what about the code? What does a function actually consist of?
Anatomy of a Lambda function
Handler function
First, we'll look at the handler function, the entry point for all Lambda functions. You choose your handler when creating the function. When the function executes, the service calls the handler function and passes in some event data and useful objects.
Let's have a look at the syntax for some handlers in different languages:
- Node.js:
exports.handler = function(event, context, callback) {
callback(null, "executed successfully");
}
The following is the fat-arrow syntax:
exports.handler = (event, context, callback...