Command Line tool to Access Object Storage (Amazon S3 or Ceph Object Storage)

Vineet Kumar
1 min readJul 3, 2020

--

  1. Install s3cmd if not available:
    apt install s3cmd or yum install s3cmd
  2. Configure s3 environment: run $ s3cmd --configure in Linux (For Windows run >python s3cmd --configure) and Fill up following details with s3 accounts AccessKey and SecretKey,
    a. Enter Access Key and secret kay
    b. Zone will be default (If not set up) other wise selected zone
    c. S3 End point will be the access point (For Ex: s3.amazon.com)
    d. Template For Accessing a bucket: <End-point-url>/<Bucket-Name>
    e. All other field will be default values if its values are not set up.
    f. Now save the Configuration
  3. Cover will list all available data ( objects ) under our
    $ s3cmd la
  4. Create a bucket
    $ s3cmd mb s3://abc
  5. List All Available Buckets:
    $ s3cmd ls
  6. Copy File Into Bucket:
    $ s3cmd put index.html s3://abc
  7. Copy File Between Buckets:
    $ s3cmd cp s3://abc/a.txt s3://bcd/
  8. Move File Between Buckets:
    $ s3cmd mv s3://abc/index.html s3://bcd/test.html
  9. Sync a Local Directory:
    $ s3cmd sync dir1/ s3://linux/
  10. Removing Files:
    $ s3cmd rm s3://linux/foo
  11. Empty Entire Bucket:
    $ s3cmd del -r --force s3://linux/
  12. Remove Bucket
    $ s3cmd rb s3://linux/
  13. Compress File Before Upload:
    $ cat foobar | gzip -9 | s3cmd put - s3://linuxconfigorg/foobar.gz
  14. Compress Directory Before upload:
    $ tar cz dir1/ | gzip -9 | s3cmd put - s3://linuxconfigorg/dir1.tar.gz
  15. Copy a file in local Machine:
    $s3cmd get s3://linuxconfigorg/foobar.gz
  16. Enjoy!!!

--

--

No responses yet