This guide is designed to familiarize you with the management of your containers/objects. The list of commands presented in this guide is intended to familiarize you with the AWS CLI tool. For more in-depth instructions on AWS CLI, please check out the guides here.
Requirements
- a Public Cloud project in your OVHcloud account
- access to the OVHcloud Control Panel
- an S3 user already created
- Python 3.6 or later (installation instructions)
Instructions
Using AWS CLI
Installation
Enter the following command:
user@host:~$ pip3 install awscli awscli-plugin-endpoint
- awscli-plugin-endpoint is optional
- Install the groff package if you want to use command line help.
Collect Credentials
- To access your S3 resources, you will need your user's Access key and Secret key. You can retrieve this information from the OVHcloud Control Panel under Public Cloud > Object Storage > S3 users.
- You will also need your url_endpoint and the region. If you have already created your container, you can access this information from the
My containers
tab in the details of your container. Otherwise, follow this guide.
Configuration
Configure the aws client as follows:
user@host:~$ cat ~/.aws/credentials
[default]
aws_access_key_id = <access_key>
aws_secret_access_key = <secret_key>
user@host:~$ cat ~/.aws/config
# If you have not installed awscli-plugin-endpoint, delete the next two lines
[plugins]
endpoint = awscli_plugin_endpoint
[profile default]
region = <region_in_lowercase>
s3 =
endpoint_url = <url_endpoint>
signature_version = s3v4
s3api =
endpoint_url = <url_endpoint>
aws --configure
Here are the configuration values that you can specifically set:
Variable | Type | Value | Definition |
max_competitor_requests | Integer | Default: 10 | The maximum number of simultaneous requests. |
max_queue_size | Integer | Default: 1000 | The maximum number of tasks in the task queue. |
multipart_threshold | Integer String |
Default: 8MB | The size threshold that the CLI uses for multipart transfers of individual files. |
multipart_chunksize | Integer String |
Default: 8MB Minimum for uploads: 5MB |
When using multipart transfers, this is the bit size that the CLI uses for multipart transfers of individual files. |
max_bandwidth | Integer | Default: None | The maximum bandwidth that will be used to load and download data to and from your buckets. |
verify_ssl | Boolean | Default: true | Enable / Disable SSL certificate verification |
For a list of endpoints by region and storage class, refer to this page.
Usage
awscli-plugin-endpoint
, you must add --endpoint-url https://s3.<region_in_lowercase>.<storage_class>.cloud.ovh.us
to the command line.--profile <profile>
to the command line.Creating an object container
aws s3 mb s3://<container_name> aws --endpoint-url https://s3.<region_in_lowercase>.<storage_class>.cloud.ovh.us --profile default s3 mb s3://<container_name>
Listing your containers
aws s3 ls
Uploading a file as an object in your container
aws s3 cp /datas/test1 s3://<container_name>
By default, objects are named after files, but can be renamed
aws s3 cp /datas/test1 s3://<container_name>/other-filename
Downloading an object from a container
aws s3 cp s3://<container_name>/test1.
Uploading an object from one container to another container
aws s3 cp s3://<container_name>/test1 s3://<container_name_2>
Downloading or uploading an entire container to the host/container
aws s3 cp s3://<container_name> . --recursive aws s3 cp s3://<container_name> s3://<container_name_2> --recursive
Synchronizing containers
aws s3 sync. s3://<container_name> aws s3 sync s3://<container_name> s3://<container_name_2>
Deleting objects and containers
# Delete an object aws s3 rm s3://<container_name>/test1 # Removing all objects from a container aws s3 rm s3://<containert_name> --recursive # Delete a storage area. To delete a container, it must be empty. aws s3 rb s3://<container_name> # If the compartment is not removed, you can use the same command with the --force option. # This command deletes all objects from the container, then deletes the container. aws s3 rb s3://<container_name> --force
Setting tags on a container
aws s3api put-container-tagging --container <container_name> --tagging 'TagSet=[{Key=myKey,Value=myKeyValue}]' aws s3api get-container-tagging --container <container_name>
{ "TagSet": [ { "Value": "myKeyValue", "Key": "myKey" } ] }
Deleting tags on a container
aws s3api s3api delete-container-tagging --container <container_name>
Setting tags on a container
aws s3api put-object-tagging --container <container_name> --key test1 --tagging 'TagSet=[{Key=myKey,Value=myKeyValue}]' aws s3api get-container-tagging --container <container_name>
{ "TagSet": [ { "Value": "myKeyValue", "Key": "myKey" } ] }
Deleting tags on a container
aws s3api s3api delete-object-tagging --container <container_name> --key test1
Go further
For more information and tutorials, please see our other Object Storage support guides or explore the guides for other OVHcloud products and services.