我正在尝试将S3存储桶对象从一个AWS复制到另一个AWS账户。我遵循了此链接here,该链接可用于一个帐户A,但当我将其与另一个帐户B一起使用时却出现访问被拒绝的错误。这可能是什么原因?它是否与某些防火墙或安全性问题相关,甚至源帐户B存储桶也已公开。 这是应用于源存储区B的策略
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DelegateS3Access",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::12345678910:user/abc"
},
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::sourceBucketB/*",
"arn:aws:s3:::sourceBucketB"
]
}
]
}
这是应用于目标帐户的政策
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::sourcebucket",
"arn:aws:s3:::sourcebucket/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::destinationbucket",
"arn:aws:s3:::destinationbucket/*"
]
}
] }
我正在使用以下命令从存储区B复制到目标帐户(使用目标帐户配置文件)
aws s3 sync s3:// sourceBucket s3:// destinationBucket
这是错误
严重错误:调用时发生错误(AccessDenied) ListObjectsV2操作:访问被拒绝
答案 0 :(得分:0)
答案 1 :(得分:-1)
简单方法(全部授予):
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "s3:*",
"Effect": "Allow",
"Resource": "*",
"Principal": "*"
}
]
}
这似乎也不必要,并且可能会使事情复杂化(在您的第二条政策中):
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::sourcebucket",
"arn:aws:s3:::sourcebucket/*"
]
},