S3cmd

S3cmd is a command line tool for working with services that support the Amazon S3 HTTP API. See the official S3cmd documentation for the general command order.

Installation

To install S3cmd, follow the instructions in the project repository.

Configuration

Run s3cmd --configure to configure S3cmd. You will need to provide the following parameters:

  • Access Key — AccountNumber_UserName;
  • Secret Key — Password;
  • Default Region — ru-1a;
  • S3 Endpoint — s3.selcdn.ru;
  • DNS-style bucket+hostname:port template for accessing a bucket — s3.selcdn.ru;
  • leave the values of the other parameters unchanged.

The program will try to connect to the Cloud storage and get a list of buckets. If successful, the screen will display Success.

Run s3cmd --configure to save the settings in the ~/.s3cfg file in the following format:

[default]
   access_key = AccountNumber_UserName
   secret_key = Password
   bucket_location = ru-1a
   host_base = s3.selcdn.ru
   host_bucket = s3.selcdn.ru

If necessary, you can change these settings directly in the file. You can also specify settings when launching the program using the appropriate parameters.

Command Syntax for Working with the Storage

Creating a New Bucket

s3cmd mb s3://BucketName

Uploading an Object

s3cmd put local_file s3://BucketName/PathToTheFile

Getting a List of Objects

s3cmd ls s3://BucketName

Downloading an Object

s3cmd get s3://BucketName/PathToTheFile File

Deleing an Object

s3cmd rm s3://BucketName/PathToTheFile