Command line
Interact with CUDO Compute's object storage using s3cmd & s5cmd
When working with S3-compatible object storage, two popular command-line tools are s3cmd and s5cmd. Both tools allow you to interact with object storage services, but they have different strengths:
- s3cmd: A versatile and widely-used tool for managing S3-compatible storage. It supports a wide range of operations and is known for its comprehensive feature set.
- s5cmd: A newer tool designed for high-performance and parallel operations. It excels in speed and efficiency, especially when dealing with large datasets.
s3cmd
Installation
s3cmd can be installed using various package managers or directly from its source. Here, we'll cover installation using pip, the Python package manager.
Install s3cmd using pip:
pip install s3cmd
Configure s3cmd
s3cmd needs to be configured to point to Cudo's object storage and have a copy of your object storage credentials. To complete this step you must have created a bucket and an object storage user on Cudo computes web console. Follow See this tutorial if you haven't done that already.
Find your access key and secret key
- Project > Object storage > Users > Click your object storage username
Find the Cudo S3 endpoint
- Project > Object storage > Buckets > Click your bucket name
Method 1: interactive
s3cmd --configure
Follow the prompts to enter your access key, secret key, and endpoint URL.
Access Key
: Enter the Access key for your user; found on the web console; looks like: 1F60EEH43228DYC12V5QSecret Key
: Enter the Secret key for your user; found on the web console; looks like: 1F60EEH43228DYC12V5QDefault Region [US]
: Press enter to ignoreS3 Endpoint [s3.amazonaws.com]
: Use the value from the web console, on your bucket page, but remove thehttps://
like this:s3.gb-bournemouth-1.storage.cudo.org
DNS-style ... [%(bucket)s.s3.amazonaws.com]
: Press enter to ignoreEncryption password
: Press enter to ignorePath to GPG program [/usr/bin/gpg]
: Press enter to ignoreUse HTTPS protocol [Yes]
: Press enter to ignoreHTTP Proxy server name
: Press enter to ignoreTest access with supplied credentials? [Y/n]
: Press YSave settings? [y/N]
: Press y
Your configuration is saved to ~/.s3cfg
; run the following to see it:
cat ~/.s3cfg
Let's check your buckets by listing them, run this command:
s3cmd ls
Using s3cmd
Listing Buckets and Files
To list all buckets in your storage:
s3cmd ls
To list files in a specific bucket:
s3cmd ls s3://your-bucket-name
Uploading Files
To upload a file from your local PC to a bucket:
s3cmd put local-file.txt s3://your-bucket-name/
Removing Files
To remove a file from a bucket:
s3cmd del s3://your-bucket-name/file-to-remove.txt
More information about using s3cmd and transferring files betwene clouds can be found here