amazon-web-services - AWS CodePipeline CodeBuild SAM Lambda
问题描述
我有一个来自 CodeCommit 的用于 Lambda (NodeJS) Auto Deploy 的管道。
我的buildspec.yml
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
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 命令。
但是,构建日志中出现以下错误
[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
解决方案
推荐阅读
- ubuntu - 无法全局安装电子
- r - 具有 dplyr 的自定义函数在一个因子内针对不同级别进行变异或汇总?
- ios - 选择 DatePicker 后更新单元格中的日期(时间)
- java - 片段中的回收站视图为空
- c++ - 为什么 const char* const & = "hello" 可以编译?
- c# - 在c#中返回元组字典作为函数的返回类型
- angular - 如何正确实施“photo.service”?
- javascript - 锚标签-在 iphone7/6s plus 中没有在 mousedown 上获取日志
- cordova - 如何在ionic 2中使用couchbase-lite cordova插件实现同步功能?
- python - 防止 requests-mock 降低我的帖子数据的大小写