Service Status

The Object Storage Unit (OSU) service is now END OF SALE. For more information, see End-of-Life Policy.

s3cmd is a utility tool developed in Python that easily enables you to use a distant OSU bucket with UNIX-like command lines.

Linux and Windows Configuration 

If you already have python installed on your machine, s3cmd is a python library available through the pip utility.

  • To install s3cmd, run the following command:

    $ pip install s3cmd

Note

s3cmd is compatible with both python2 and python3. It is however recommended to use python2.

Examples

Initialization

  1. To configure s3cmd, run the following command:

    $ s3cmd --configure
  2. Specify your access key, secret key and Region. For more information, see Regions, Endpoints and Availability Zones Reference.

  3. In the home directory, edit the .s3cfg and modify the following lines (this example is for the eu-west-2 Region):

    host_base = osu.eu-west-2.outscale.com
    host_bucket = %(bucket)s.osu.eu-west-2.outscale.com
    website_endpoint = http://%(bucket)s.osu-website-%(location)s.osu.eu-west-2.outscale.com/

    Important

    If you want to manage multiple OSU accounts, you need to duplicate and modify the .s3cfg file.

Scripts

  • Creating a bucket:

    $ s3cmd mb s3://MY_BUCKET
  • Listing the buckets:

    $ s3cmd ls
  • Uploading an object the bucket: 

    $ s3cmd put OBJECT s3://MY_BUCKET

    Tip

    You can setup rights as "public" when adding an object to your bucket, by adding the following parameter:

    --acl-public
  • Copying an object:

    $ s3cmd cp s3://MY_BUCKET/OBJECT_TO_COPY s3://MY_BUCKET_FOR_THE_COPY
  • Listing the content of a bucket:

    $ s3cmd ls s3://my_bucket
  • Downloading an object from a bucket:

    $ s3cmd get s3://MY_BUCKET/OBJECT NEW_NAME_FOR_THE_DOWNLOADED_OBJECT
  • Deleting an object:

    $ s3cmd del s3://my_bucket/bar
  • Signing an S3 URL to provide limited public access with expiry:

    $ s3cmd signurl s3://my_bucket/my_file.png <expiry_in_epoch>
  • Allowing an object for one week:

    Allow file for 1 week
    $ s3cmd signurl s3://my_bucket/my_file.png $(echo "`date +%s` + 3600 * 24 * 7" | bc)
  • Deleting a bucket: 

    $ s3cmd rb s3://MY_BUCKET




Windows® is a registered trademark of Microsoft Corporation in the United States and/or other countries.