0

I am using linux s3cmd to upload files to AWS S3. I can upload a zip file successfully and this has been working for months now, no problems. I now need to also upload a json file. When I try to upload the json file to the same bucket, I get S3 error: Access Denied. I can't figure out why, please help.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::mybucket"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject",
                "s3:DeleteObject"
            ],
            "Resource": [
                "arn:aws:s3:::mybucket/*"
            ]
        }
    ]
}

s3cmd --mime-type=application/zip put myfile.zip s3://mybucket
SUCCESS

s3cmd --mime-type=application/json put myfile.json s3://mybucket
ERROR: S3 error: Access Denied
user3720435
  • 1,421
  • 1
  • 17
  • 27

3 Answers3

0

These days, it is recommended to use the AWS Command-Line Interface (CLI) rather than s3cmd.

The aws s3 cp command will try to automatically guess the mime type, so you might not need to specify it as in your example.

If your heart is set on figuring out why s3cmd doesn't work, try opening up permissions (eg allow s3:*) to see if this fixes things, then narrow-down the list of permitted API calls to figure out which one s3cmd is calling.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
0

Alternatively you can use Minio client aka mc Using mc cp command this can be done.

$ mc cp myfile.json s3alias/mybucket

Hope it helps.

Disclaimer: I work for Minio

koolhead17
  • 1,944
  • 1
  • 12
  • 20
0

It was a bug with s3cmd, simple update solved the problem.

user3720435
  • 1,421
  • 1
  • 17
  • 27