授予EC2 IAM角色对S3存储桶的读取权限
我有一个AWS Elastic Beanstalk Rails应用程序,正在通过配置脚本进行配置,以从S3存储桶中提取一些文件。启动应用程序时,我在日志中始终收到以下错误(出于安全性考虑,存储桶名称已更改): Failed to retrieve https://s3.amazonaws.com/my.bucket/bootstrap.sh: HTTP Error 403 : <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message> 配置文件: packages: yum: git: [] files: /opt/elasticbeanstalk/hooks/appdeploy/pre/01a_bootstrap.sh: mode: "00755" owner: root group: root source: https://s3.amazonaws.com/my.bucket/bootstrap.sh 设置了具有aws-elasticbeanstalk-ec2-roleIAM角色作为实例角色的Elastic Beanstalk环境。该角色具有以下策略: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:Get*", "s3:List*" ], "Resource": "arn:aws:s3:::my.bucket/*" } …