s3cmd fails too many times
This helped in my case:
- do
s3cmd ls
on the bucket - it printed a warning about a redirection
- replace the
bucket_host
in the.s3cfg
file with the one from the warning. - repeat
s3cmd ls
, it should no longer print a warning - reupload file
my .s3cfg now is:
host_bucket = %(bucket)s.s3-external-3.amazonaws.com
There are a few common problems that result in s3cmd returning the error you mention:
- A non-existent (e.g. mistyped bucket name; or a bucket that hasn't yet been provisioned)
- Trailing spaces on your authentication values (key/id)
- An inaccurate system clock. It is possible to use Wireshark (over an http - not https connection) to see how your system clock lines up with S3's clock - they should match within a few seconds. Consider using NTP to sync your clock if this is an issue.
Alternatives to s3cmd:
- s3cp - a Java based script that offers good functionality for transferring files to S3, and more verbose error messages than s3cmd
- aws - a Perl based script, written by Tim Kay, that provides easy access to most AWS (including S3) functions, and is quite popular.
If you wish to write your own script, you can use the Python Boto library which has functions for performing most AWS operations and has many examples available online. There is a project which exposes some of the boto functions on the command line - although, a very small set of functions are currently available.
I had the same problem with the Ubuntu s3cmd
command.
Downloading the latest stable version (1.0.1) solved it: http://sourceforge.net/projects/s3tools/files/s3cmd/