Some more command to use s3 Bucket on CentOS/RHEL

Share It!

With the help of this tutorial you can use s3 bucket using command

s3

  • Synchronize a directory tree to S3
    Sometime we make some changes in files so except copy all the or copy file individually, we can use sync switch with s3cmd command. It will sync all those files in which changes happen

    # s3cmd sync backup/ s3://techoism
    or
    # s3cmd sync s3://techoism backup/
    

    Sample Output

    backup/tech3.txt -> s3://techoism/tech3.txt  [1 of 1]
     38 of 38   100% in    0s   721.80 B/s  done
    Done. Uploaded 38 bytes in 1.0 seconds, 38.00 B/s. Copied 0 files saving 0 bytes transfer.
    
  • Disk usage by buckets
    We use following command to check the disk usage in bucket

    # s3cmd du s3://techosim
    

    Sample Output

    1110     s3://techoism/
    

    If we have to check the size of all the buckets then we use following command:

    # s3cmd du s3://
    

    Sample Output

    1110     s3://techoism/
    1620651  s3://techoism_DB/
    368881866 s3://techoism_code/
    --------
    370503627 Total
    
  • Infomation of Bucket and Files
    We can get various information about Buckets using following command.

    # s3cmd info s3://techoism
    

    Sample Output

    s3://techoism/ (bucket):
       Location:  us-east-1
       Expiration Rule: none
       policy: none
       ACL:       technical: FULL_CONTROL
    

    We can also check the information on any individual file.

    # s3cmd info s3://techoism/tech3.txt
    

    Sample Output

    s3://techoism/tech3.txt (object):
       File size: 38
       Last mod:  Wed, 06 May 2015 10:13:20 GMT
       MIME type: text/plain
       MD5 sum:   f9448e5a6584bcc3d8b8324abe089437
       SSE:       NONE
       policy: none
       ACL:       technical: FULL_CONTROL
    
  • Copy object
    We can copy files from a bucket to any other bucket

    # s3cmd cp s3://techoism/tech3.txt s3://techoism_code/
    

    Sample Output

    File s3://techoism/tech3.txt copied to s3://techoism_code/tech3.txt
    
  • Move object
    We can move files from a bucket to any other bucket

    # s3cmd mv s3://techoism/tech3.txt s3://techoism_code/
    

    Sample Output

    File s3://techoism/tech3.txt moved to s3://techoism_code/tech3.txt
    
  • Create Website from bucket
    Some time we run website from s3 Bucket, so that we use following command to create website for s3 bucket.

    # s3cmd ws-create s3://techoism
    

    Sample Output

    Bucket 's3://techoism/': website configuration created.
    
  • Delete Website
    Use following command to remove the website from s3 Bucket.

    # s3cmd ws-delete s3://BUCKET
    

    Sample Output

    Bucket 's3://techoism/': website configuration deleted.
    
  • Info about Website
    Following command give infomation of website configuration.

    # s3cmd ws-info s3://BUCKET
    

    Sample Output

    Bucket s3://techoism/: Website configuration
    Website endpoint: http://techoism.s3-website-us-east-1.amazonaws.com/
    Index document:   index.html
    Error document:   None
    
  • No Responses

    Leave a Reply

    Your email address will not be published.