Handler

As discussed briefly in the earlier chapter, the handler is basically a function that Lambda calls first for execution. A handler function is capable of processing incoming event data that is passed to it as well as invoking other functions or methods from your code.

In this book, we will be concentrating a lot of our code and development on Node.js; however, the programming model remains more or less the same for the other supported languages as well.

A skeleton structure of a handler function is shown as follows:

exports.myHandler = function(event, context, callback) {    
  // Your code goes here. 
  callback(); 
} 

Here, myHandler is the name of your handler function. By exporting it, we make sure that Lambda knows which function it has ...

Get Implementing AWS: Design, Build, and Manage your Infrastructure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.