如何使用AWS SAM CLI动态创建S3存储桶的部署。

huangapple go评论68阅读模式
英文:

How to dynamically create Deployment s3 bucket using AWS SAM CLI

问题

当我运行sam deploy时,默认情况下它会创建一个部署S3存储桶来保存构建的构件。您可以在终端上的上述命令输出中看到它:

管理的S3存储桶:aws-sam-cli-managed-default-samclisourcebucket-1a4x26zbcdkqr
可以通过在samconfig.toml中设置不同的默认S3存储桶,并通过设置resolve_s3=False来关闭自动解析存储桶。

但我不知道如何覆盖这个行为,也就是通过samconfig.toml配置SAM CLI,并告诉它在不存在时创建一个具有指定名称的S3存储桶。我正在使用SAM CLI,版本1.81.0

英文:

When I'm running sam deploy, by default it creates a deployment s3 bucket to save the built artifacts. you see it in the output of the command above in your terminal as:

> Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-1a4x26zbcdkqr
A different default S3 bucket can be set in samconfig.toml and auto resolution of buckets turned off by setting resolve_s3=False

but I don't know how to override this behavior. meaning that configuring SAM CLI via samconfig.toml and tell it that creates a s3 bucket with provided name when it doesn't exist.
Im using SAM CLI, version 1.81.0

答案1

得分: 1

你可以尝试执行以下命令:

sam deploy --s3-bucket "YOUR S3 BUCKET"

更多信息请查看这里:https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html

英文:

You can try

sam deploy --s3-bucket "YOUR S3 BUCKET" 

More information here: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html

huangapple
  • 本文由 发表于 2023年5月24日 19:55:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76323247.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定