简体   繁体   English

需要帮助来了解AWS Lambda上NodeJS的部署软件包

[英]Need help understanding deployment package for nodejs on AWS lambda

I have a codebase in typescript which runs fine and creates the required js files. 我在打字稿中有一个代码库,可以很好地运行并创建所需的js文件。 Next, my task is to create a deployment package out of it and deploy to AWS lambda. 接下来,我的任务是从中创建一个部署程序包并部署到AWS lambda。 When i see the number of packages under node_modules folder, it shows me 450+ packages. 当我看到node_modules文件夹下的软件包数量时,它显示了450多个软件包。 Whereas an already deployed lambda function for the same code base has just around 50 packages under the node_modules. 而针对同一代码库的已部署lambda函数在node_modules下仅包含大约50个软件包。

Can someone help me with how to create the deployment package, with just the required packages under the node_modules folder. 有人可以帮助我如何创建部署程序包,仅在node_modules文件夹下包含所需的程序包。

Please follow below steps to deploy lambda function with node_modules files 请按照以下步骤使用node_modules文件部署lambda函数

  1. List below files in under folder any specific name let say " app " 在文件夹下的任何特定名称下面列出文件,例如说“ app

    在此处输入图片说明

  2. Zip "app" folder with all files 压缩包含所有文件的“ app”文件夹

在此处输入图片说明

  1. Login into aws account and create new lambda function and upload using below settings. 登录到aws帐户并创建新的lambda函数,然后使用以下设置进行上传。 Make sure Handler name must be like this app/index.handler , where " app " is zip folder name if you used different name then use that name. 确保处理程序名称必须类似于此app / index.handler ,其中“ app ”是zip文件夹名称(如果您使用其他名称,则使用该名称)。 在此处输入图片说明

  2. Upload file and click on save button 上传文件,然后单击保存按钮

  3. Done Enjoy :) 完成享受:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM