Skip to content

S3 - S3Cmd

Configs

Example of config:

# s3cmd.conf
[default]
access_key = $ACCESS_KEY
secret_key = $SECRET_KEY
host_base = s3.m2ko.net
host_bucket = %(bucket)s.s3.m2ko.net

Usage example:

export ACCESS_KEY=XXXXXX
export SECRET_KEY=xxXXXXxxxXXXxxxxx s3cmd -c s3cmd.conf ls s3://my-bucket

Commands

List object:

s3cmd ls s3://{bucket}/{file|path}
s3cmd ls -H s3://{bucket}/{file|path} # Human readable size

Sum of objects:

s3cmd du s3://{bucket}/{file|path}
s3cmd du -H s3://{bucket}/{file|path} # Human readable size

Put object:

s3cmd put {local-file} s3://{bucket}/{file}

Put object:

s3cmd put {file} s3://{bucket}/{file}

Modify ACL (Grant access to a user):

s3cmd setacl --acl-grant=all:{user} s3://{bucket}

Delete object:

s3cmd del|rm {file} s3://{bucket}/{file}
s3cmd del|rm -r {file} s3://{bucket}/{file} # Recursive
Back to top