Skip to content

How To Use the AWS Client to Access the S3 API

You will need EC2 credentials for this guide. [You can learn how to create them here.](https://support.moonqube.com/article/56-how-to-generate- ec2-credentials)

It is recommended to activate a virtual environment with source .venv/bin/activate

First, install the AWS client with pip install awscli awscli-plugin-endpoint

Now create the directory ~/.aws We need to create two files in this directory, ~/.aws/credentials and ~/.aws/config These are defined as follows.

$ cat ~/.aws/credentials

[default]
aws_access_key_id = <access_key>
aws_secret_access_key = <secret_key>

$ cat ~/.aws/config 

[plugins]
endpoint = awscli_plugin_endpoint

[profile default]
region = iad3
s3 =
  endpoint_url = https://us-east-1.moonqube.com:6780
  signature_version = s3v4
s3api =
  endpoint_url = https://us-east-1.moonqube.com:6780

Now you can test that you can access the S3 API with aws —profile default s3 ls

This command will list any existing buckets.