Using require in AWS lambda functions
Just to add to Justin's answer, yes you can require other files in lambda with this structure as an example:
| main.js << The handler is here
| func1.js
| func2.js
and in the main file:
// main.js
require('./func1.js');
require('./func2.js');
Yes, you can. You just have to ensure that the node_modules
folder is uploaded as part of your package (you won't be able to use the console editor). You can read more details on the AWS Blog:
Using Packages and Native nodejs Modules in AWS Lambda