NavigationContentFooter
Jump toSuggest an edit

Managing Object Storage using the Scaleway CLI

Reviewed on 14 June 2024Published on 05 August 2021

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

Important

Unless you add a region argument to your commands, the configuration file will be set for the default region.

  1. Run the following command in a terminal to create a configuration file with 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 = SCW85PRCA6HD4PDEWS5M
    secret_access_key = 8bd5d8ce-d476-4bd5-b97d-2d97e04c3c4d
    region = nl-ams
    location_constraint =
    acl = private
    force_path_style = false
    server_side_encryption =
    storage_class =
  2. Run the following command in a terminal to create a configuration file with 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 = SCW85PRCA6HD4PDEWS5M
    bucket_location = nl-ams
    host_base = s3.nl-ams.scw.cloud
    host_bucket = %(bucket)s.s3.nl-ams.scw.cloud
    secret_key = 12345678-1234-1234-4321-123456789123
    use_https = True
  3. Run the following command in a terminal to create a configuration file with 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":"SCW1111111111111","secretKey":"12345678-1234-1234-4321-123456789123","api":"S3v4"}}}
Note

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)

  1. 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.
  2. 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.
  3. 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

  1. Run the following command in a terminal to create a bucket:

    s3cmd mb s3://your-bucket

    An output similar to the following displays:

    Bucket 's3://your-bucket/' created
  2. 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'
Note

For more information about removing objects, run the following command in your terminal:

s3cmd --help

Deleting an Object Storage bucket

Important

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.

  1. Run the following command in a terminal to display your buckets:

    s3cmd ls

    An output similar to the following displays:

    2021-09-01 15:56 s3://your-bucket
  2. 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
Tip

For more information about the Amazon S3-compatible tools used in this documentation, refer to the official rclone, s3cmd, and mc documentation.

Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2024 – Scaleway