Amazon web services 无法执行AWS管道错误:";调用PutObject操作时发生错误(AccessDenied):访问被拒绝";
一直在尝试按照以下教程设置AWS管道: 但管道持续失败,错误日志如下: 以下是我已经尝试过的一些操作:Amazon web services 无法执行AWS管道错误:";调用PutObject操作时发生错误(AccessDenied):访问被拒绝";,amazon-web-services,amazon-s3,amazon-cloudformation,aws-codepipeline,aws-codebuild,Amazon Web Services,Amazon S3,Amazon Cloudformation,Aws Codepipeline,Aws Codebuild,一直在尝试按照以下教程设置AWS管道: 但管道持续失败,错误日志如下: 以下是我已经尝试过的一些操作: 授予S3对与云形成和代码管道服务角色相关的“cfn lambda管道”角色的完全访问权限 允许对S3存储桶的公共ACL访问 下面是我的buildspec.yml version: 0.2 phases: install: runtime-versions: nodejs: 12 build: commands: - npm insta
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
build:
commands:
- npm install
- export BUCKET=xx-test
- aws cloudformation package --template-file template.yaml --s3-bucket $BUCKET --output-template-file outputtemplate.yml
artifacts:
type: zip
files:
- template.yml
- outputtemplate.yml
下面是我的模板.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
helloWorld
DZ Bank API Gateway connectivity helloWorld
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./
Handler: app.lambdaHandler
Runtime: nodejs12.x
Events:
HelloWorld:
Type: Api
Properties:
Path: /hello
Method: get
与云形成和代码管道服务角色相关联的“cfn lambda管道”角色
S3权限应该与CodeBuild(CB)相关联,因为CB将运行buildspec.yml
。因此,CB需要能够访问S3
根据本节中链接的教程,应将
AmazonS3FullAccess
添加到codebuild lamba管道构建服务角色
中,而不是添加到cfn lambda管道
或CodePipeline的角色中。错误实际上与codebuild而不是CodePipeline有关。CodeBuild似乎对其附加的服务角色没有有效的权限
通过执行以下操作,可以在控制台中找到附加的服务角色:
- 转到代码构建控制台
- 从左侧菜单中单击“构建项目”
- 单击您正在使用的构建项目旁边的单选按钮,然后在顶部菜单上单击“编辑”,然后选择“编辑源”选项
- 页面底部将有一个标题为“服务角色权限”的部分,下面有Arn
AWS在文档中提供了完整的政策。谢谢Marcin,是的,这是一个问题。