Rclone
Rclone — is a command line interface for working with objects in object storage.
Customize Rclone
Set up access
Access can be configured by a user with role Account Owner or User Administrator.
- Create a service user с a role with access to object storage. If you are using a user with the Object Storage User role, the container must be configured with the access policy.
- Issue an S3 key to the user.
Install the client
Windows
Linux/macOS
-
On Rclone website download the distribution for Windows.
-
Unpack the archive with the distribution.
-
Open a command prompt.
-
Navigate to the directory with the distribution:
cd <path>
Specify
<path>
— path to the directory with the distribution.
-
Open the terminal.
-
Install Rclone any way you want — for example, with a ready-made script:
sudo -v ; curl https://rclone.org/install.sh | sudo bash
Read more about all installation methods at Rclone website.
Create an Rclone configuration
-
Open the configuration mode:
rclone config
A dialog box will appear in the console:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config -
Create a new configuration:
n/s/q> n
-
Click Enter.
-
Enter the name of the remote storage connection (for example,
selectel_s3
):name> selectel_s3
-
Click Enter.
-
Enter the storage type that is specified after the string
Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
:Storage> s3
-
Click Enter.
-
Enter the type of provider that is specified after the line
Any other S3 compatible provider
:provider> Other
-
Click Enter.
-
Select the method of obtaining authorization data that is specified after the line
Enter AWS credentials in the next step
:env_auth> false
-
Enter
AWS Access Key ID
:access_key_id> <access_key>
Specify
<access_key>
— field value Access key from S3 key. -
Enter
AWS Secret Access Key (password)
:secret_access_key> <secret_key>
Specify
<secret_key>
— field value Secret key from S3 key. -
Enter pool, which hosts the object storage (for example,
ru-1
):region> <pool>
-
Enter the URL for S3 API access:
endpoint> <s3_domain>
Specify
<s3_domain>
— S3 API domain depends on pool where the object storage is located. -
Parameter
location_constraint
leave it blank. -
Click Enter.
-
Parameter
acl
leave it blank. -
Click Enter.
-
Parameter
Edit advanced config
leave blank or entern
. -
Click Enter.
-
Check the configuration:
Remote config
--------------------
[selectel_s3]
type = s3
provider = Other
env_auth = false
access_key_id = <access_key>
secret_access_key = <secret_key>
region = <pool>
endpoint = <s3_domain>
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote -
Confirm the creation of the configuration:
y/e/d> y
-
Click Enter.
-
Exit the settings dialog box:
e/n/d/r/c/s/q> q
-
Click Enter.
Working with Rclone
Command format
General view of the teams:
<command> <remote_name>:<container_name>/<object_name>
Specify:
<command>
— an Rclone command of the formrclone <subcommand>
. You can view all the teams at Rclone website or in the output of the commandrclone --help
<remote_name>
— the connection name specified when configuring Rclone;<container_name>
— container name;<object_name>
— optional: object name.
Create a container
Only a private container can be created via the S3 API.
Create a container:
rclone mkdir <remote_name>:<container_name>
Specify:
<remote_name>
— the connection name specified when configuring Rclone;<container_name>
— the name of the new container. Observe the rules for naming containers, see the instructions for more details Bucket naming rules AWS documentation.
View list of objects
Check out the list of facilities:
rclone ls <remote_name>:<container_name>/<prefix>
Specify:
<remote_name>
— the connection name specified when configuring Rclone;<container_name>
— container name;<prefix>
— optional: prefix the objects you want to output.
Load object
When performing copy and synchronization operations, Rclone checks all objects by date and time of change or md5 sum. Objects that have been modified are transferred from the source directory to the destination directory.
Load the object from the local directory:
rclone copy <path> <remote_name>:<container_name>/<object_name>
Specify:
<path>
— path to the object in the local directory;<remote_name>
— the connection name specified when configuring Rclone;<container_name>
— container name;<object_name>
— optional: name with which the object will be loaded. If it is not specified, the file name will be used.
Delete object
Delete the object:
rclone deletefile <remote_name>:<container_name>/<object_name>
Specify:
<remote_name>
— the connection name specified when configuring Rclone;<container_name>
— container name;<object_name>
— the name of the object to be deleted.