How to use Storadera with AWS CLI

NB! This guide is for AWS CLI version 2 but it should be quite similar for version 1 as well.

Installation

AWS CLI is available on Linux, Windows and Mac.
Installation instructions can be found here:
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

Configure

First, we need to configure the AWS CLI

$ aws configure

It will ask the following information:

AWS Access Key ID [None]: <Your access key>
AWS Secret Access Key [None]: <Your secret access key>
Default region name [None]: <Leave empty>
Default output format [None]: <Leave empty>

Use

Listing buckets

$ aws s3 ls --endpoint-url https://eu-east-1.s3.storadera.com

List one “folder” in bucket

$ aws s3 ls test-bucket/my-folder --endpoint-url
https://eu-east-1.s3.storadera.com

Copy directory recursively to Storadera

$ aws s3 cp <local-directory>/ s3://<destination-bucket>/ --recursive
--endpoint-url https://eu-east-1.s3.storadera.com

Migrating data from another S3 service to Storadera

NB! If you have multiple S3 sources then it is good to make different profiles like that

$ aws configure --profile storadera

And later just add the profile to all commands

$ aws s3 ls --profile storadera --endpoint-url
https://eu-east-1.s3.storadera.co

Data migration is done in two steps:

  1. Copy from other source to local
aws s3 cp s3://<source-bucket>/ <local-directory> --recursive
  1. Copy from local to Storadera
$ aws s3 cp <local-directory>/ s3://<destination-bucket>/ --recursive
--profile storadera --endpoint-url https://eu-east-1.s3.storadera.com

Creating buckets

For simplicity we recommend creating buckets through our web https://account.storadera.com
But it can be achieved in command line also:

$ aws s3api create-bucket --bucket my-bucket --endpoint-url
https://eu-east-1.s3.storadera.com

References

Full reference of s3 commands:
https://docs.aws.amazon.com/cli/latest/reference/s3/
Here we provide simple examples with aws configure command to set the credentials to config file.
Credentials can also be in ENV and more. Check out more from
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html