S3 Clients and API Libraries

The AWS CLI is the official AWS command line tool for interacting with the S3 API.

Configuration

Installation: Installing AWS CLI version 2

By default aws-cli uses a configuration $HOME/.aws/credentials file. Example configuration file:

[project_abc]
aws_access_key_id = <your access key>
aws_secret_access_key =<your secret key>

[project_xyz]
aws_access_key_id = <your access key>
aws_secret_access_key =<your secret key>
Example
$ export S3_ENDPOINT=https://s3-zh.os.switch.ch
$ aws --endpoint $S3_ENDPOINT --profile project_abc s3 mb s3://<your bucket name>
$ aws --endpoint $S3_ENDPOINT --profile project_abc s3 ls

The official AWS CLI Command Reference contains a complete parameter explanation and examples.

The s3cmd is a command line tool and client for uploading, retrieving and managing data in S3 object storage service.

Configuration for s3cmd

By default s3cmd uses a configuration $HOME/.s3cfg file. Exemplary configuration files:

[default]
use_https = True
access_key = <your access key>
secret_key = <your secret key>
host_base = s3-zh.os.switch.ch
host_bucket = %(bucket)s.s3-zh.os.switch.ch

The host_base and host_bucket parameters depend on the region (LS or ZH) and backend you want to use.
See Object Storage overview.

Example

Using the s3cmd, you can create a public bucket, and add public objects to it:

$ s3cmd mb s3://valery-public --acl-public

$ s3cmd put ghibli-ghost.png s3://valery-public/ --acl-public
$ s3cmd put clockwork-orange-big.png s3://valery-public/ --acl-public

Because the bucket and the objects are public, you can access them directly from:

https://valery-public.os.zhdk.cloud.switch.ch/clockwork-orange-big.png

https://valery-public.os.zhdk.cloud.switch.ch/ghibli-ghost.png

Most tools and library that talk to S3 can be used with the SWITCHengines Object Store. Here is a list of tools that we know are working: