如果这是无效的 CloudFormation 模板,那么有人应该告诉撰写此博客文章的工程师:Managing Lambda@Edge and CloudFront deployments by using a CI/CD pipeline | Networking & Content Delivery
我正在使用该模板成功部署。
但我想使用更改集来实现更安全的部署。
当我尝试创建更改集时,CloudFormation 告诉我 CodeUri 丢失:
Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [LambdaEdgeFunctionSample] is invalid. Either 'InlineCode' or 'CodeUri' must be set
此模板部署没有问题。
此外,我认为我不能为此使用 sam 命令 ( A simpler deployment experience with AWS SAM CLI | AWS Compute Blog ),因为 lambda 函数只是此 CloudFormation 模板的一小部分。
当尝试不同的 CodeURI 时,我可以看到它需要 s3 URL:
转换 AWS::Serverless-2016-10-31 失败,原因是:无服务器应用程序规范文档无效。发现的错误数: 1. ID 为 [MyFunction] 的资源无效。 “CodeUri”不是具有可选 versionId 查询参数的“s3://bucket/key”形式的有效 S3 Uri。
最佳答案
对于第一篇文章中的模板,如果删除“CodeUri:”行,模板应该会成功部署。它似乎在提示,因为该行是空的。
如果您正在寻找一个简单的模板来启动 sam 项目,请看看这个 https://github.com/healthbridgeltd/nodejs-sam-bootstrap
它有一个包含多个目标的 make 文件,让您的生活更轻松。
关于amazon-web-services - CloudFormation 更改设置对空 CodeUri : in SAM templates 造成阻塞,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59760475/