s3cmd
is a versatile command-line tool designed for managing S3-compatible storage, offering functionalities for uploading and downloading objects.
In order to use s3cmd to upload or download your Objects, you should have already followed the steps here to create your Buckets.
Install s3cmd:
On Ubuntu:
If you’re using Ubuntu, you can installs3cmd
from the default repositories using apt
:
sudo apt update
sudo apt install s3cmd
On MacOS:
For macOS users, the easiest way to installs3cmd
is through Homebrew:
brew install s3cmd
If you want to verify s3cmd installation, you can do it by running:
s3cmd --version
This command should return the version ofs3cmd
that you've installed, indicating that the installation was successful.
Initialize s3cmd Configuration:
To begin configuring s3cmd
for use with Genesis Cloud, initiate the configuration process by running:
s3cmd --configure
Access & Secret Keys
Refer to our previous article for details on obtaining your Access Key and Secret Key. During the configuration process, when prompted for these keys, input the ones you generated for Genesis Cloud access.
- Access Key: (Refer to the previous article for obtaining your Access Key)
- Secret Key: (Refer to the previous article for obtaining your Secret Key)
Set arc-is-haf-1
as the Default Region when prompted.
Configuring Endpoint and Bucket Access
When it comes to setting the S3 Endpoint, you can find the endpoint specific to their region directly in our UI and copy it from there. This information is essential for configuring s3cmd
correctly.
How to copy endpoint
DNS-style Bucket Access: For accessing your buckets, use the endpoint URL followed by /%(bucket)
. This format allows s3cmd
to correctly resolve the full URL for bucket access.
Finalize Configuration
Complete the setup by proceeding through the remaining prompts. The default settings should suffice for most users, but you can adjust as needed:
- Encryption: If you wish to encrypt your files, specify an encryption password.
- GPG Program Path: Enter
/opt/homebrew/bin/gpg
or the correct path to your GPG program. - Use HTTPS Protocol: Set this to
True
for secure connections. - HTTP Proxy: If applicable, configure your proxy settings.
After completing these steps, your s3cmd
is configured for use with Genesis Cloud. You can now begin managing your cloud storage with s3cmd
commands.
Example of Configuration:
New settings:
Access Key: 8d384-....-8b06f
Secret Key: GCOSU-....-b3P
Default Region: arc-is-haf-1
S3 Endpoint: s3.arc-is-haf-1.genesiscloudusercontent.com
DNS-style bucket+hostname:port template for accessing a bucket: s3.arc-is-haf-1.genesiscloudusercontent.com/%(bucket)
Encryption password:
Path to GPG program: /opt/homebrew/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0
Upload Your Objects to a Bucket
In order to upload Objects to your Bucket, first list all the Buckets you have using:
s3cmd ls
and get the name of the Bucket where you want to upload the file.
Use the s3cmd put
command to upload your file to the bucket as follows:
s3cmd put FILENAME s3://BUCKETNAME/PATH/TO/DESTINATION
Replace FILENAME with the name of the file you're uploading, BUCKETNAME with the name of your Bucket, and PATH/TO/DESTINATION with the desired path within your bucket where the file will be stored. If you don't specify a path, the file will be placed in the bucket's root directory.
Example: To upload a file named
example.txt
to the root of a bucket namedmy-genesis-cloud-bucket
, you would use:s3cmd put example.txt s3://my-genesis-cloud-bucket/
If you want to upload the file to a folder named
docs
within the bucket, you'd use:s3cmd put example.txt s3://my-genesis-cloud-bucket/docs/
s3cmd
will show a progress indicator during the upload and notify you once the file has been successfully uploaded.
Download Your Objects from a Bucket
Use the s3cmd get
command to download your file from the bucket as follows:
s3cmd get s3://BUCKETNAME/PATH/TO/FILE/FILENAME LOCALFILEPATH
Replace BUCKETNAME with the name of your Genesis Cloud bucket, PATH/TO/FILE/FILENAME with the path and filename of the file you wish to download, LOCALFILEPATH with the path where you want to save the file locally. If you only specify a filename, s3cmd will save the file in the current directory.
Example: To download a file named example.txt
from a folder named docs
in a bucket called my-genesis-cloud-bucket
to your current directory, you'd use:
s3cmd get s3://my-genesis-cloud-bucket/docs/example.txt ./example.txt
This command tells s3cmd
to download example.txt
from your specified bucket and folder and save it as example.txt
in your current directory.
s3cmd
will show a progress indicator during the download and notify you once the file has been successfully downloaded.