AWS CLI
AWS CLI (AWS Command Line Interface) is a command line tool for working with the AWS services. See the official Amazon documentation for the general command order. Follow the instructions to install AWS CLI.
You can use the following command sets to work with the Cloud storage using the AWS CLI:
- s3api — commands corresponding to operations in the REST API;
- s3 — additional commands that make it easier to work with a large number of objects.
Configuration
Run aws configure
to configure AWS CLI. You will need to provide the following parameters:
- AWS Access Key ID — enter your login in the AccountNumber_UserName format;
- AWS Secret Access Key — enter your password;
- Default region name — enter ru-1.
Run aws configure
to save settings in the configuration files:
- credentials in .aws/credentials:
[default]
aws_access_key_id = AccountNumber_UserName
aws_secret_access_key = Password
- default region in .aws/config:
[default]
region = ru-1
When running the aws
command to work with the Cloud storage, the –endpoint-url=https://s3.storage.selcloud.ru parameter is required because the client is configured to work with AWS by default.
Command Syntax for Working with the Storage
Creating a New Bucket
aws --endpoint-url=https://s3.storage.selcloud.ru s3 mb s3://BucketName
Uploading an Object
aws --endpoint-url=https://s3.storage.selcloud.ru s3 cp PathToTheFile s3://BucketName/
Downloading an Object
aws --endpoint-url=https://s3.storage.selcloud.ru s3 cp s3://BucketName/PathToTheFile File
Getting a List of Objects
aws --endpoint-url=https://s3.storage.selcloud.ru s3 ls --recursive s3://BucketName
Deleing an Object
aws --endpoint-url=https://s3.storage.selcloud.ru s3 rm s3://BucketName/PathToTheFile/File