Install and configure the storage CLI

The s3cmd tool can be used for managing object storage. This page shows you how to install and configure the package before using storage buckets and objects.

Install s3cmd tool CLI

The s3cmd tool is a command-line tool for managing object storage.

  1. To download the tool, navigate to the directory from where the GDC bundle was extracted.
  2. Run the following commands to extract the s3cmd image, s3cmd.tar.tar.gz, to an empty temporary directory:

    tmpdir=$(mktemp -d)
    
    gdcloud artifacts extract oci/ $tmpdir \
      --image-name=$(gdcloud artifacts tree oci | grep s3cmd.tar | sed 's/^.* //')
    
  3. scp the tar file to a client machine where you use s3cmd for object operations; extract and install the image.

Choose one of the following installation methods to install the s3cmd tool:

Install through tar file

  1. To unpack the archive and install the s3cmd package, run the following commands. You must have the Python distutils module to install the package. The module is often part of the core Python package or you can install it using your package manager.

    tar xvf /tmp/gpc-system-tar-files/s3cmd.tar.tar.gz
    cd /tmp/gpc-system-tar-files/s3cmd
    sudo python3 setup.py install
    
  2. Optional: Clean up the downloaded files:

    rm /tmp/gpc-system-tar-files/s3cmd.tar.tar.gz
    rm -r /tmp/gpc-system-tar-files/s3cmd
    

Install with docker image

  1. To install the s3cmd image, run the following commands:

    docker load --input s3cmd-docker.tar
    export S3CFG=/EMPTY_FOLDER_PATH/
    alias s3cmd="docker run -it --net=host --mount=type=bind,source=/$S3CFG/,target=/g/
    s3cmd-docker:latest -c /g/s3cfg"
    
  2. Optional: Clean up the downloaded files:

    rm s3cmd-docker.tar
    
  3. Add the export and alias to the .bashrc file to persist after restarting the client.

Configure the s3cmd tool

Use the s3cmd tool for object-based operations.

Run the s3cmd --configure command and specify the following:

  1. Access Key: Enter the access key obtained from the secret in getting access credentials.
  2. Secret Key: Enter the secret key obtained from the secret in getting access credentials.
  3. Default Region: Press ENTER.
  4. S3 Endpoint: Enter the endpoint your Infrastructure Operator (IO) provides.
  5. For DNS style bucket naming, enter s3://%(bucket).
  6. Optional: Enter an encryption password to protect files in transit.
  7. In Path to GPG, enter /usr/bin/gpg.
  8. Enter Yes to use the HTTPS protocol.
  9. Press Enter to skip entering the proxy server name.