Deploy a Lambda Function

AWS Lambda supports few different options to create deployment package and to deploy to lambda. For Java and C#, Lambda supports creating the package as a zip file and then to directly upload in Lambda or to upload in S3 and then to link the zipped file from S3. For NodeJS and Python, it supports an additional way to directly enter the code in Lambda which is beneficial if the code is very simple and does not require any other file.

Note that the AWS SDK does not need to be uploaded along with the code. Only the actual code and any other non-SDK packages need to be uploaded.

For NodeJS, if the code is uploaded as a zip file, then the code for the index.js (or as defined by the handler) file is displayed in the Lambda code editor. Code can be directly modified on the screen and tested and saved. This provides an easy to test the code. The editor also has syntax highlighter and can highlight errors and warning.

The code must have a exports.handler in the handler file defined. Otherwise, Lambda will fail to load the code and cannot run.

One thing to note is that if the code is uploaded from S3, then it needs to be re-linked from the lambda console everytime the configuration of the function is changed.