With the AWS CLI you manage S3-compatible Object Store as if it were Amazon S3. In this guide you read how to connect the AWS CLI to OpenStack Object Store.
Requirements
To use the AWS CLI, you first need to install it. Depending on your operating system, use the steps on the following page to install the AWS CLI.
Then verify that the installation completed successfully by checking the version with the following command:
aws --version
Create a profile
Stap 1
For this step you need an ‘Access Key ID’ and ‘Secret Access Key’. Do you not have these yet or have you lost them? First create or view them in the TransIP control panel, see our guide on managing S3 tokens.
Use the ‘aws configure’ command to create a new profile and enter your Object Store S3 credentials.
aws configureYou see the following prompts. Replace 1234 with the ‘Access key’ and abcd with the ‘Secret key’ of your S3 token.
AWS Access Key ID [None]: 1234
AWS Secret Access Key [None]: abcd
Default region name [None]: EU
Default output format [None]: (leave this empty)The configuration is stored in ~/.aws/config and ~/.aws/credentials.
Stap 2
For S3-compatible storage (not provided by AWS itself) you need a small configuration change. Open the ~/.aws/config file and in the [Default] block add the following lines:
request_checksum_calculation = when_required
response_checksum_validation = when_requiredThe end result looks for example as follows:
[default]
region = EU
request_checksum_calculation = when_required
response_checksum_validation = when_required
Basic commands
In the examples below, replace the hostname with your endpoint and keep the https:// prefix.
When using the AWS CLI, you pass your Object Store endpoint URL to each command using the --endpoint-url option.
Create a container (bucket)
aws s3 mb s3://my-container --endpoint-url https://<project-id>.objectstore.eu
List containers (buckets)
aws s3 ls --endpoint-url https://<project-id>.objectstore.eu
Delete a container (bucket) (the container must be empty)
aws s3 rb s3://my-container --endpoint-url https://your-project-id.objectstore.eu
Upload a file
aws s3 cp ~/example.txt s3://my-container/ --endpoint-url https://<project-id>.objectstore.eu
Download a file
aws s3 cp s3://my-container/example.txt ./ --endpoint-url https://<project-id>.objectstore.eu
Delete a file
aws s3 rm s3://my-container/example.txt --endpoint-url https://your-project-id.objectstore.eu