HostOnNet Blog

Uploading files to Amazon s3 with s3cmd

s3cmd allows you to upload files and folders to Amazon S3 or sites that support Amazon S3 API for example

Installing s3cmd

You can download latest version of s3cmd from

To install version 2.0.0 (latest at the time of writing this post), run

cd /usr/local/src
tar xf s3cmd-2.0.0.tar.gz 
cd s3cmd-2.0.0
python install

s3cmd is python 2 program, won’t work with python 3.

Syncing all files on local folder to Amazon s3

To sync all files in local folder to amazon s3 bucket, run

s3cmd sync -v /path/to/local/folder/ s3://bucket-name/

s3cmd sync work like rsync.

Setting Permission for all files in a bucket

To make all files in a bucket public, run

s3cmd setacl --acl-public --recursive -v s3://bucket-name/

To make all files in a bucket private

s3cmd setacl --acl-private --recursive -v s3://bucket-name/

List All files in a s3 bucket

s3cmd ls -r s3://bucket-name/

If you only want file names, then use awk

s3cmd ls -r s3://bucket-name/ | awk '{print $4}'

Posted in Cloud