英文:
Unable to upload file from Elastic Beanstalk to s3 due to access denied
问题
这是我的存储桶策略:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::spmgr/*"
},
{
"Sid": "AllowEBSService",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::823510892997:role/service-role/aws-elasticbeanstalk-service-role"
},
"Action": "*",
"Resource": [
"arn:aws:s3:::spmgr",
"arn:aws:s3:::spmgr/*"
]
}
]
}
尝试从我的弹性Beanstalk工作实例上传文件时,我收到了拒绝访问的错误。 (请注意,相同的代码在我的本地开发机器上能够成功上传文件)所以我该如何修复它?
英文:
Here is my bucket policy:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::spmgr/*"
},
{
"Sid": "AllowEBSService",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::823510892997:role/service-role/aws-elasticbeanstalk-service-role"
},
"Action": "*",
"Resource": [
"arn:aws:s3:::spmgr",
"arn:aws:s3:::spmgr/*"
]
}
]
}
On attempting to upload file from my elastic beanstalk worker instance, I get Access denied error.
(Though note that the same code on my local dev machine is able to successfully upload the file)
So how do I fix it?
答案1
得分: 2
aws-elasticbeanstalk-service-role
是为 Elastic Beanstalk 服务本身而设。对于您的应用程序,您必须提供与您的 Elastic Beanstalk 实例配置文件 关联的角色。您需要检查您的 Elastic Beanstalk 实例正在使用哪个角色。
英文:
aws-elasticbeanstalk-service-role
is for EB service itself. For your application you have to provide role associated with your Elastic Beanstalk instance profile. You have to check what role your EB instances is
using.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论