CodePipeline无法找到SAM模板Yaml文件

Bro*_*oks 5 amazon-web-services aws-cloudformation aws-codepipeline

我正在尝试使用Cloudformation SAM堆栈设置AWS Codepipeline,该堆栈会部署到Lambda,并通过Pipeline控制台执行此操作。管道通过Codecommit流程和Codebuild的构建过程传递克隆,但是使用Cloudformation部署时失败。

我收到以下错误消息:

Action execution failed Invalid TemplatePath: MyAppBuild::samTemplate.yml

我一直在密切关注文档(http://docs.aws.amazon.com/lambda/latest/dg/automating-deployment.html),并且在代码管道设置表单(模板文件)的字段16中,将samTemplate.yml。

我的仓库的根目录(也是项目的根目录)中也有samTemplate.yml。

我已经将Codebuild输出工件名称与Cloudformation输入工件名称相匹配,并且它们完全匹配。

我在这里想念什么吗?如何获得Cloudformation部署过程来识别sam模板?

编辑1我已经切换到使用Codestar,而不是直接使用CodePipeline。我的buildspec.yml没什么特别的,但是如果有人感兴趣,它就在下面。

version: 0.2

phases:
  install:
    commands:
      - echo "install"
  pre_build:
    commands:
      - echo "pre_build"
  build:
    commands:
      - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.json
artifacts:
  type: zip
  files:
    - template-export.json
Run Code Online (Sandbox Code Playgroud)

对于任何刚接触CodeBuild的人来说,要记住的一件事是,生成的zip文件是生成操作的根目录,并且是传输到最终部署(在我的情况下为Lambda)的zip文件。

Tim*_*imB 3

我相信构建阶段的输出需要传递到 CloudFormation 操作中。

在本教程中,构建输出称为NewSamTemplate.yaml

所以尝试将您的 TemplatePath 更新为MyAppBuild::NewSamTemplate.yml