Back to home

Object Storage Client Tools

Besides integrations into your development framework, there are dozens of tools to access buckets. We present configurations for the most common tools here. For more details, it is best to consult the documentation for the respective software directly.

s3cmd

s3cmd is a popular command line tool for managing data in object storage buckets. The tool is designed for AWS S3, but works fine with other compatible systems, such as our Object Storage. To configure it, you need details about your bucket and the corresponding user. Make sure that the user has access to the bucket.

This is an example configuration, which should be in a file ~/.s3cfg. Adjust the values according to the information for your user and bucket.

[default]
access_key = 6aaf50b17357446bb1a25a6c93361569
secret_key = fcf1c9c6bc5c4384a4e0dbff99d3cc52
host_base = cz42.objectstorage.nineapis.ch
host_bucket = cz42.objectstorage.nineapis.ch
bucket_location = nine-cz42
signature_v2 = True
use_https = True

After that you can start uploading files.

s3cmd put image01.jpg s3://my-bucket

rclone

rclone is commonly used for backing up data to an S3 compatible storage. However, there are numerous other backends for various other storages.

This is an example configuration which should be in a file ~/.config/rclone/rclone.conf. Adjust the values according to the information for your user and bucket.

[nine-cz42]
type = s3
provider = Other
access_key_id = 6aaf50b17357446bb1a25a6c93361569
secret_access_key = fcf1c9c6bc5c4384a4e0dbff99d3cc52
region = nine-cz42
endpoint = https://cz42.objectstorage.nineapis.ch

After that, files can be uploaded from the local disk to the object storage or from other configured rclone backends.

rclone copy image01.png nine-cz42:my-bucket

Heads up! Due to a bug you might have to pass the flag --s3-no-check-bucket when using a newer version of rclone (>=v1.53.3) or you will receive permission errors when uploading files.

Or you can synchronize a local directory with the Object Storage:

rclone sync backup-dir nine-cz42:mybucket

restic

restic is an exceptional backup solution that is easy to use and has great deduplication.

Heads up! Older version of restic seems to have a problem with the Region Setting. Please use v0.12.0 or newer.

Similar to the other tools, you first need to define the s3 variables. This can either be done with environments variables or with command parameters.
For this example, we go for the env variables, since this is more practical:

We add the following variables to the config file: ~/my_backup/restic.conf

export AWS_ACCESS_KEY_ID="6aaf50b17357446bb1a25a6c93361569"
export AWS_SECRET_ACCESS_KEY="fcf1c9c6bc5c4384a4e0dbff99d3cc52"
export AWS_DEFAULT_REGION='nine-cz42'
export RESTIC_REPOSITORY="s3:https://cz42.objectstorage.nineapis.ch/bucket-etj4mwciyzuv"
export RESTIC_PASSWORD="SUPER-SECURE-PASSWORD"

In contrast to the other tools, restic works with repositories. So at first, we need to create such a repository. To do this, we need to load the env variables we set before:

$ source ~/my_backup/restic.conf

Then we can initialize the repository:

$ restic init

Now we’re ready to backup some stuff:

$ restic backup /home/www-data/this_should_be_backuped

Now we want to check, what backups we already have:

$ restic snapshots
repository ff06b869 opened successfully, password is correct
ID        Time                 Host             Tags        Paths
-------------------------------------------------------------------------------------------------------------------
bb689eb9  2021-07-16 11:45:27  mysuperserver              /home/www-data/this_should_be_backuped.bin
-------------------------------------------------------------------------------------------------------------------
1 snapshots

One backup run will create one snapshot.
To delete old snapshots, you can do this:

$ restic forget bb689eb9 --prune

But since you most likely won’t delete all the snapshots manually, you can do this with retention policies:

$ restic forget --keep-daily 30 --keep-weekly 4 --keep-monthly 12 --keep-yearly 10 --prune

Please keep in mind, that this is just a super simple example how to backup a directory. restic is quite powerful and has a lot of options. Check out their documentation for a more detailed help:
https://restic.readthedocs.io/en/stable/040_backup.html

Didn't find what you were looking for?

Contact our support:

+41 44 637 40 40 Support Portal support@nine.ch