Pages

Monday, October 7, 2013

AWS S3 -- s3cmd tool setup on Windows



Setting Up s3cmd  tool on Windows

1.      Download s3cmd  from s3tools –
2.      Download python 2.7 for windows –
                http://www.python.org/getit/

Set Python path
                Go to Environment Variables à
                Edit path variable and append  python path - ‘C:\Python27’ to it.
Go to path of s3cmd  file
·         Install

  python setup.py install

·         Configure

  python s3cmd  -- configure
 
  It will ask for
 
  1)Access Key
  2)SecretKey
  3)Encryption password for python s3cmd  tool – It will used to encrypt the file while being         uploaded and will decrypt with same password while being downloaded.
4)Path to GPG program – No.
5)Use HTTPS protocol [Yes/No]
6)HTTP Proxy Server Name
7) HTTP Proxy Server Port

Save this settings.

·         Run

Example – Command to list all buckets

              python s3cmd  ls

Commands:
                                I.            Make bucket
python s3cmd  mb s3://BUCKET
                              II.            Remove bucket
python s3cmd  rb s3://BUCKET
                            III.            List objects or buckets
python s3cmd  ls [s3://BUCKET[/PREFIX]]
                            IV.            List all object in all buckets
python s3cmd  la
                              V.            Put file into bucket
python s3cmd  put FILE [FILE...] s3://BUCKET[/PREFIX]
                            VI.            Get file from bucket
python s3cmd  get s3://BUCKET/OBJECT LOCAL_FILE
                          VII.            Delete file from bucket
python s3cmd  del s3://BUCKET/OBJECT
                        VIII.            Synchronize a directory tree to S3
python s3cmd  sync LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR
                            IX.            Disk usage by buckets
python s3cmd  du [s3://BUCKET[/PREFIX]]
                              X.            Get various information about Buckets or Files
python s3cmd  info s3://BUCKET[/OBJECT]
                            XI.            Copy object
python s3cmd  cp s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
                          XII.            Move object
python s3cmd  mv s3://BUCKET1/OBJECT1 s3://BUCKET2[/OBJECT2]
                        XIII.            Modify Access control list for Bucket or Files
python s3cmd  setacl s3://BUCKET[/OBJECT]
                        XIV.            Set an access policy for a bucket
python s3cmd  setpolicy s3://BUCKET POLICY_STRING
                          XV.            Enable/disable bucket access logging
python s3cmd  accesslog s3://BUCKET
                        XVI.            Sign arbitrary string using the secret key
python s3cmd  sign STRING-TO-SIGN
                      XVII.            Sign an S3 URL to provide limited public access with expiry
python s3cmd  signurl s3://BUCKET/OBJECT expiry_epoch
                    XVIII.            Fix invalid file names in a bucket
python s3cmd  fixbucket s3://BUCKET[/PREFIX]
                        XIX.            Create Website from bucket
python s3cmd  ws-create s3://BUCKET
                          XX.            Delete Website
python s3cmd  ws-delete s3://BUCKET
                        XXI.            Info about Website
python s3cmd  ws-info s3://BUCKET
                      XXII.            List CloudFront distribution points
python s3cmd  cflist
                    XXIII.            Display CloudFront distribution point parameters
python s3cmd  cfinfo [cf://DIST_ID]
                    XXIV.            Create CloudFront distribution point
python s3cmd  cfcreate s3://BUCKET
                      XXV.            Delete CloudFront distribution point
python s3cmd  cfdelete cf://DIST_ID
                    XXVI.            Change CloudFront distribution point parameters
python s3cmd  cfmodify cf://DIST_ID
                  XXVII.            Display CloudFront invalidation request(s) status
python s3cmd  cfinvalinfo cf://DIST_ID[/INVAL_ID]


7 comments:

  1. Hi Shivdatta

    I don't know these step, could you help me?

    Set Python path
    Go to Environment Variables à
    Edit path variable and append python path - ‘C:\Python27’ to it.
    Go to path of s3cmd file

    ReplyDelete
    Replies
    1. Hi nda,
      Please search how to add python path to path variables in environment variables. It is quite simple.I hope you can do this.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi Shiv,
    I am getting the following error when I am trying to install s3cmd:

    File "s3cmd", line 102
    except S3Error, e:
    ^
    SyntaxError: invalid syntax

    Note; Installed python 3.4 on windows7.

    Could you please help me on this?

    Thank you!

    ReplyDelete
  4. Hi Muthu,

    It could broken version of s3cmd.

    Please download new version of s3cmd.

    Regards,
    Shivdatta

    ReplyDelete