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 S3cmd, Rclone or MinIO Client (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 MinIO Client (mc)
Previewing an Object Storage configuration file for the Scaleway CLI
The scw object config get
command allows you to output the content of the configuration file in a terminal and preview the different fields.
Run the following command in a terminal to preview the configuration file for Rclone:
scw object config get type=rclone
An 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 = s3
env_auth = false
endpoint = s3.nl-ams.scw.cloud
access_key_id = SCWEXAMPLED4PDEWS5M
secret_access_key = example-d476-4bd5-b97d-2d97e04c3c4d
region = nl-ams
location_constraint =
acl = private
force_path_style = false
server_side_encryption =
storage_class =
Run the following command in a terminal to preview the configuration file for S3cmd:
scw object config get type=s3cmd
An 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 = SCWEXAMPLED4PDEWS5M
bucket_location = nl-ams
host_base = s3.nl-ams.scw.cloud
host_bucket = %(bucket)s.s3.nl-ams.scw.cloud
secret_key = example-d476-4bd5-b97d-2d97e04c3c4d
use_https = True
Run the following command in a terminal to preview the configuration file for MinIO Client (mc):
scw object config get type=mc
An output similar to the following displays:
{"version":"9","hosts":{"scaleway":{"url":"https://s3.nl-ams.scw.cloud","accessKey":"SCWEXAMPLED4PDEWS5M","secretKey":"example-d476-4bd5-b97d-2d97e04c3c4d","api":"S3v4"}}}
Installing a configuration file for Amazon S3-compatible tools (s3cmd, rclone, and mc)
The scw object config install
allows you to create a configuration file for the selected third party tool based on your Scaleway CLI configuration.
Run the following command in a terminal to install a configuration file for Rclone:
scw object config install type=rclone
An 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 s3cmd
:
scw object config install type=s3cmd
An 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 MinIO Client (mc):
scw object config install type=mc
An output similar to the following displays:
Configuration file successfully installed at /Users/yourusername/.mc/config.json.
Creating an Object Storage bucket
-
Run the following command in a terminal to create a bucket:
rclone mkdir scaleway:my-bucket
-
Run the following command to list your newly created bucket:
rclone lsd scaleway:
An output similar to the following displays:
rclone lsd scaleway: -1 2022-06-04 14:38:03 -1 my-bucket -1 2023-12-23 12:10:57 -1 my-new-bucket
Run the following command in a terminal to create a bucket:
s3cmd mb s3://my-bucket
An output similar to the following displays:
Bucket 's3://my-bucket/' created
Run the following command in a terminal to add an object to your bucket:
mc mb scaleway/my-bucket
An output similar to the following displays:
Bucket created successfully `scaleway/my-bucket`.
Uploading an object to a bucket
- In a terminal, access the folder containing the file you want to upload, then run the following command:
rclone copy /path/to/object/my-object scaleway:my-bucket
- Run the command below to list the object you just uploaded:
An output similar to the following displays:
rclone ls scaleway:my-bucket
0 my-object
In a terminal, access the folder containing the file you want to upload, then run the following command:
s3cmd put file /path/to/object/my-object s3://my-bucket/my-object
An output similar to the following displays:
upload: '/path/to/object/my-object' -> 's3://my-bucket/my-object' [1 of 1]
3259 of 3259 100% in 0s 8.47 KB/s done
In a terminal, access the folder containing the file you want to upload, then run the following command:
mc cp /path/to/local/file/my-file alias/bucket-name
An output similar to the following displays:
.../my-file: 28 B / 28 B ░░░░░░░░░░░░░░░░░░░░░░▓
Downloading an object from a bucket
- In a terminal, run the following command to download an object from a bucket:
rclone copy scaleway:my-bucket/my-object /path/to/destination
- Run the command below to list the object you just downloaded:
An output similar to the following displays:
ls /path/to/destination
my-object
- In a terminal, run the following command to download an object from a bucket:
s3cmd get s3://my-bucket/my-object /path/to/destination
- Run the command below to list the object you just downloaded:
An output similar to the following displays:
ls /path/to/destination
my-object
- In a terminal, run the following command to download an object from a bucket:
mc cp scaleway/my-bucket/my-object /path/to/destination
- Run the command below to list the object you just downloaded:
An output similar to the following displays:
ls /path/to/destination
my-object
Removing an object from a bucket
- In a terminal, run the following command to remove an object from a bucket:
rclone delete scaleway:my-bucket/my-object
- Run the command below to make sure the object has been removed:
The object no longer appears in the output.
rclone ls scaleway:my-bucket
- In a terminal, run the following command to remove an object from a bucket:
s3cmd del s3://my-bucket/my-object
- Run the command below to make sure the object has been removed:
The object no longer appears in the output.
s3cmd ls s3://my-bucket
- In a terminal, run the following command to remove an object from a bucket:
mc rm scaleway/my-bucket/my-object
- Run the command below to make sure the object has been removed:
The object no longer appears in the output.
mc ls scaleway/my-bucket
Deleting an Object Storage bucket
- In a terminal, run the following command to delete a bucket:
rclone purge scaleway:my-bucket
- Run the command below to make sure the bucket has been deleted:
The bucket no longer appears in the output.
rclone lsd scaleway:
- In a terminal, run the following command to delete a bucket:
s3cmd rb s3://my-bucket
- Run the command below to make sure the bucket has been deleted:
The bucket no longer appears in the output.
s3cmd ls
- In a terminal, run the following command to delete a bucket:
mc rb scaleway/my-bucket
- Run the command below to make sure the bucket has been deleted:
The bucket no longer appears in the output.
mc ls scaleway