Running S3cmd commands

DreamObjects cluster migration

DreamHost is currently in the process of migrating all DreamObjects accounts to a new hardware platform.

Please review this article to identify the cluster your DreamObjects account currently resides on and the features it supports.

Overview

This article lists several commands you can use to manage your DreamObjects data. This article assumes you've already installed S3cmd:

If you're using a custom version of Python

The commands below work with the server version of Python. However, you may have installed a custom version of Python using the following article:

If so, you may see the following error when running the commands below.

ImportError trying to import dateutil.parser.
Please install the python dateutil module:
$ sudo apt-get install python-dateutil
  or
$ sudo yum install python-dateutil
  or
$ pip install python-dateutil
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If so, you must create a virtual environment to install the python-dateutil package. You will then be able to use the commands below without error.

Make sure to log out of your SSH session and back in to ensure the new settings are active.

Creating

Making a bucket

[server]$ s3cmd mb s3://my-new-bucket
Bucket 's3://my-new-bucket/' created

Listing

Listing all buckets

[server]$ s3cmd ls
2024-03-29 16:28  s3://my-bucket

Listing the contents of a bucket

[server]$ s3cmd ls s3://my-bucket
DIR s3://my-bucket/backups/
2024-03-29 18:09 11 s3://my-bucket/file1.txt

Listing the size of a bucket

[server]$ s3cmd du -H s3://my-bucket
40G      s3://my-bucket

Uploading

Uploading a file into a bucket

[server]$ s3cmd put testfile.txt s3://my-bucket
file.txt -> s3://my-bucket/file.txt  [1 of 1]
127 of 127   100% in    0s  1522.87 B/s  done

Downloading

Downloading a file from a bucket

[server]$ s3cmd get s3://my-bucket/file.txt
s3://my-bucket/file.txt -> ./file.txt  [1 of 1]
127 of 127   100% in    0s     3.46 kB/s  done

Deleting

Deleting a file in a bucket

[server]$ s3cmd del s3://my-bucket/file.txt
File s3://my-bucket/file.txt deleted

Deleting all Objects in a bucket

This will remove all Objects and empty the bucket.

[server]$ s3cmd del --recursive s3://my-bucket --force

Permissions

Recursively making every object in a bucket public

[server]$ s3cmd setacl s3://my-bucket --acl-public --recursive

Recursively making every object in a bucket private

[server]$ s3cmd setacl s3://my-bucket --acl-private --recursive

Directory Listing

Directory listing controls what data can be seen by visiting the top level of your bucket. If it's set to private, no data is shown. If it's public, the contents of the bucket are listed as shown below.

Disabling Directory Listing in a bucket

[server]$ s3cmd setacl s3://my-bucket --acl-private

If you visit your bucket in a browser, only the following information will display.

Enabling Directory Listing in a bucket

[server]$ s3cmd setacl s3://my-bucket --acl-public
If you visit your bucket in a browser, the contents of the bucket display.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?