Learn about the basic commands needed to manipulate your data on object storage through the ovhai CLI.
Requirements
- a working
ovhai
CLI (see our CLI - Installation guide)
Instructions
This documentation is divided into the following parts:
- Listing available regions of data stores
- Adding new data stores
- Listing containers and objects
- Uploading data
- Downloading data
- Deleting data
- Copying data
- Moving data
Listing available regions of data stores
The following command displays all region codes of available data store regions:
Adding new data stores
To see the list of available data store types, run ovhai datastore add --help
.
Output:
At this time, S3™ * compatible and Git data stores are supported. To know more about S3™ compatible storage, please read this documentation.
To get help on how to add your S3™ compatible container, use ovhai datastore add s3 --help
.
Output:
Listing containers and objects
If you need any help while listing containers in a remote data store, run ovhai bucket list --help
.
Output:
Listing containers and objects - Example 1
Use this command to list all containers in a remote data store located in the region US-EAST-VA
:
Output:
Listing containers and objects - Example 2
Use this command to list all objects for container container-1
in region US-EAST-VA
:
Output:
Listing containers and objects - Example 3
Use this command to list only the objects in the container container-1
, region US-EAST-VA
that begin with prefix seg-01
:
Output:
Uploading data
If you need any help while uploading local data to a container, run ovhai bucket object upload --help
:
A good practice is to use the --dry-run
parameter to get a preview of the actions that would be done by the entered command if this flag was not set.
Uploading data - Example 1
Use this command to upload the local file (or directory) /tmp/directory/file1
into the container my-container
in region US-EAST-VA
while keeping the full path as object name:
The uploaded file (or directory) will have tmp/directory/file1
as object name.
Uploading data - Example 2
Use this command to upload the local file (or directory) /tmp/directory/file1
into the container my-container
in region US-EAST-VA
while keeping only the file name as object name:
The uploaded file (or directory) will have file1
as object name.
Uploading data - Example 3
Use this command to upload the local file (or directory) /tmp/directory/file1
into the container my-container
in region US-EAST-VA
while adding a prefix to the full path as object name:
The uploaded file (or directory) will have /root/tmp/directory/file1
as object name.
Downloading data
If you need any help for downloading objects from a container, run ovhai bucket object download --help
:
A good practice is to use the --dry-run
parameter to get a preview of the actions that would be done by the entered command if this flag was not set.
Downloading data - Example 1
Use this command to download the whole container my-container
in region US-EAST-VA
:
If the objects are prefixed with a directory path such as /tmp/directory/
or even /
, then it will be downloaded on your local storage inside that same directory. If you want to download everything inside your current directory you need to fill the --remove-prefix
parameter.
Example:
ovhai bucket object download my-container@US-EAST-VA --remove-prefix tmp/directory/
Downloading data - Example 2
Use this command to download all the objects from my-container
in region US-EAST-VA
matching the prefix tmp/directory/
:
Same warning as above, if you want to download files on your current directory you will need to fill the --remove-prefix
parameter.
Example:
ovhai bucket object download my-container@US-EAST-VA --prefix tmp/directory/ --remove-prefix tmp/directory/
Deleting data
If you need any help for deleting container or objects, run ovhai bucket delete --help
:
Deleting data - Example 1
Use this command to delete all the content of a container named my-container
, in region US-EAST-VA
, without deleting the container:
Deleting data - Example 2
Use this command to delete a single object named file1
inside the container my-container
of region US-EAST-VA
:
Deleting data - Example 3
Once a container is empty, you can delete it by using:
Copying data
When using containers, it can be interesting to copy an object. If you need any help to do this, run ovhai bucket object copy --help
:
Copying data - Example 1
Use this command to copy a single object path/to/object
in a container my-container
in region US-EAST-VA
:
Copying data - Example 2
If you handle multiple containers, you might be interested in copying a file from one container to another. This can be done like this:
Copying data - Example 3
You can use a prefix to copy all objects contained in this location. For example, let's copy all the elements contained in the location path/to/
to a new/path/to/
of a dest-container
:
Moving data
You can also move an object within a container or in another one. If you need any help, run ovhai bucket object move --help
:
Moving data - Example 1
To move an object within a container, you can use:
Moving data - Example 2
When handling multiple containers, it can be interesting to move a file from one container to another. This can be done by running:
Moving data - Example 3
If you want to move many objects, you can specify a prefix and move all the objects located here by using:
Go further
For more information and tutorials, please see our other AI & Machine Learning support guides or explore the guides for other OVHcloud products and services.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.
*S3 is a trademark filed by Amazon Technologies, Inc. OVHcloud's service is not sponsored by, endorsed by, or otherwise affiliated with Amazon Technologies, Inc.