首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AWS CodePipeline CodeBuild SAMλ

AWS CodePipeline CodeBuild SAMλ
EN

Stack Overflow用户
提问于 2019-01-03 21:39:03
回答 1查看 2K关注 0票数 5

我有一个来自CodeCommit的Lambda (NodeJS)自动部署的PipeLine。

我的buildspec.yml

代码语言:javascript
复制
version: 0.1
phases:
 install:
  commands:
    - npm install
    - aws cloudformation package --template-file samTemplate.yaml --s3-bucket codepipeline-551 --output-template-file outputSamTemplate.yaml
artifacts:
  type: zip
  files:
    - samTemplate.yaml
    - outputSamTemplate.yaml

我的samTemplate.yaml

代码语言:javascript
复制
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Serverless Specification template describing your function.
Resources:
  KashIoTLambda:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: lambda.handler
      Runtime: nodejs8.10
      CodeUri: ./
      Description: ''
      MemorySize: 128
      Timeout: 3
      Role: 'arn:aws:iam::1234:role/abc-backend'
      Events:
        Api1:
          Type: Api
          Properties:
            Path: '/{proxy+}'
            Method: OPTIONS
        Api2:
          Type: Api
          Properties:
            Path: /MyResource
            Method: ANY
      Environment:
        Variables:
          REGION: ap-south-1

CodeBuild提到的角色附加的策略允许访问所有资源&所有S3命令。

但是,我在构建日志中发现了以下错误

代码语言:javascript
复制
[Container] 2019/01/03 13:25:39 Running command npm install
added 122 packages in 3.498s
 [Container] 2019/01/03 13:25:44 Running command aws cloudformation package --template-file samTemplate.yaml --s3-bucket codepipeline-551 --output-template-file outputSamTemplate.yaml
 Unable to upload artifact ./ referenced by CodeUri parameter of ABCLambda resource.
An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
 [Container] 2019/01/03 13:25:46 Command did not exit successfully aws cloudformation package --template-file samTemplate.yaml --s3-bucket codepipeline-551 --output-template-file outputSamTemplate.yaml exit status 255
[Container] 2019/01/03 13:25:46 Phase complete: INSTALL Success: false
[Container] 2019/01/03 13:25:46 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: aws cloudformation package --template-file samTemplate.yaml --s3-bucket codepipeline-551 --output-template-file outputSamTemplate.yaml. Reason: exit status 255
EN

回答 1

Stack Overflow用户

发布于 2019-06-11 18:55:18

检查存储桶本身的策略/权限。

如果您和我一样,那么在第一次设置管道设置时,您可能已经选择了default location选项作为管道设置中的工件存储。在这种情况下,S3存储桶本身可能存在阻止访问的策略。

对我来说,一旦我删除了存储桶策略,unable to upload artifact错误就解决了,我的构建过程继续成功完成。

我希望这对你有帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54023429

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档