一次部署多个AWS Netcore Lambda函数 [英] Deploy at once multiple aws netcore lambda functions

查看:192
本文介绍了一次部署多个AWS Netcore Lambda函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有使用Serverless Framework或AWS CloudFormation模板的解决方案来发布多个lambda,这些lambda分别位于单个视觉工作室.proj和单个视觉工作室.sln

Is there any solution with Serverless Framework or with AWS CloudFormation template to publish multiple lambda that are located each in an individual visual studio .proj and in an individual visual studio .sln

我可以找到包含同一类或项目中的lambda函数的任何示例。

Any example I can find contains lambda function in the same class or proj.

推荐答案

我前一段时间对此进行了调查。根据我的记忆,我认为您可以使用以下两种方法之一使用同一CloudFormation模板部署多个lambda函数。

I looked into this a while back. From what I remember I think you can deploy multiple lambda functions using the same CloudFormation template in one of two ways.


  1. 为每个函数手动创建单独的zip程序包,将其加载到S3中,然后在CloudFormation模板中为每个Lambda函数显式引用该程序包

  2. 将所有已发布项目中的文件合并到同一文件夹中(CloudFormation模板也必须位于同一文件夹中),然后使用 aws cloudformation package命令创建zip文件。 ,将其加载到S3,然后使用包的S3路径更新模板。由于Lambda调用方法的原因,我不确定每个项目是否可以嵌套文件夹。

#1的问题在于,它需要更多的人工处理,或者需要完成更多的脚本编写。

The issue with #1 is that it's a lot more of a manual process, or a lot more scripting that has to be done.

#2的问题在于每个创建的Lambda函数将包含该软件包中所有函数的文件,即使您仅访问一个Function处理程序也是如此。另外,如果在不同的项目中使用同一程序集的不同版本,则可能发生文件冲突。 Lambda函数可以加载的软件包大小也有限制(压缩后为50MB,未压缩时为250MB),这对于某些人来说也可能是一个因素。

The issue with #2 is that each Lambda function that's created will contain the files for all functions that are part of that package, even though you're only accessing one Function handler. Also, file conflicts are possible if different versions of the same assembly are used in different projects. There's also a limit on the package size that can be loaded for Lambda functions (50MB compressed, 250MB uncompressed) so that may also be a factor for some people.

这些增加的复杂性和潜在问题,我们刚刚决定使用单独的CloudFormation模板&每个Lambda函数的堆栈。

Due to these added complexities & potential issues we just decided to have a separate CloudFormation template & stack for each Lambda function.

Lambda限制-请参阅 AWS Lambda部署限制

这篇关于一次部署多个AWS Netcore Lambda函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