AWS CLI for S3 Gateway

You can install and use the AWS Command Line Interface (CLI) with the S3 gateway.

Installing the AWS CLI

NOTICE The S3 gateway is included in EEP 6.0.0 - EEP 8.0.0 repositories.

To install the AWS CLI on Ubuntu, RedHat/CentOS, or SLES, run:

pip install awscli
To configure the AWS CLI, use the AWS configure command with the values shown in the following table:
Value Description
AWS Access Key ID Insert the accessKey from the tenants.json file
AWS Secret Access Key Insert the secretKey from the tenants.json file
Default region name Specify 'us-west-1'
Default output format Specify json

Using the AWS CLI

The following table provides examples of commands that can help you manage buckets and files.
NOTE The /opt/mapr/conf/ca/chain-ca.pem file is the public certificate for the node that is generated by MapR Data Platform.
# Create a bucket and upload a file
aws s3 mb s3://mybucket/ --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
echo "HelloS3World" > /tmp/helloS3world.txt
aws s3 cp /tmp/helloS3world.txt s3://mybucket/helloS3world.txt --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
# Move an object from one bucket to another
aws s3 mv s3://firstbucket/helloS3world.txt s3://mybucket/helloS3world.txt --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
# Delete an object from a bucket
aws s3 rm s3://mybucket/helloS3world.txt --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
# Delete the bucket
aws s3 rb s3://mybucket/ --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
# List all files in the bucket
aws s3 ls s3://mybucket/ --endpoint-url https://<ip-address>:9000 --ca-bundle  /opt/mapr/conf/ca/chain-ca.pem
        
# Show all files on the filesystem
ls -al /mapr/demo.mapr.com/apps/s3/$(hostname)/mybucket/
NOTE The public SSL certificate is generated when installing the S3 gateway at /opt/mapr/objectstore-client/objectstore-client-1.0.0/conf/certs/public.crt.
For a non-secure cluster, use http instead of https and do not use --ca-bundle /absolute/path/to/public.crt. For example:
# List all files in the bucket for secure cluster
aws s3 ls s3://mybucket/ --endpoint-url https://<ip-address>:9000 --ca-bundle /absolute/path/to/public.crt
         
# List all files in the bucket for non-secure cluster
aws s3 ls s3://mybucket/ --endpoint-url http://<ip-address>:9000