How to Use Raff S3-Compatible Object Storage with AWS CLI

Serdar Tekin
Serdar Tekin
Co-Founder & CTO
BeginnerUpdated 16 min read~30 minutes total
Object StorageS3AWS CLIUbuntu 24.04StorageBackupPresigned URL
Last reviewed:
Tutorial
How to Use Raff S3-Compatible Object Storage with AWS CLI
rafftechnologies.com/learn

Prerequisites

  • A Raff account with Object Storage access, an existing bucket or permission to create one, a Raff S3 access key and secret key, and an Ubuntu 24.04 or other supported machine with internet access
No egress fees

Point the AWS CLI at your own bucket, 100 GB for $7.00 a month.

Works with your S3 tools and SDKs. Downloads are free, whatever you serve.

Raff Object Storage exposes an S3-compatible API, so you can use the AWS CLI for bucket operations, uploads, downloads, directory syncs, and presigned URLs by pointing commands at https://s3.raffusercloud.com. In this tutorial, you will configure a dedicated AWS CLI profile, use a bucket-scoped access key where possible, create and verify a bucket, transfer files, test a safe sync workflow, create a temporary download URL, and clean up test objects without exposing credentials.

This tutorial targets Raff's current Object Storage feature set. Standard object operations, multipart uploads, presigned URLs, bucket policies and ACLs, and SigV4 authentication are supported. Versioning, lifecycle rules, Object Lock, cross-region replication, and static website hosting are not currently supported, so this guide does not depend on those features. See Raff Object Storage for the current compatibility and pricing matrix.

AWS documents --endpoint-url as the option for overriding a service endpoint, and its current aws s3 commands include cp, ls, mb, rm, rb, sync, and presign. AWS CLI v2 also requires an explicit signing region for presigned URLs. This tutorial uses the existing Raff-compatible signing value us-east-1 and the Raff endpoint on every S3 command.

Step 1 — Install and Verify AWS CLI v2

On Ubuntu 24.04, install the utilities needed for the official AWS CLI v2 installer:

Bash
sudo apt update sudo apt install -y curl unzip

Download and install the current AWS CLI v2 package for x86_64 Linux:

Bash
curl -fsSLo awscliv2.zip \ https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip unzip -q awscliv2.zip sudo ./aws/install rm -rf aws awscliv2.zip

If your VM uses ARM64, use AWS's ARM64 package instead of the x86_64 archive. AWS also provides a current install script and Snap package; follow the official AWS CLI installation documentation if you need another architecture or update method.

Verify:

Bash
aws --version

The command should report AWS CLI 2.x and exit without an error.

Step 2 — Create a Scoped Raff Object Storage Access Key

Open the Raff dashboard and go to Object Storage. Create or select the bucket you want this CLI profile to access, then create an access key with the narrowest permissions your workflow needs.

For an upload/download workflow, prefer a key limited to the intended bucket with read-write access instead of sharing a full-access key across multiple applications. Raff access keys can be limited to one bucket with read or read-write access.

For the broader permission model, review S3 Bucket Security: Credentials, Policies, and Private Access before assigning a key to production automation.

Record the access key ID and secret access key in a password manager when the secret is shown. Do not paste the secret into Git, source code, screenshots, shell scripts, tickets, or chat messages.

Verify: You should have the endpoint https://s3.raffusercloud.com, an access key ID, a secret access key, and the name of the bucket or permission to create one.

Step 3 — Configure a Dedicated AWS CLI Profile

Set a restrictive shell umask before creating the credential files:

Bash
umask 077 aws configure --profile raff

Enter:

Text
AWS Access Key ID: YOUR_RAFF_ACCESS_KEY AWS Secret Access Key: YOUR_RAFF_SECRET_KEY Default region name: us-east-1 Default output format: json

AWS CLI stores profile credentials under ~/.aws/credentials and non-secret profile settings under ~/.aws/config. These files contain sensitive material and should only be readable by your user.

Enforce restrictive permissions:

Bash
chmod 700 ~/.aws chmod 600 ~/.aws/credentials ~/.aws/config

Do not print the credential file contents as a verification step. Instead, check the profile exists:

Bash
aws configure list --profile raff

Verify: The profile should show a configured access key source and us-east-1 region without displaying the full secret key.

Step 4 — Test Authentication Against the Raff S3 Endpoint

List buckets using Raff's custom endpoint:

Bash
aws s3 ls \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

If the scoped key can only access a specific bucket, a global bucket listing may be restricted. In that case, test the intended bucket directly:

Bash
aws s3 ls s3://YOUR_BUCKET_NAME/ \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

An empty bucket can produce no object lines while still returning successfully.

Verify: The command should complete without an authentication or signature error. A permission-denied response is only acceptable when the key is intentionally scoped away from the attempted operation.

Step 5 — Create a Bucket When Your Key Allows It

Skip this step if you already have a bucket or your key is intentionally limited to an existing bucket.

