Question

Unable to Sync to S3 with s3cmd

After setting up s3cmd and my S3 bucket, when I try this command

sudo s3cmd sync --recursive --preserve /srv s3://MyS3Bucket

I get this error:

ERROR: S3 error: 400 (InvalidRequest): The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

My s3cmd version is 1.0.0 which is installed by default after following their “deb” installation guide for by Ubuntu 12.04

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I’m running it through ROOT only.

Anyting other than this that you feel could be affecting the script usage?

Another issue now is setting up cron to automate the backup script.

While the commands are working with s3cmd tool when run one by one directly from command line, however when I created a .sh script, and trying to run through cron, the script runs fine but shows below error:

ERROR: S3 error: 400 (InvalidRequest): The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

My .sh file is as follows:

#!/bin/sh
echo 'Started'
date +'%a %b %e %H:%M:$S %Z %Y'
s3cmd sync --recursive --preserve /srv s3://MyBucket
s3cmd sync --recursive --preserve /etc s3://MyBucket
s3cmd sync --recursive --preserve /home s3://MyBucket
s3cmd sync --recursive --preserve /var s3://MyBucket
dpkg --get-selections >> dpkg.list 2>&1
s3cmd sync --recursive --preserve dpkg.list s3://MyBucket
date +'%a %b %e %H:%M:$S %Z %Y'
echo 'Finished'

Any suggestions for this?