Set up CLI Client for Object Storage
Last updated on
The AWS CLI is a command-line tool for managing files in S3-compatible object storage. Use this guide to install the AWS CLI and configure it to connect to STACKIT Object Storage.
Prerequisites
Section titled “Prerequisites”- A STACKIT project with Object Storage enabled
- An Object Storage bucket. To create one, read Create and manage Object Storage buckets
- Object Storage credentials (access key ID and secret access key). To generate them, read Create and delete Object Storage credentials
Install the AWS CLI
Section titled “Install the AWS CLI”curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"unzip awscliv2.zipsudo ./aws/installThe AWS CLI supports macOS 11 and later.
- Download the macOS installer package from https://awscli.amazonaws.com/AWSCLIV2.pkg.
- Run the downloaded
.pkgfile and follow the on-screen instructions.-
For all users: The installer places the CLI in
/usr/local/aws-cliand creates a symlink at/usr/local/bin/awsautomatically. -
For current user only: After installation, create the symlinks manually:
Terminal window ln -s /folder/installed/aws-cli/aws /usr/local/bin/awsln -s /folder/installed/aws-cli/aws_completer /usr/local/bin/aws_completer
-
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"sudo installer -pkg AWSCLIV2.pkg -target /The AWS CLI supports 64-bit versions of Windows that Microsoft actively supports.
- Download the MSI installer from https://awscli.amazonaws.com/AWSCLIV2.msi.
- Run the downloaded
.msifile and follow the setup wizard instructions.
Open Command Prompt and run:
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msiConfigure credentials
Section titled “Configure credentials”Run the interactive configuration command and enter your STACKIT Object Storage credentials when prompted:
aws configureThe command prompts you for four values:
| Prompt | Value |
|---|---|
| AWS Access Key ID | Your Object Storage access key ID |
| AWS Secret Access Key | Your Object Storage secret access key |
| Default region name | eu01 |
| Default output format | json |
The CLI writes these values to ~/.aws/credentials and ~/.aws/config.
Configure the STACKIT endpoint
Section titled “Configure the STACKIT endpoint”The AWS CLI targets Amazon S3 endpoints by default. To use STACKIT Object Storage, you must point it at the STACKIT endpoint for your region.
Add the --endpoint-url flag to every command you run:
aws s3 ls --endpoint-url https://object.storage.eu01.onstackit.cloudAdd the endpoint_url property to your default profile in ~/.aws/config. This removes the need to pass --endpoint-url with every subsequent command:
[default]output = jsonendpoint_url = https://object.storage.eu01.onstackit.cloudThe examples in the following sections assume you have configured the endpoint in ~/.aws/config. If you passed --endpoint-url instead, append --endpoint-url https://object.storage.eu01.onstackit.cloud to each command.
s5cmd is a high-performance command-line tool designed for managing files in S3-compatible object storage services. Here are some key features and highlights:
- Speed: s5cmd is optimized for speed, capable of handling large-scale operations efficiently.
- Parallelism: It supports parallel runs, allowing multiple operations to run concurrently.
- Versatility: You can perform a variety of tasks such as copying, moving, removing, versioning and listing files.
- Scripting: s5cmd can be integrated into scripts for automated workflows.
Installation
Section titled “Installation”Download the latest release for your platform from the GitHub repository.
Unpack the downloaded archive and move the runnable file to /usr/local/bin:
mv s5cmd /usr/local/bin/For Debian-based distributions, install the .deb package directly with dpkg:
dpkg -i s5cmd_2.3.0_linux_amd64.debInstall with Homebrew:
brew install peak/tap/s5cmdUnpack the downloaded archive and place the .exe file in a directory that is in your system path.
Configuration
Section titled “Configuration”Set the required environment variables so s5cmd can connect to your STACKIT Object Storage endpoint.
export S3_ENDPOINT_URL="https://object.storage.eu01.onstackit.cloud" export AWS_ACCESS_KEY_ID="xxxxxxxxxxxx" export AWS_SECRET_ACCESS_KEY="yyyyyyyyyyyyyyyyyyyyyy" export AWS_REGION="eu01" export S3_ENDPOINT_URL="https://object.storage.eu01.onstackit.cloud" export AWS_ACCESS_KEY_ID="xxxxxxxxxxxx" export AWS_SECRET_ACCESS_KEY="yyyyyyyyyyyyyyyyyyyyyy" export AWS_REGION="eu01" setx S3_ENDPOINT_URL "https://object.storage.eu01.onstackit.cloud" setx AWS_ACCESS_KEY_ID "xxxxxxxxxxxx" setx AWS_SECRET_ACCESS_KEY "yyyyyyyyyyyyyyyyyyyyyy" setx AWS_REGION "eu01"Next steps
Section titled “Next steps”For an overview of available commands and operations, see Create and manage buckets and Create and manage objects.