Unless you add a region argument to your commands, the configuration file will be set for the default region.
Managing Object Storage using the Scaleway CLI
Scaleway Object Storage is a service based on the Amazon S3 protocol. It allows you to store different types of objects (documents, images, videos, etc.) and distribute them instantly, anywhere in the world. You can create and manage your Object Storage resources from the console, or via the Scaleway Command Line Interface that uses external tools such as rclone
, s3cmd
and mc
.
Scaleway Command Line Interface Overview
The Scaleway Command Line Interface (CLI) allows you to pilot your Scaleway infrastructure directly from your terminal, providing a faster way to administer and monitor your resources. Scaleway CLI is easy to set up and is an essential tool for operating efficiently in your cloud environment.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A valid API key
- An Object Storage bucket
- Installed and initialized the Scaleway CLI
- Downloaded S3cmd, rclone and mc
Creating a configuration file for the Scaleway CLI
-
Run the following command in a terminal to create a configuration file with
rclone
:scw object config get type=rcloneAn output similar to the following displays:
# Generated by scaleway-cli command# Configuration file for rclone https://rclone.org/s3/#scaleway# Default location: $HOME/.config/rclone/rclone.conf[scaleway]type = s3env_auth = falseendpoint = s3.nl-ams.scw.cloudaccess_key_id = SCW85PRCA6HD4PDEWS5Msecret_access_key = 8bd5d8ce-d476-4bd5-b97d-2d97e04c3c4dregion = nl-amslocation_constraint =acl = privateforce_path_style = falseserver_side_encryption =storage_class = -
Run the following command in a terminal to create a configuration file with
s3cmd
:scw object config get type=s3cmdAn output similar to the following displays:
# Generated by scaleway-cli command# Configuration file for s3cmd https://s3tools.org/s3cmd# Default location: $HOME/.s3cfg[default]access_key = SCW85PRCA6HD4PDEWS5Mbucket_location = nl-amshost_base = s3.nl-ams.scw.cloudhost_bucket = %(bucket)s.s3.nl-ams.scw.cloudsecret_key = 12345678-1234-1234-4321-123456789123use_https = True -
Run the following command in a terminal to create a configuration file with
mc
:scw object config get type=mcAn output similar to the following displays:
{"version":"9","hosts":{"scaleway":{"url":"https://s3.nl-ams.scw.cloud","accessKey":"SCW1111111111111","secretKey":"12345678-1234-1234-4321-123456789123","api":"S3v4"}}}
For more information about generating a configuration file, type the following command in your terminal:
scw object config get --help
Installing a configuration file for Amazon S3-compatible tools (s3cmd, rclone, and mc)
-
Run the following command in a terminal to install a configuration file for
s3cmd
:scw object config install type=s3cmdAn output similar to the following displays:
Configuration file successfully installed at /Users/yourusername/.s3cfg. -
Run the following command in a terminal to install a configuration file for
rclone
:scw object config install type=rcloneAn output similar to the following displays:
Configuration file successfully installed at /Users/yourusername/.config/rclone/rclone.conf. -
Run the following command in a terminal to install a configuration file for
mc
:scw object config install type=mc`An output similar to the following displays:
Configuration file successfully installed at /Users/yourusername/.mc/config.json.
Adding an Object Storage bucket
-
Run the following command in a terminal to create a bucket:
s3cmd mb s3://your-bucketAn output similar to the following displays:
Bucket 's3://your-bucket/' created -
Run the following command in a terminal to add an object to your bucket:
s3cmd put file /path/to/object/your-object s3://your-bucket/your-object`An output similar to the following displays:
upload: '/path/to/object/your-object' -> 's3://your-bucket/your-object' [1 of 1]3259 of 3259 100% in 0s 8.47 KB/s done
Removing an object from a bucket
Run the following command in a terminal to remove an object from your bucket:
s3cmd delete: s3://your-bucket/your-object
An output similar to the following displays:
delete: 's3://your-bucket/your-object'
For more information about removing objects, run the following command in your terminal:
s3cmd --help
Deleting an Object Storage bucket
This action will delete every object stored inside your bucket. Your bucket name will no longer be yours, and other users will be able to use it.
-
Run the following command in a terminal to display your buckets:
s3cmd lsAn output similar to the following displays:
2021-09-01 15:56 s3://your-bucket -
Run the following command in a terminal to delete a bucket:
s3cmd rb s3://your-bucket
An output similar to the following displays:
Bucket 's3://your-bucket/' removed