Error uploading small files to s3 using s3cmd?

2020-04-26 04:49发布

问题:

I am having an unusual error: my files appear to be too small to be uploaded to s3!

I have a small log file which is not uploading:

s3cmd put log.txt s3://MY-BUCKET/MY-SUB-BUCKET/
ERROR: S3 error: Access Denied

But when I do this:

yes | head -n 10000000 >> log.txt
s3cmd put log.txt s3://MY-BUCKET/MY-SUB-BUCKET/
# this works for some reason.

The magic number appears to be 15MB, the point at which s3cmd starts doing multipart uploads.

回答1:

I was running into this same issue and apparently the following policy needs to be explicitly added to the IAM users policy. For some odd reason this needs to be set for small files but not large files.

"s3:GetBucketLocation"

Wow, that just took 3 hours of my life to figure out.