AWS CLI Quickstart

Learn how to use the AWS Command Line Interface (CLI) with Rabata.io for managing your object storage.

Installation

Before you can use the AWS CLI with Rabata.io, you need to install it on your system.

Install AWS CLI

Follow the official AWS CLI installation instructions for your operating system:

macOS

$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /

Linux

$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install

Windows

Download and run the AWS CLI MSI installer for Windows.

Verify Installation

Verify that the AWS CLI is installed correctly:

$ aws --version
aws-cli/2.x.x Python/3.x.x OS-NAME.x86_64 exec-env/AWS

Configuration

To use the AWS CLI with Rabata.io, you need to configure it with your Rabata.io credentials and endpoint.

Create a Profile

Create a dedicated profile for Rabata.io:

$ aws configure --profile rabata
AWS Access Key ID [None]: YOUR_ACCESS_KEY
AWS Secret Access Key [None]: YOUR_SECRET_KEY
Default region name [None]: eu-west-1
Default output format [None]: json

Configure the Endpoint

Create or edit the AWS CLI configuration file to specify the Rabata.io endpoint:

$ mkdir -p ~/.aws/
$ cat >> ~/.aws/config << EOF
[profile rabata]
region = eu-west-1
s3 =
    endpoint_url = https://s3.eu-west-1.rabata.io
    addressing_style = virtual
EOF

Windows Users: On Windows, the AWS CLI configuration file is located at %USERPROFILE%\.aws\config. You can edit it with a text editor.

Basic Operations

Here are some common operations you can perform with the AWS CLI and Rabata.io.

Bucket Operations

List All Buckets

$ aws s3 ls --profile rabata

Create a Bucket

$ aws s3 mb s3://my-bucket-name --profile rabata

Delete a Bucket

$ aws s3 rb s3://my-bucket-name --profile rabata

Note: The bucket must be empty before it can be deleted. To delete a non-empty bucket, add the --force flag:

$ aws s3 rb s3://my-bucket-name --force --profile rabata

Object Operations

List Objects in a Bucket

$ aws s3 ls s3://my-bucket-name --profile rabata

Upload a File

$ aws s3 cp local-file.txt s3://my-bucket-name/ --profile rabata

Download a File

$ aws s3 cp s3://my-bucket-name/remote-file.txt local-file.txt --profile rabata

Delete a File

$ aws s3 rm s3://my-bucket-name/file-to-delete.txt --profile rabata

Sync a Local Directory with a Bucket

$ aws s3 sync local-directory/ s3://my-bucket-name/ --profile rabata

Sync a Bucket with a Local Directory

$ aws s3 sync s3://my-bucket-name/ local-directory/ --profile rabata

Advanced Operations

Here are some more advanced operations you can perform with the AWS CLI and Rabata.io.

Working with Object Metadata

You can set metadata when uploading objects:

$ aws s3 cp local-file.txt s3://my-bucket-name/ \
  --metadata '{"x-amz-meta-custom-key":"custom-value"}' \
  --profile rabata

Multipart Uploads

For large files, the AWS CLI automatically uses multipart uploads:

$ aws s3 cp large-file.iso s3://my-bucket-name/ --profile rabata

Using Presigned URLs

Generate a presigned URL to allow temporary access to an object:

$ aws s3 presign s3://my-bucket-name/private-file.txt \
  --expires-in 3600 \
  --profile rabata

This generates a URL that is valid for 3600 seconds (1 hour).

Troubleshooting

Here are some common issues and their solutions when using the AWS CLI with Rabata.io.

Connection Issues

If you’re having trouble connecting to Rabata.io, check the following:

Permission Denied

If you receive a “Permission Denied” error:

Debugging

You can enable debug mode to get more information about what’s happening:

$ aws s3 ls --profile rabata --debug