Choose a bucket name using lowercase letters, numbers, and hyphens. Avoid sensitive information in bucket names and avoid periods for better compatibility with HTTPS virtual-hosted addressing.

Create the bucket:

Bash
BUCKET="my-project-files-$(date +%Y%m%d)" aws s3 mb "s3://$BUCKET" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

AWS's general S3 naming guidance uses 3-63 characters, lowercase letters, numbers, periods, and hyphens, with names beginning and ending in a letter or number. Raff may enforce its own namespace availability, so use a name that is unlikely to collide.

Verify:

Bash
aws s3 ls "s3://$BUCKET/" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

The command should return successfully, even if the new bucket is empty.

Step 6 — Upload, List, Download, and Compare an Object

Create a small test object:

Bash
printf 'Raff Object Storage verification\n' > /tmp/raff-s3-test.txt

Upload it:

Bash
aws s3 cp /tmp/raff-s3-test.txt "s3://$BUCKET/raff-s3-test.txt" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

List the object:

Bash
aws s3 ls "s3://$BUCKET/raff-s3-test.txt" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

Download it to a different local path:

Bash
aws s3 cp "s3://$BUCKET/raff-s3-test.txt" /tmp/raff-s3-downloaded.txt \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

Compare the files locally:

Bash
cmp /tmp/raff-s3-test.txt /tmp/raff-s3-downloaded.txt \ && echo 'Upload/download verification passed'

Verify: The cmp command should print Upload/download verification passed.

Step 7 — Sync a Directory Safely with a Dry Run First

Create a small local directory:

Bash
mkdir -p ~/raff-s3-sync-demo printf 'alpha\n' > ~/raff-s3-sync-demo/a.txt printf 'beta\n' > ~/raff-s3-sync-demo/b.txt

Preview the sync before transferring anything:

Bash
aws s3 sync ~/raff-s3-sync-demo/ "s3://$BUCKET/sync-demo/" \ --dryrun \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

If the preview is correct, run the sync:

Bash
aws s3 sync ~/raff-s3-sync-demo/ "s3://$BUCKET/sync-demo/" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

AWS documents sync as recursively copying new and updated files from source to destination. Do not add --delete casually: that option can delete destination objects that no longer exist in the source.

Also note that a sync is not a versioned backup on its own. Turn on bucket versioning in Raff Object Storage if you need earlier copies of an overwritten key.

Verify:

Bash
aws s3 ls "s3://$BUCKET/sync-demo/" \ --recursive \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

Both a.txt and b.txt should appear.

Step 8 — Generate a Temporary Presigned Download URL

Generate a one-hour presigned URL for the test object:

Bash
PRESIGNED_URL="$(aws s3 presign "s3://$BUCKET/raff-s3-test.txt" \ --expires-in 3600 \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1)"

AWS CLI currently supports presigned expiry values up to 604800 seconds, or seven days. Anyone who has a valid presigned URL can use it until it expires, so treat the URL like a temporary bearer credential.

Test it without printing the full URL into shared logs:

Bash
curl -fsS "$PRESIGNED_URL" -o /tmp/raff-s3-presigned.txt cmp /tmp/raff-s3-test.txt /tmp/raff-s3-presigned.txt \ && echo 'Presigned URL verification passed'

Unset the shell variable after the test:

Bash
unset PRESIGNED_URL

Verify: The comparison should print Presigned URL verification passed.

Step 9 — Use Public Read Only for Intentionally Public Objects

Raff supports bucket policies and public-read access, but not S3 static website hosting. Public-read should therefore be used only when the underlying objects are intentionally public, such as downloadable assets.

Create a policy only for a bucket dedicated to public content. Replace YOUR_PUBLIC_BUCKET before running these commands:

Bash
PUBLIC_BUCKET="YOUR_PUBLIC_BUCKET" cat > /tmp/raff-public-read-policy.json <<EOF { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadObjects", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::${PUBLIC_BUCKET}/*" } ] } EOF

Apply it only after reviewing the bucket name and policy:

Bash
cat /tmp/raff-public-read-policy.json aws s3api put-bucket-policy \ --bucket "$PUBLIC_BUCKET" \ --policy file:///tmp/raff-public-read-policy.json \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

Never apply a public-read policy to backup, database dump, log, customer-upload, or other sensitive-data buckets.

Verify: Use aws s3api get-bucket-policy for the intended public bucket and confirm the policy references only the expected bucket. Do not proceed if the policy points to the wrong bucket.

Step 10 — What Raff Object Storage Supports

Raff Object Storage supports:

  • Put, Get, Head, Delete, CopyObject, and batch delete
  • Multipart upload
  • Presigned GET and PUT URLs
  • ListObjectsV2 and prefixes
  • Bucket ACLs and policies
  • SigV4 authentication with AWS CLI and common S3 tooling
  • Bucket versioning and CORS

Not offered:

  • Storage-class transitions (there is one storage class)
  • Object Lock compliance modes
  • Cross-region replication
  • Static website hosting

