s3cmd on Solaris10

Ever wondered if you can use S3 with Solaris 10? This post will walk you through how you can install s3cmd on Solaris 10 to interact with AWS s3.

1. We will need to install pkgutil which will allow us to use the opencsw repository to install wget, python27, py_pip, gnupg

/bin/bash
pkgadd -d http://get.opencsw.org/now
PATH=$PATH:~/opt/csw/bin
pkgutil -U
pkgutil -y -i python27 py_pip gnupg

2. Install python-magic

 pip install s3cmd

3. run s3cmd configure

s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon s3. Leave them empty for using the env variables.
Access Key: YOUR_AWS_ACCESS_KEY
Secret Key: YOUR_AWS_SECRET_KEY
Default Region [US] us-east-1

Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon s3.
S3 Endpoint [s3.amazonaws.com]

Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-Style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]:

Encryption password is used to protect your files from reading by unauthorized persons while in transfer to s3
Encryption password: YOUR_ENC_PASS

Path to GPG program: /opt/csw/bin/gpg

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [Yes]:

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to s3 directly

HTTP Proxy server name:

New Settings:
Access Key: YOUR_AWS_ACCESS_KEY
Secret Key: YOUR_AWS_SECRET_KEY
Default Region: us-east-1
S3 Endpoint: s3.amazonaws.com
DNS-style bucket+hostname:port template for accessing a bucket: %(bucket)s.s3.amazonaws.com
Encryption password: YOUR_ENC_PASS
Path to GPG program: /opt/csw/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0

Test access with supplied credentials [Y/n] Y

Please wait, attempting to list all buckets...
WARNING: Retrying failed request: /?delimiter=%F ('')
WARNING: Wait 3 sec...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Success. Encryption and decryption worked fine :-)

Save Settings? [y/N] y

4. check if you see your buckets

 s3cmd ls
2020-05-02 00:53 s3://test-ldo
2020-05-01 08:53 s3://test2-ldo

5. upload a file

 s3cmd --no-mime-magic put test.txt s3://mytestbucket