Amazon Web Services (AWS) Command Line Interface (AWS CLI) – how to configure and use AWS CLI to manage data with MinIO Server

Feel free to use this service for testing and development and replace with your own MinIO keys

C:\>aws configure
AWS Access Key ID [None]: < Access Key >
AWS Secret Access Key [None]:  < Secret Access Key >
Default region name [None]: ENTER
Default output format [None]: ENTER

Additionally enable AWS Signature Version ‚4‘ for MinIO server

C:\>aws configure set default.s3.signature_version s3v4

To list your buckets

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 ls
2020-12-11 13:06:51 bucket-governance
2021-03-08 14:23:23 bucket-homeoffice
2020-12-12 11:02:20 bucket-versioning
2020-12-11 12:53:16 bucket-worm
C:\>aws –endpoint-url https://192.168.1.151:9000 s3 ls
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

AWS CLI uses SSL when communicating with AWS services for each SSL connection, the AWS CLI will verify SSL certificates this option overrides the default behavior of verifying SSL certificates

C:\>aws –no-verify-ssl –endpoint-url https://192.168.1.151:9000 s3 ls
2020-12-11 13:06:51 bucket-governance
2021-03-08 14:23:23 bucket-homeoffice
2020-12-12 11:02:20 bucket-versioning
2020-12-11 12:53:16 bucket-worm

To list contents inside bucket

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 ls s3://bucket-homeoffice
2021-03-08 14:25:07 43949 S3Browser_01.jpg
2021-03-08 14:25:03 129627 S3Browser_02.jpg

To make a bucket

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 mb s3://bucket-homeoffice-02
make_bucket: bucket-homeoffice-02

To add an object to a bucket

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 cp c:\tmp\S3Browser_03.jpg s3://bucket-homeoffice-02
upload: tmp\S3Browser_03.jpg to s3://bucket-homeoffice-02/S3Browser_03.jpg

To delete an object from a bucket

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 rm s3://bucket-homeoffice-02/S3Browser_03.jpg
delete: s3://bucket-homeoffice-02/S3Browser_03.jpg

To remove a bucket

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 rb s3://bucket-homeoffice-02
remove_bucket: bucket-homeoffice-02

To sync (rsync-like) between local storage and s3

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 mb s3://bucket-homeoffice-02
make_bucket: bucket-homeoffice-02
C:\>aws –endpoint-url http://192.168.1.151:9000 s3 sync c:\tmp s3://bucket-homeoffice-02
upload: tmp\S3Browser_03.jpg to s3://bucket-homeoffice-02/S3Browser_03.jpg
C:\>aws –endpoint-url http://192.168.1.151:9000 s3 sync c:\tmp s3://bucket-homeoffice-02
C:\>copy c:\tmp\S3Browser_03.jpg c:\tmp\S3Browser_04.jpg
1 Datei(en) kopiert.

Syncs directories and S3 prefixes recursively copies new and updated files from the source directory to the destination only creates folders in the destination if they contain one or more files

C:\>aws –endpoint-url http://192.168.1.151:9000 s3 sync c:\tmp s3://bucket-homeoffice-02
upload: tmp\S3Browser_04.jpg to s3://bucket-homeoffice-02/S3Browser_04.jpg

 

Leave a Reply

You must be logged in to post a comment.