AWS S3 is recommended way to deploy nodejs application to aws lambda for artifacts with a size > 10 Mb. However it is a MUST for size ≥ 50 Mb for the final deployment package, Reference to lambda upload restrictions using direct upload of final deployment package

To upload a Nodejs application to AWS Lambda via S3, follow these steps:

Step-1: Log in to the AWS management console and under services select S3 and select s3 create bucket

Step-2: Once the bucket is created select the bucket and select upload

Step-3:Browse to where your .zip file is located in your system (Note: It must contain all the dependencies required by the program inside the .zip file along with its corresponding package.json file for aws lambda to execute successfully)

Step-4:After clicking on open click next to go to set permissions and make sure the bucket has read and write access so aws lambda can access the bucket and its data when required

Step-5: Click upload

Step-6 Go to your bucket. Select the .zip file as shown. Copy its object URL onto your clipboard. We will use this in Step-10

Step-7: Go to services,Select lambda and then create function

Step-8: Click on your newly created lambda function and scroll down under configuration. Look for Execution role. Under that make sure you use a role which has S3 read and write access(Refer to this link)

Step-9: Now scroll up to Function code and select Code entry point and under that select Upload file from S3

Step-10: Paste the S3 object URL and click save

Step-11: Run your lambda function


This is the best practice to nodejs application to aws lambda when code size is ≥ 10 Mb.