vendredi 7 août 2015

Can't use sync to move objects in a folder to another folder within the same bucket using s3cmd

I have been trying to move all the objects in a folder bucketA/product/pic/ up one level within the same bucket bucketA/pic/

I can sync files between local host and the s3 server with

s3cmd sync /script/ s3://bucketA/ 

as well as put an object:

s3cmd put zip.sh s3://bucketA/

But I'm getting Access Denied error when syncing files within the same bucket:

[root]s3cmd sync s3://bucketA/product/pic s3://bucketA/pic/

WARNING: Empty object name on S3 found, ignoring.
Summary: 441 source files to copy, 0 files at destination to delete
ERROR: S3 error: Access Denied

Is it possible to change the locations of the objects in a folder within the same bucket?

Here's my IAM policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt123456",
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Sid": "Stmt123457",
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:GetBucketLocation"
            ],
            "Resource": [
                "arn:aws:s3:::bucketA",
                "arn:aws:s3:::bucketA/*"
            ]
        }
    ]
}

Here's my bucket policy which is set to prevent hotlinking:

{
    "Version": "2012-10-17",
    "Id": "HTTP referrer policy",
    "Statement": [
        {
            "Sid": "Allow in my domains",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucketA/*",
            "Condition": {
                "StringLike": {
                    "aws:Referer": [
                        "https://mylocalhostip/*",
                        "http://mylocalhostip/*"

                    ]
                }
            }
        },
        {
            "Sid": "Deny access if referer is not my sites",
            "Effect": "Deny",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucketA/*",
            "Condition": {
                "StringNotLike": {
                    "aws:Referer": [
                        "http://mylocalhostip/*",
                        "https://mylocalhostip/*"

                    ]
                }
            }
        }
    ]
}




Aucun commentaire:

Enregistrer un commentaire