【问题标题】:CloudFormation change set chokes on empty CodeUri: in SAM templatesCloudFormation 更改集阻塞空 CodeUri:在 SAM 模板中
【发布时间】:2020-05-02 18:07:10
【问题描述】:

如果这是无效的 CloudFormation 模板,那么应该有人告诉写这篇博文的工程师:Managing Lambda@Edge and CloudFront deployments by using a CI/CD pipeline | Networking & Content Delivery

我正在使用该模板成功部署。

但我想使用变更集进行更安全的部署。

当我尝试创建更改集时,CloudFormation 告诉我缺少 CodeUri:

转换 AWS::Serverless-2016-10-31 失败,原因是:无服务器应用程序规范文档无效。发现的错误数:1. id 为 [LambdaEdgeFunctionSample] 的资源无效。必须设置“InlineCode”或“CodeUri”

此模板部署没有问题。

此外,我认为我不能为此使用 sam 命令 (A simpler deployment experience with AWS SAM CLI | AWS Compute Blog),因为 lambda 函数只是此 CloudFormation 模板的一小部分。

当尝试不同的 CodeURI 时,我可以看到它需要一个 s3 URL: Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. 'CodeUri' is not a valid S3 Uri of the form \"s3://bucket/key\" with optional versionId query parameter.

【问题讨论】:

    标签: amazon-web-services aws-lambda amazon-cloudformation aws-sam


    【解决方案1】:

    对于第一篇文章中的模板,如果删除“CodeUri:”行,模板应该会成功部署。它似乎在抱怨,因为该行是空的。

    如果您正在寻找一个简单的模板来启动一个 sam 项目,请查看这个https://github.com/healthbridgeltd/nodejs-sam-bootstrap

    它有一个包含多个目标的 make 文件,让您的生活更轻松。

    【讨论】:

      猜你喜欢
      • 2021-10-20
      • 2018-10-12
      • 1970-01-01
      • 2021-07-01
      • 2012-01-14
      • 1970-01-01
      • 1970-01-01
      • 2018-11-25
      • 1970-01-01
      相关资源
      最近更新 更多