我一直在尝试按照以下说明将存储桶内容从 S3 复制到另一个存储桶:
http://blog.vizuri.com/how-to-copy/move-objects-from-one-s3-bucket-to-another-between-aws-accounts
我有一个目标存储桶(我想在其中复制内容)和一个源存储桶。
在目标端,我使用以下用户策略创建了一个新用户:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect":"Allow",
"Action":[
"s3:ListAllMyBuckets"
],
"Resource":"arn:aws:s3:::*"
},
{
"Effect":"Allow",
"Action":[
"s3:GetObject"
],
"Resource":[
"arn:aws:s3:::to-destination/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::to-destination"
]
}
]
}
并创建了目标存储桶。
在源端,我对存储桶有以下策略:
{
"Version": "2008-10-17",
"Id": "Policy****",
"Statement": [
{
"Sid": "Stmt****",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "*****"
}
]
}
当我尝试使用 aws cli 将源的内容复制到目标时:
aws s3 sync s3://source-bucket-name s3://destination-bucket-name
我总是收到这个错误
An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
Completed 1 part(s) with ... file(s) remaining
我究竟做错了什么 ?我的政策起草方式有问题吗?
更新
我还尝试关注这篇建议更新源存储桶策略和目标存储桶策略的帖子:
但我仍然在命令行上遇到同样的错误