Raff Object Storage is $7.00 a month for the first 100 GB, then $0.07 per GB, with no egress fees.

Verify: Confirm your planned workflow does not depend on an unsupported feature and that the current product page still matches the pricing assumptions used by your project.

Step 11 — Run the Final End-to-End Verification

Run a final set of non-destructive checks:

Bash
aws --version aws configure list --profile raff aws s3 ls "s3://$BUCKET/" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1 aws s3 ls "s3://$BUCKET/sync-demo/" \ --recursive \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1 aws s3api head-object \ --bucket "$BUCKET" \ --key raff-s3-test.txt \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

The workflow is complete when the AWS CLI profile works, the bucket can be reached with the Raff endpoint, the test object can be uploaded and downloaded unchanged, the sync prefix contains the expected files, and a presigned URL can retrieve the private test object.

Verify: All commands above should complete without authentication, signature, or unexpected permission errors.

Step 12 — Clean Up Test Objects Without Removing Production Data

Delete only the objects created by this tutorial:

Bash
aws s3 rm "s3://$BUCKET/raff-s3-test.txt" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1 aws s3 rm "s3://$BUCKET/sync-demo/" \ --recursive \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1 rm -rf ~/raff-s3-sync-demo rm -f /tmp/raff-s3-test.txt \ /tmp/raff-s3-downloaded.txt \ /tmp/raff-s3-presigned.txt \ /tmp/raff-public-read-policy.json

Do not use aws s3 rb --force on a bucket containing production data. The --force path removes objects before deleting the bucket and is destructive.

If the bucket itself was created only for this tutorial and is now empty, remove it explicitly:

Bash
aws s3 rb "s3://$BUCKET" \ --endpoint-url https://s3.raffusercloud.com \ --profile raff \ --region us-east-1

If you no longer need the CLI credential, revoke the Raff access key in the dashboard before removing the local profile.

Verify: List the bucket if you kept it, or list buckets if you removed it, and confirm only the intended test data was deleted.

Conclusion

You connected AWS CLI v2 to Raff S3-compatible Object Storage, isolated the credentials in a named profile, used a scoped access key, created or accessed a bucket, transferred and compared objects, synced a directory with a dry run, generated a presigned URL, checked compatibility limits, and cleaned up test data safely.

Use the same endpoint pattern for compatible SDKs and tools such as rclone, s3cmd, and application S3 clients. For repeatable uploads and file synchronization, continue with Sync Files to Raff Object Storage with rclone. For a production backup workflow, keep object storage separate from the source VM and design around the current absence of object versioning and lifecycle rules rather than assuming Amazon S3 feature parity.

Create a private Raff S3-compatible bucket and connect AWS CLI with a scoped access key. Verify permissions and avoid using unsupported native versioning or lifecycle APIs.

No egress fees · 14-day money-back guarantee

Create a Bucket Now
Was this article helpful?
Serdar Tekin
Serdar Tekin
Co-Founder & CTO

Co-Founder & CTO at Raff, focused on cloud infrastructure, systems architecture, security, reliability, and production operations.

No egress fees

Point the AWS CLI at your own bucket, 100 GB for $7.00 a month.

Works with your S3 tools and SDKs. Downloads are free, whatever you serve.

14-day money-back guarantee

Frequently asked questions

What is S3-compatible object storage?
S3-compatible object storage implements common Amazon S3 API operations so existing S3 tools can use a different endpoint. Raff supports standard object operations, multipart uploads, presigned URLs, bucket policies and ACLs, and SigV4 authentication.
How do I use AWS CLI with Raff Object Storage?
Configure a named AWS CLI profile with your Raff access key and secret, use `us-east-1` as the signing region, and add `--endpoint-url https://s3.raffusercloud.com` to S3 and S3API commands.
How much does Raff Object Storage cost?
See the [Raff Object Storage](/products/object-storage) product page for current pricing, included storage, transfer allowances, and any usage-based charges. Avoid treating tutorial examples as a pricing source of truth.
Does Raff Object Storage support versioning and lifecycle rules?
Versioning, yes: turn it on per bucket in the bucket's Properties tab. Storage-class transitions are not offered, because Raff Object Storage has one storage class, and neither are Object Lock compliance modes, cross-region replication or static website hosting.
Are presigned URLs supported?
Yes. Raff supports S3-compatible presigned URLs. With AWS CLI, pass the Raff endpoint, profile, region, and an expiry value. Treat a presigned URL like a temporary bearer credential until it expires.
Should I make a backup bucket public?
No. Backup, database dump, log, and sensitive-data buckets should remain private. Use scoped access keys and presigned URLs when temporary access is needed.
Is `aws s3 sync` a complete backup solution?
No. `aws s3 sync` copies new and updated files only. Turn on bucket versioning in Raff Object Storage to keep earlier copies of overwritten objects, or use a backup design that creates timestamped backup objects.
Can I use Raff Object Storage for static website hosting?
Raff supports public-read objects and bucket policies, but not S3 static website hosting.