Skip to main content
Object Storage is compatible with the Amazon S3 API, which allows you to operate resources using AWS CLI. This Nebius AI Cloud reference shows you how to set up and configure AWS CLI and how to use it to work with buckets and objects complemented with useful parameters you can apply. For the list of supported Amazon S3 features and the few exceptions, see Amazon S3 API Compatibility Reference.

Configuring AWS CLI

This section explains how to create a service account, grant it access to manage your resources and set up the AWS CLI to perform actions on the service account’s behalf. This section also covers other settings that connect the AWS CLI with Nebius AI Cloud and Object Storage. Make sure you are in a group that has the admin role within your tenant or project; for example, the default admins group. You can check this in the Administration → IAM section of the web console.
  1. Create a service account and save its ID to an environment variable:
  2. Grant edit access to the service account:
    1. Get the tenant ID:
    2. Get the ID of the default editors group:
    3. Add the service account to editors group:
  3. Create an access key for the service account and get its AWS-like ID and contents:
  4. Add the key to the AWS CLI configuration:
  5. Depending on your project region, add the Nebius AI Cloud region ID and the Object Storage endpoint URL to the AWS CLI configuration:
    For example, run the following commands for a project in eu-north1:

Working with buckets

In Object Storage, you store your files in containers called buckets.

Create a bucket

Use the s3 mb (“make bucket”) command to create a bucket:
Run:
Output:

List your buckets

Use the s3 ls (“LiSt”) command to see all your available buckets:

Delete a bucket

Use the s3 rb (“remove bucket”) command to delete an empty bucket:
A bucket you want to delete must be completely empty. If you still have objects in your bucket, use the --force parameter to remove a non-empty bucket:
Run:
Output:

Configure lifecycle rules

You can use the AWS CLI to configure lifecycle rules for object expiration and storage-class transitions in a bucket. When you update a bucket lifecycle configuration, provide the full configuration in JSON, including all existing rules that you want to keep. If you omit a rule or some of its parameters, the new configuration replaces the old one and the omitted data is removed. To review the current lifecycle configuration of a bucket, run:
To change a lifecycle configuration, prepare a JSON file that states a new configuration and apply this file:
This example shows a lifecycle rule that deletes all objects in the bucket five days after their upload.
For more information, see How to configure lifecycle rules in Object Storage.

Working with objects

In Object Storage, you work with files and folders called objects.

Upload objects

The AWS CLI does not support uploading objects to a storage class that differs from the bucket’s default. To do that, use s5cmd. For details, see How to upload.
You can choose to upload a single file or a whole folder containing any number of files:
Use the s3 cp (“CoPy”) command to upload a specified local file to your Object Storage bucket with a specified prefix:
Run:
Output:

List objects in your bucket

Use the s3 ls (“LiSt”) command with a <bucket_name> and a [<prefix_for_object_keys>] to see all your available objects:
The command contains the following parameters:
  • --recursive keeps listing objects in the bucket under all available object keys until all have been listed.
  • --human-readable clearly defines data capacity units and rounds them up if necessary.
  • --summarize below the list of objects, shows the total number and the total size of all the objects in the bucket.
In this example, your Object Storage example-bucket contains three text files: lorem.txt, euismod.txt and litora.txt under the object key lorem-ipsum/.Run:
Output:

Move objects between buckets

Use the s3 mv (“MoVe”) command to copy objects with a specified prefix from the source bucket to another destination bucket with a new prefix within your Object Storage cluster, then remove the objects at the origin:
The --recursive parameter used in the command above keeps listing objects in the bucket under all available object keys until all have been listed.
In this example, your Object Storage example-bucket contains three text files: lorem.txt, euismod.txt and litora.txt under the object key lorem-ipsum/. You need to move these objects to another-example-bucket under the prefix lorem-ipsum-mv/.Run:
Output:

Download objects

Use the s3 cp (“CoPy”) command to download a specified object with a prefix from your Object Storage bucket to a destination on your local machine:
You can set a different name for a file you want to download in <local/destination/path/>.
In this example, you’ll download the lorem.txt file from the Object Storage example-bucket to the local example-download/ folder as lorem-download.txt.Run:
Output:
If the name of your local folder contains spaces, put it in single quotation marks. For example: Documents/'My ML configurations'/.

Delete objects

Use the s3 rm (“ReMove”) command to delete objects from your Object Storage bucket.

Useful parameters for AWS CLI commands

This section describes useful parameters you can use with most of the commands listed above.

Include

When you use the s3 cp, s3 sync, s3 mv or s3 rm command, you can apply the --include parameter to set the rule to only include parameters specified. For example, your Object Storage bucket contains images and text files, but you want to download text files only. Set the rule as follows:
In the command above:
  • --recursive copies all the objects available at the source.
  • --include "*.txt" applies the command only to .txt files. Note that you need to use multiple --include parameters to define more than one condition.

Exclude

When you use the s3 cp, s3 sync, s3 mv or s3 rm command, you can apply the --exclude parameter to set the rule to include all the files except the parameters specified. For example, your Object Storage bucket contains images in .png and .jpg formats together with text files, but you want to download text files only. Set the rule as follows:
In the command above:
  • --recursive copies all the objects available at the source.
  • --exclude "*.png" --exclude "*.jpg" applies the command to all file formats except .png and .jpg. Note that you need to use multiple --exclude parameters to define more than one condition.