gpt4 book ai didi

aws-lambda - 为什么sam包每次都会上传工件?

转载 作者:行者123 更新时间:2023-12-03 07:26:11 25 4
gpt4 key购买 nike

当我运行 Sam 包时,它每次都会将我的 lambda 函数包上传到 s3,即使我重复运行它而不更改任何内容。我有一个管道,我可以看到它说“跳过上传”,因为相同的包已经存在,这就是我正在尝试复制的内容。有什么想法吗?

我针对具有多个 lambda 函数的本地 CodeUri 路径的模板运行了 sam 包。我反复运行了它。

我预计它第二次运行时会跳过工件上传,因为它们已经第一次上传并且文件系统是相同的。

最佳答案

SAM 文档指出:

The SAM package command creates and uploads artifacts based on thepackage type of a given resource. It uploads local images to ECR forImage package types. It creates zip of your code and dependenciesand uploads it to S3 for other package types. The command returns acopy of your template, replacing references to local artifacts withthe AWS location where the command uploaded the artifacts.

话虽这么说,每次运行该命令时,它都会检查更新并在需要时上传新工件。

像这样:

$ sam package -t template.yaml --resolve-s3

Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-1p0mvml741ygf
A different default S3 bucket can be set in samconfig.toml
Or by specifying --s3-bucket explicitly.
Uploading to 81ef6ef4d5aa0055f271fcfaeb7fab09 65210 / 65210 (100.00%)
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
File with same data already exists at 81ef6ef4d5aa0055f271fcfaeb7fab09, skipping upload
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
[...]

您不必担心这一点,如果没有任何更改,上传将被跳过。如果进行了更改,您将能够在输出模板中看到它们。

我已在终端上运行 sam package -h 文档文本。

关于aws-lambda - 为什么sam包每次都会上传工件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75669327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com