S3cmd is a command-line tool for uploading, retrieving, and managing data in cloud storage service providers that use the S3 protocol such as DreamObjects. It is ideal for scripts, automated backups triggered from cron, and so on.
The following instructions help you install and configure s3cmd to work with DreamObjects.
Since S3cmd is no longer being actively developed, a newer and faster command line option you may want to try instead is AWS CLI.
These instructions were performed with s3cmd v2.0.2. If you’d like to install a different version, you’ll need to modify the file names appropriately.
Log in to your server via SSH.
Create a bin directory in your user's home directory if you don’t have one already:
[server]$ mkdir ~/bin
Download the latest release of s3cmd from GitHub:
[server]$ curl -O -L https://github.com/s3tools/s3cmd/releases/download/v2.0.2/s3cmd-2.0.2.tar.gz
Decompress the file:
[server]$ tar xzf s3cmd-2.0.2.tar.gz
- You should now have a directory called s3cmd-2.0.2. Change into that directory:
[server]$ cd s3cmd-2.0.2
Copy the s3cmd executable and S3 folder into the bin directory created earlier:
[server]$ cp -R s3cmd S3 ~/bin
Add the bin directory to your .bash_profile so you can execute the newly installed script:
This assumes you’re using the default bash shell. If you’re using a different shell, you must set the path in the proper place.
Execute your bash profile for it to take effect:
[server]$ . ~/.bash_profile
Instead of following the instructions on the s3cmd site to configure it, just do the following:
- Create a file in your user's home directory called .s3cfg (note the leading "dot"):
[server]$ cd ~ [server]$ touch .s3cfg
- Copy the content of the code block below into it:
[default] access_key = Your_DreamObjects_Access_Key secret_key = Your_DreamObjects_Secret_Key host_base = objects-us-east-1.dream.io host_bucket = %(bucket)s.objects-us-east-1.dream.io enable_multipart = True multipart_chunk_size_mb = 15 use_https = True
- Include your Access and Secret Key from the DreamObjects control panel.
View the following link for a full list of options you can use in your config file:
Working with multiple accounts
It’s possible to use different configuration files, one for each account on DreamObjects. By default s3cmd puts its configuration file in ~/.s3cfg, but you can override a configuration file with the -c option and specify a different configuration file.
[server]$ s3cmd -c .s3cfg-another-identity ls
For convenience, you can use aliases in the ~/.bash_profile file:
# s3cmd aliases for different s3 accounts alias s3my='s3cmd -c ~/.s3cfg-main-identity' alias s3alt='s3cmd -c ~/.s3cfg-another-identity'