为什么sam包将工件发布到存储桶中? [英] Why sam package publishes the artifacts to bucket?

查看:72
本文介绍了为什么sam包将工件发布到存储桶中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为打包SAM应用程序的一部分,该应用程序发布到s3存储桶,如下所示:

As part of packaging the SAM application, the application published to s3 bucket as shown below:

sam软件包--template-file sam .yaml --s3-bucket mybucket-输出模板文件output.yaml

为什么 sam包提供-s3-bucket 选项?这是强制性选项吗?

Why sam package provides --s3-bucket option? Is this mandatory option?

将工件发布到s3存储桶的目的是什么?

What is the purpose of publishing artifacts to s3 bucket?

推荐答案

-s3-bucket 命令位于 sam程序包命令中。该命令的作用是获取本地代码,将其上载到S3,然后返回转换后的模板,在该模板中,本地代码的源位置已被S3存储桶URI(S3存储桶中的对象URI-压缩代码)替换。

--s3-bucket option in sam package command is mandatory. What the command does is that it takes your local code, uploads it to S3 and returns transformed template where source location of your local code has been replaced with the S3 bucket URI (URI of object - zipped code - in the S3 bucket).

将工件上传到S3的主要优点是,与在部署期间通过Internet发送相比,部署已经存在于AWS网络中的代码要更快。

Main advantage of uploading artifact to S3 is that it is faster to deploy code that already sits within AWS network than send it through the Internet during deployment.

另一件事是,普通的CloudFormation允许您内联Lambda函数代码而不将其推送到S3,但是这种方法有局限性。如果您的lambda函数在特定的运行时需要使用不是AWS提供的lambda环境一部分的外部库,或者函数的大小很大,那么您仍然需要将函数的代码及其依赖项压缩在一起,然后将其上传到S3,然后再继续。 SAM只是为您简化了这一过程,因此您不必手动执行此步骤。

Another thing is that plain CloudFormation let's you inline lambda function code without pushing it to S3 but there are limitations to this approach. If your lambda function needs to use external libraries that are not part of AWS provided lambda environment for a particular runtime or your function's size is big then you still need to zip your function's code together with its dependencies and upload it to S3 before continuing. SAM just makes this easier for you so that you don't have to do this step manually.

这篇关于为什么sam包将工件发布到存储桶中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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