s3cmd

This section provides example information to help you install, configure, and use the s3cmd command-line tool. For additional information about this tool, refer to the product documentation listed under "Related Information" at the end of this section.

Installation Example: s3cmd Client

In the following example, the GitHub address is used to clone and install the s3cmd client:

git clone https://github.com/s3cmd
cd s3cmd
python setup.py install

Configuration Example: Create and Configure the Default Configuration File

A default configuration file eliminates the need to provide an s3cfg configuration file for each client session, which must be specified in the command line. To work with the Oracle ZFS Storage Appliance S3 Object API Service, the configuration file must have specific properties set. Use the following examples to create and configure the default configuration file.

Create a default configuration file in the user's home directory by entering the following command:

s3cmd --configure

For a Microsoft Windows system, see About the s3cmd configuration file for the default configuration file name and its location.

Leave all prompts empty except for the last two:

Test access with supplied credentials? [Y/n] n

Save settings? [y/N] y
Configuration saved to '/Users/<user>/.s3cfg'

Next, configure the following properties in the default configuration file:

  • access_key

    This property points to the key required for S3 Authentication. For additional details, see Authentication for S3 API.

  • host_base

    This property points to the network address of the Oracle ZFS Storage Appliance system and the share object store that was enabled for the S3 service.

  • host_bucket

    This property must be empty.

  • secret_key

    This property points to the secret key generated for S3 authentication.

  • use_https

    This property is for disabling or enabling the HTTPS service. For instance, set the use_https property to False to disable the HTTPS service, or set it to True to enable the HTTPS service.

Example:

cat .s3cfg

[default]
access_key = 
            your_access_key-ID
         
host_base = 
            hostname.example.com/s3/v1/export/S3_enabled_share
         
host_bucket = 
secret_key = 
            your_secret key
use_https = False

Usage Examples: s3cmd Client

The following examples show interaction with the Oracle ZFS Storage Appliance S3 Object API Service. Additional usage information about the s3cmd command-line tool is available at the S3 Tools website.

List all buckets:

s3cmd -c .s3cfg ls

Create a new bucket named new_bucket:

s3cmd -c .s3cfg mb s3://new_bucket

Upload file abc.txt to new_bucket:

s3cmd -c .s3cfg put abc.txt s3://new_bucket

List all objects in new_bucket:

s3cmd -c .s3cfg ls s3://new_bucket

Download object abc.txt from new_bucket to a new file abc.2.txt:

s3cmd -c .s3cfg get s3://new_bucket/abc.txt abc.2.txt

Delete object abc.txt from new_bucket:

s3cmd -c .s3cfg del s3://new_bucket/abc.txt

Delete bucket new_bucket:

s3cmd -c .s3cfg rb s3://new_bucket

Run command in debug mode using option --debug:

s3cmd -c .s3cfg cmd parameters --debug

Related Information