我的文件.ebextensions夹中有一个简单的文件:
00-myconfig.config
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Access:
type: S3
roleName: aws-elasticbeanstalk-ec2-role
buckets: my-bucket
files:
"/tmp/ca-bundle.zip":
mode: "000755"
owner: root
group: root
source: https://s3-ap-southeast-2.amazonaws.com/my-bucket/ca/ca-bundle.zip
authentication: S3Access
Run Code Online (Sandbox Code Playgroud)
根据多个答案,这是授予aws-elasticbeanstalk-ec2-role角色S3 存储桶访问权限的方法。
但我继续收到 403 错误 /var/log/eb-activity.log
[2015-08-26T01:27:03.544Z] INFO [22320] - [Application update/AppDeployStage0/EbExtensionPreBuild/Infra-EmbeddedPreBuild] : Activity execution failed, because: Failed to retrieve https://s3-ap-southeast-2.amazonaws.com/my-bucket/ca/ca-bundle.zip: HTTP Error 403 : <?xml version="1.0" encoding="UTF-8"?> (ElasticBeanstalk::ExternalInvocationError)
Run Code Online (Sandbox Code Playgroud)
如果我手动向aws-elasticbeanstalk-ec2-role角色添加 S3 访问策略,一切正常,所以我知道我在 URLS 或其他任何内容中没有拼写错误,EC2 实例肯定处于正确的角色。
怎么了?
附注。我尝试了files带有或不带有“身份验证”设置的部分。
configuration amazon-s3 amazon-ec2 amazon-web-services elastic-beanstalk