Working with CLI

This tutorial contains steps for using s3-compatible CLI with the Object Store. We recommend using MinIO CLI (mc) for best experience.

Download MinIO Client

For other methods, visit MinIO documentation here.

Run the Client

Check the client is downloaded correctly by running the following command from the directory where the binary file is saved.

  • macOS
    mc –help
  • Windows
    mc.exe –help
  • GNU/Linux
    ch mod +x mc ./mc –help

Note

Add mc to environment path You may optionally add mc to your environment path for further convinience. For example:

# GNU/Linux or macOS mv mc /usr/local/bin mc –help

Save Storage Credentials

Object store supports creation of multiple access credentials (keys) from storage section in my account. After generating or creating an access key, you will be provided with a mc config command:

mc config host add <key_name> https://objectstore.e2enetworks.net <access_key> <secret_key>
access_key:You can generate an access key from my account > Storage > Manage Access
secret_key:Obtain this the same way as access key.
key_name:This can be any meaningful name. Something easy to remember as you will use this with every mc command.

Tip

Here is an example:

mc config host add wp_creds https://objectstore.e2enetworks.net AAFJRFERF JIJEDF3D88

The above command will save a storage credential with name wp_creds in your system. From here on, you can access bucket contents granted to this access key with the use of string wp_creds.

This way you don’t have to pass credentials (access/secret key) each time you run mc command but instead you refer to wp_creds.

List Objects

The following command lists the objects in a storage bucket named wp_bucket. Here the access key wp_creds has been granted permission to wp_bucket from storage browser in my account.

mc ls wp_creds/wp_bucket/

Under the hood, the mc uses the saved credentials wp_creds to connect to the E2E Object Store.

List Buckets

Object store currently does not support listing buckets from CLI. You can view your buckets from storage browser (My account > Storage).

Make Bucket

Object store currently does not support listing buckets from CLI. You can create your buckets from storage browser (My account > Storage).

View Object Content

Use cat command to view contents of objects in your bucket. You can also use head command to display top few lines of an object.

To view terms.txt from customer_terms directory in wp_bucket:

mc cat wp_creds/wp_bucket/customer_terms/terms.txt

To display first 5 lines from terms.txt:

mc head -n 5 wp_creds/wp_bucket/customer_terms/terms.txt

Pipe Content

You can use pipe command to write contents directly to E2E Object store from command line.

To stream MySQL Database dump to Object store directly:

mysqldump -u root -p ***** customerdb | mc pipe wp_creds/wp_bucket/customers/backup.sql

Copy or Upload content

You can copy content from local system to object store using cp command. The copy operations to object store are verified with MD5SUM checksums. Interrupted or failed attempts can be resumed from the point of failure.

To copy customer terms.txt to customer_terms path (created if does not exist) in wp_bucket:

mc cp terms.txt wp_creds/wp_bucket/customer_terms/terms.txt

To copy a folder recursively:

mc cp —recursive local_dir wp_creds/wp_bucket/

Remove Content

Use rm command to delete file or object.

To remove a terms.txt from wp_bucket/customer_terms:

mc rm wp_creds/wp_bucket/customer_terms/terms.txt

To remove all objects from a bucket:

mc rm —recursive —force wp_creds/wp_bucket

To remove all incomplete uploaded files for an object:

mc rm —incomplete wp_creds/wp_bucket/terms.txt

Share Content

Object store does not support sharing configuration from CLI. To enable a bucket for public or anonymous upload and download, you can visit the bucket permissions tab in storage browser (my account).

Unsupported Commands

Currently we do not support the following commands offered by mc.

  • mirror
  • watch
  • policy
  • admin
  • config

Object store is evolving project, so you can expect these in near future. In case any of these commands are limiting your workflow then please write to us.