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]


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. 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
  3. Hi Muthu,

    It could broken version of s3cmd.

    Please download new version of s3cmd.

    Regards,
    Shivdatta

    ReplyDelete
  4. It will only run on python version 2

    ReplyDelete
  5. It will only run on python version 2

    ReplyDelete
    Replies
    1. Hey!
      Thanks for finding it out!
      Can you please comment about what should be done for Python version > 2?

      Delete
  6. Is there any body know why I still call list all of the objects by: "python s3cmd ls" command. but I can not list object inside folder, can not get, put .... The error was: "getaddrinfor-failure". Plzz help

    ReplyDelete
  7. Hi, I am facing "
    Now verifying that encryption works...
    ERROR: Test failed: close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr" Issue. Can you plz help.

    ReplyDelete
    Replies
    1. Hey unknown, I had this message too.

      I just exited with the configuration and ran python c:s3cmd ls

      and listed all the buckets

      Delete
    2. If you look at the s3cmd source file and change the line p = subprocess.Popen(command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, close_fds = True)
      to close_fds=False it works. I'm not sure if there are any side effects, but it seems to run fine on my machine.

      Delete
    3. I have the same issue. Did you find any solution?

      Delete

Post a Comment

Popular posts from this blog

Android Automatic Horizontal Scroll View

JAVA Recieve AWS SNS HTTP Notification using Servlet