Deploy a Deployment Package

Lambda functions sometimes have dependencies outside aws-sdk. To satisfy these dependencies (ie include code that a lambda function can access), AWS provides a way of uploading a deployment package (a bundle of the lambda function and the directories) to AWS Lambda (https://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html).

For example, my lambda function A depends on code in directories dirB and dirC. When I use the serverless framework, is there a way for me to specify that A needs dirB and dirC.

My thought is to upload dirB and dirC to S3 containers and then specify these S3 containers as resources for A.

Is this a valid approach? Even if it is, is there something less complicated?

Generally speaking Serverless will package everything for you. If you’re having a problem can you provide an example?