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

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

问题描述

是否有任何使用无服务器框架或 AWS CloudFormation 模板的解决方案来发布多个 分别位于单个 Visual Studio .proj 和单个 Visual Studio .sln 中的 lambda

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,然后在每个 Lambda 函数的 CloudFormation 模板中明确引用该包.
  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 函数都将包含属于该包的所有函数的文件,即使您只访问一个函数处理程序.此外,如果在不同项目中使用同一程序集的不同版本,则可能会发生文件冲突.可以为 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天全站免登陆