Working with CLI
This tutorial contains steps for using the S3-compatible CLI with the Object Store. We recommend using MinIO CLI (mc
) for the best experience.
Download MinIO Client (mc)
- Linux (64-bit Intel): Download
- Linux (64-bit PPC): Download
- Windows (64-bit): Download
- MacOS:
brew install minio/stable/mc
For other methods, visit MinIO documentation here.
Run the Client
Check that 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:
chmod +x mc
./mc --help
Add mc
to the environment path
You may optionally add mc
to your environment path for further convenience. For example:
-
GNU/Linux or macOS:
mv mc /usr/local/bin
./mc --help
Save Storage Credentials
Object Store supports the creation of multiple access credentials (keys) from the storage section in My Account. After generating or creating an access key, you will be provided with an mc
config command:
mc alias set <ALIAS_NAME> <URL> <ACCESS_KEY> <SECRET_KEY>
-
access_key: You can generate an access key from My Account > Storage > Object Storage > Manage Access.
-
secret_key: Obtain this the same way as the access key.
-
key_name: This can be any meaningful name, something easy to remember as you will use this with every
mc
command.
Here is an example:
mc alias set test2 https://objectstore.e2enetworks.net FADSF2322FADF23 ADF23FASDFASDF342ASDF
The above command will save a storage credential with the name wp_creds in your system. From here on, you can access bucket contents granted to this access key with the use of the string wp_creds.
This way, you don't have to pass credentials (access/secret key) each time you run the mc command, instead you refer to wp_creds.
If you are using mc version earlier than RELEASE.2025-05-21T01-59-54Z then use below command:
mc config host add <ACCESS_KEY_NAME> <URL> <ACCESS_KEY> <SECRET_KEY>
Here is an example:
mc config host add ESTWE https://objectstore.e2enetworks.net 4SG71BPL234234FBTZDQS7L 4F13TOK3PNIMJWR5RMX2323JKULVAX7E4M5PGNC3OI8M
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 the 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 creating 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 ***** customer_db | 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
Bucket Status & Object Utilities
Check Bucket Status
mc ready <bucket-path>
mc ping <bucket-path> --count 4
Check Object Size
mc du <bucket-path>
Search for an Object by Name
mc find <bucket-path> | find "<file-name>"
Generate a Pre-signed URL for Download
mc share download <object-path> --expire=<hours>
Check Versioning Status of Objects
mc ls --recursive --versions <bucket-path>
Update mc client
To update your mc client to the latest version
mc update
For source based installations of mc client the mc update command does not support update notifications.
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 at cloud-platform@e2networks.com
.