I use DreamObjects a lot: as low-cost online storage, as a CDN for large files (especially podcasts and image files), as a CDN for files I want to have access to from a lot of different locations, and as a place to store WordPress backups (using Ipstenu’s fantastic DreamObjects Backups plugin). The price is great and the service is generally excellent.
Unfortunately, the DreamObjects web interface, while good, leaves something to be desired if you want to upload a lot of files, because the default access control is private. If you want to make them all publicly accessible, you need to go through and change that setting on every single file. This is not terrible if you just uploaded a dozen files; it’s entirely too much work if you just uploaded a few hundred files.
The solution is to use a third party app to interact with DreamObjects. When I was on Windows 7, I used CrossFTP, which worked beautifully. However, for reasons I can’t quite understand, I can’t get it to work on Ubuntu 16.04 LTS. Time to look for a command line solution.
S3cmd is a command line interface for working with cloud storage service providers that use the S3, such as DreamObjects. Unfortunately, the instructions DreamHost provides assume that you are also using DreamHost for hosting, which I am not. However, it’s incredibly easy to setup on Ubuntu. First, open a terminal session.
apt-get to install S3cmd:
$ sudo apt-get install s3cmd
After than, navigate to your
homedirectory and create a configuration file:
$ touch .s3cfg $ nano .s3cfg
If you use a different text editor, that’s fine. No need for editor wars. Paste this bit of code into your config file:
[default] access_key = Your_DreamObjects_Access_Key secret_key = Your_DreamObjects_Secret_Key host_base = objects-us-west-1.dream.io host_bucket = %(bucket)s.objects-us-west-1.dream.io enable_multipart = True multipart_chunk_size_mb = 15 use_https = True sig_version = 2
You’ll need to login in to the web interface to get your access key and secret key. After that, you’re all set.
List all your buckets:
$ s3cmd ls
Make a bucket:
$ s3cmd mb s3://test-bucket
(Keep in mind that you must keep bucket names unique across all of DreamObjects, not just your own buckets, as these names are used to create public URLs.)
Upload a file into your bucket:
$ s3cmd put testfile.txt s3://test-bucket
Of course, you can use wild cards, so if you have a lot of pdf files you want to upload all at once, add them to a new directory, navigate to that directory, and add them from there:
$ s3cmd put *.pdf s3://test-bucket
You can make all those files in that bucket publicly accessible by using this command:
$ s3cmd setacl s3://test-bucket --acl-public --recursive
Of course, you can also make those files publicly accessible when you upload them by using the
$ s3cmd put *.pdf s3://test-bucket -P
If you change your mind about one of them, you can go back and change permissions on that single file to private using the
s3cmd setacl s3://test-bucket/test-file.txt --acl-private
And if you change your name and want to make it public again, just use:
s3cmd setacl s3://test-bucket/test-file.txt --acl-public
I generally find it convenient to organize my DreamObjects buckets into folders. With S3 architecture, however, folders aren’t really an entity unto themselves—they’re really just part of the object’s path. So you don’t really create a new folder ahead of time and add your items to it; you just create the folder when you upload the item as part of its path:
$ s3cmd put testfile.txt s3://test-bucket/folder-name/
Once you’ve done that once, you can add other files to the same folder using the same command.
Of course, the best bit of help you are likely to get is by typing:
$ s3cmd -h
Or if you want to save it to a text file you can browse more easily:
$ s3cmd -h -> s3cmd.txt
Downloads:You can download a handy cheat sheet/reference card I made here.
Update Information:August, 2017: I made a few formatting changes, so the latest version is 1.0.1
Questions or comments? Please feel free to comment below.