Square CloudSquare Cloud

Best S3 client tool: aws-cli, rclone, s3cmd or an SDK

To sync folders and migrate data, use rclone; for scripts and CI, the aws-cli; inside your application, your language's SDK. s3cmd still serves simple scripts that already depend on it.

Updated 8 min read

Learning objectives

After reading this article you will be able to:

  • Compare aws-cli, rclone, s3cmd, the MinIO Client and the SDKs on practical criteria
  • Point each tool at any S3-compatible endpoint
  • Pick the right tool for syncing, large files, scripts and CI
On this page

Every S3-compatible service speaks the same HTTP API, so any S3 client can upload, download and list files on it. The differences between tools show up everywhere else: how each one decides what to sync, whether it splits large files into parts without being asked, how easy it is to run in a script or a CI pipeline, and whether it still gets updates.

This guide compares the five most common options: the aws-cli, rclone, s3cmd, the MinIO Client (mc) and the SDKs. The commands point at a generic endpoint (https://s3.example.com), so they work for AWS and for any compatible provider. If the concept is new, start with what S3-compatible storage is.

Which criteria matter?#

  1. Syncing. Copying only what changed means comparing source and destination. Each tool compares differently (size, date or checksum) and handles extra files in the destination differently: some delete only with a flag, others delete by default.
  2. Large files. Above a certain size, an upload has to be multipart: the file goes up in parts, in parallel, and a failed part is retried on its own. What matters is the size at which the tool does this by itself. The mechanism is covered in how to upload large files.
  3. Scripting. Output that is easy to filter, reliable exit codes, include and exclude filters, and a dry run mode before any command that deletes.
  4. CI. Quick install and configuration entirely through environment variables, with no credentials file in the repository. Keys belong in the pipeline's secrets.
  5. Custom endpoint and maintenance. The tool has to accept an endpoint other than AWS's and keep shipping releases, because the S3 API and the SDKs change.

When should you use the aws-cli?#

The aws-cli is AWS's official command line. The high-level commands (aws s3 cp, sync, ls, rm, presign) cover daily work, and the low-level ones (aws s3api) expose every API operation. To use another provider, pass --endpoint-url on each command or set AWS_ENDPOINT_URL_S3 in the environment:

bash
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-east-1"                 # or the region your provider uses
export AWS_ENDPOINT_URL_S3="https://s3.example.com"   # replaces --endpoint-url

aws s3 ls s3://my-bucket/
aws s3 cp ./report.pdf s3://my-bucket/reports/report.pdf
aws s3 sync ./public s3://my-bucket/site/ --dryrun
aws s3 sync ./public s3://my-bucket/site/ --delete
aws s3 presign s3://my-bucket/reports/report.pdf --expires-in 3600

sync uploads files that don't exist in the bucket, files with a different size and files newer than the remote copy. It only deletes destination files that are missing from the source when you pass --delete, and --dryrun shows what would happen without doing it. Multipart is automatic: by default, files from 8 MB up go in 8 MB parts, with up to 10 requests in parallel. You change those values with aws configure set default.s3.multipart_chunksize 16MB and default.s3.max_concurrent_requests. presign creates a temporary download link, a presigned URL.

Pros: official and documented in depth, found in countless tutorials and pipelines, JSON output for scripts, and configuration entirely through environment variables.

Cons: it only speaks S3 (and the rest of AWS), sync compares size and date rather than content, and some providers need tweaks, such as aws configure set default.s3.addressing_style path when the bucket has to go in the URL path.

When should you use rclone?#

rclone is an open source sync tool that speaks S3 and dozens of other services, such as Google Drive, Dropbox and SFTP. Each destination is a "remote", created with the rclone config wizard or with environment variables alone, the most practical format for CI:

bash
export RCLONE_CONFIG_STORAGE_TYPE=s3
export RCLONE_CONFIG_STORAGE_PROVIDER=Other
export RCLONE_CONFIG_STORAGE_ENDPOINT=https://s3.example.com
export RCLONE_CONFIG_STORAGE_REGION=us-east-1
export RCLONE_CONFIG_STORAGE_ACCESS_KEY_ID=your-access-key
export RCLONE_CONFIG_STORAGE_SECRET_ACCESS_KEY=your-secret-key

rclone lsf storage:my-bucket/
rclone copy ./uploads storage:my-bucket/uploads --progress
rclone sync ./public storage:my-bucket/site --dry-run
rclone check ./uploads storage:my-bucket/uploads

Watch the names: rclone copy only adds and updates, while rclone sync makes the destination identical to the source and deletes whatever is left over. Run sync with --dry-run the first time. By default it runs 4 transfers in parallel (--transfers), and multipart kicks in for files above 200 MiB, in 5 MiB parts (--s3-upload-cutoff and --s3-chunk-size). If your provider requires multipart earlier, lower the cutoff.

rclone stores the modification time as object metadata, and reading it costs one HEAD request per file, because listings don't include that metadata. On large buckets, --size-only, --checksum or --update --use-server-modtime cut those calls, which can show up on the bill (see how much object storage costs). If your key can't create buckets, --s3-no-check-bucket stops it from trying.

Pros: the most complete sync, direct migration between providers (rclone sync source:bucket dest:bucket, with the data flowing through the machine that runs the command, step by step in how to migrate files between S3 providers), check to compare size and hash, powerful filters and a single binary.

Cons: many options to learn, sync deletes by default, and the default multipart values don't always match the provider.

What about s3cmd and the MinIO Client?#

s3cmd is an older, simple Python tool configured through a ~/.s3cfg file that s3cmd --configure creates interactively:

ini
[default]
access_key = your-access-key
secret_key = your-secret-key
host_base = s3.example.com
# without %(bucket)s in the template, the bucket goes in the URL path
host_bucket = s3.example.com
use_https = True
bash
s3cmd ls s3://my-bucket/
s3cmd put ./report.pdf s3://my-bucket/reports/
s3cmd sync --dry-run ./public/ s3://my-bucket/site/
s3cmd signurl s3://my-bucket/reports/report.pdf +3600

Its sync compares size and MD5, only deletes in the destination with --delete-removed, and multipart uses 15 MB parts by default. It works well in older scripts and on servers that already have Python, but releases come far apart: check the date of the latest one on PyPI before betting on it for a new project.

The MinIO Client (mc) was born alongside the MinIO server and has short, Unix-style commands. Each provider becomes an alias:

bash
mc alias set storage https://s3.example.com "$S3_ACCESS_KEY" "$S3_SECRET_KEY"
mc ls storage/my-bucket
mc cp --recursive ./uploads/ storage/my-bucket/uploads/
mc mirror --dry-run ./public storage/my-bucket/site

mirror only deletes in the destination with --remove and has --watch to keep syncing. Two points weigh against it in a new project: MinIO archived the mc open source repository on GitHub (check there whether it ships releases again before depending on it), and the documentation says the client is tested against MinIO and AWS S3, with no guarantees for other compatible services. Its license is AGPLv3.

When should you use an SDK instead of the command line?#

Command line tools serve people and scripts. When the file is created inside your application (a user upload, a generated report, a processed image), use your language's SDK: boto3 in Python, @aws-sdk/client-s3 in JavaScript, or the AWS SDKs for Go, Java and .NET. All of them accept a custom endpoint and generate presigned URLs in code.

For large files, the JavaScript SDK has Upload from the @aws-sdk/lib-storage package, which handles multipart on its own (5 MB parts and 4 in parallel by default). Save it as upload.mjs and run it with node upload.mjs:

js
// npm install @aws-sdk/client-s3 @aws-sdk/lib-storage
import { createReadStream } from "node:fs";
import { S3Client } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";

const s3 = new S3Client({
  endpoint: process.env.S3_ENDPOINT, // omit it on AWS
  region: process.env.S3_REGION ?? "us-east-1",
  forcePathStyle: true, // bucket in the URL path
  credentials: {
    accessKeyId: process.env.S3_ACCESS_KEY,
    secretAccessKey: process.env.S3_SECRET_KEY,
  },
});

const upload = new Upload({
  client: s3,
  params: {
    Bucket: process.env.S3_BUCKET,
    Key: "videos/lesson.mp4",
    Body: createReadStream("lesson.mp4"),
    ContentType: "video/mp4",
  },
  partSize: 10 * 1024 * 1024, // 10 MB parts
  queueSize: 4, // 4 parts in parallel
});

upload.on("httpUploadProgress", (p) => console.log(`${p.loaded} bytes sent`));
await upload.done();
console.log("Upload complete");

In Python, boto3's upload_file does the same, with automatic multipart from 8 MB.

One detail applies to the aws-cli and every AWS SDK: they switched to calculating a CRC checksum on each upload by default, and not every compatible service accepts it. If uploads start failing after an update, set AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED and AWS_RESPONSE_CHECKSUM_VALIDATION=WHEN_REQUIRED in the environment. Key and signature errors have other causes, covered in AccessDenied and SignatureDoesNotMatch on S3.

How do the tools compare side by side?#

Criterion aws-cli rclone s3cmd mc SDK
Folder sync sync, deletes only with --delete sync deletes by default; copy doesn't sync, deletes with --delete-removed mirror, deletes with --remove you write the logic
Automatic multipart from 8 MB above 200 MiB 15 MB parts yes Upload (JS), upload_file (Python)
Custom endpoint --endpoint-url or AWS_ENDPOINT_URL_S3 endpoint on the remote host_base URL in alias set endpoint or endpoint_url
CI configuration environment variables environment variables .s3cfg file alias set with secrets environment variables
Services beyond S3 rest of AWS dozens no no rest of AWS
Maintenance active active infrequent releases repository archived active

Which one should you pick for each scenario?#

Scenario Recommendation
Upload or download files now and then aws-cli (cp, ls)
Publish a site's build folder to a bucket from CI aws-cli sync --delete or rclone sync, with a dry run first
Migrate a bucket from one provider to another rclone (sync source:bucket dest:bucket)
Scheduled copy of a server folder rclone copy plus check
User uploads inside the application your language's SDK
Generate temporary links SDK in code; aws s3 presign for a one-off link
Old script that already uses s3cmd keep it while it works; migrate when you need something new
Environment that already runs MinIO mc still works, but consider rclone or the aws-cli

When in doubt: the aws-cli for one-off commands and CI, rclone when the job is syncing or migrating, an SDK when the file is created in code. All three accept any compatible endpoint, so switching providers later is just configuration. For recurring copies, pair the tool with a scheduled job, as shown in backups to object storage. To run it in a pipeline, see automatic deploys with GitHub Actions.

How to do this on Square Cloud#

Square Cloud's Blob Storage has an S3-compatible API, so the aws-cli, rclone, boto3 and the AWS SDKs work with this article's commands after a configuration change only: endpoint https://s3-blob.squarecloud.app, region auto and the S3 keys you derive from an API key in the "S3 access" tab of the dashboard. For JavaScript there is also a dedicated Blob SDK, plus the REST API and the dashboard.

In the aws-cli, use AWS_ENDPOINT_URL_S3=https://s3-blob.squarecloud.app and AWS_DEFAULT_REGION=auto; in rclone, the same address in RCLONE_CONFIG_STORAGE_ENDPOINT and RCLONE_CONFIG_STORAGE_REGION=auto. There are three fixed buckets per account: public, private and legacy (read-only). Since you can't create named buckets, point the tools at public or private and organize files by prefix. If rclone fails while checking or creating the bucket, add --s3-no-check-bucket.

The endpoint supports List, Head, Get with Range, Put, Copy, Delete, multipart and SigV4 presigned URLs of up to 7 days. Each file can be up to 10 GB, and multipart is required above 100 MB. With their defaults, the aws-cli, boto3's upload_file and the JavaScript SDK's Upload split files long before that. rclone's default cutoff sits above that limit: if an upload of a few hundred MB is rejected, lower --s3-upload-cutoff below 100 MB. S3 requests are rate-limited per plan; if a large sync starts failing with too many requests, lower --transfers or max_concurrent_requests. There is no egress or ingress fee.

Explore Blob Storage

Blob Storage

S3-compatible object storage with no egress fees

Object storage

FAQs

What is the difference between aws s3 sync and rclone sync?

aws s3 sync uploads new or changed files and only deletes files missing from the source when you pass --delete. rclone sync makes the destination identical to the source and deletes extra files by default; to only copy, use rclone copy. Test both with --dryrun or --dry-run first.

Does the aws-cli work with storage that isn't AWS?

Yes, with any S3-compatible service. Pass --endpoint-url on each command or set the AWS_ENDPOINT_URL_S3 environment variable, and use the provider's keys and the region it tells you to use.

Is the MinIO Client (mc) still a good choice?

It works, but MinIO archived the mc open source repository on GitHub, and its documentation says the client is tested against MinIO and AWS S3, with no guarantees for other services. For a new project, rclone or the aws-cli are safer bets.

Why did uploads start failing after updating the aws-cli or an SDK?

The aws-cli and the AWS SDKs switched to calculating a CRC checksum on every upload by default, and not every S3-compatible service accepts it. Set AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED and AWS_RESPONSE_CHECKSUM_VALIDATION=WHEN_REQUIRED to restore the previous behavior.

Next articleWhere to store your Discord bot's images and filesStore your bot's files in object storage and the key in your database: Discord attachment links expire. Compare re-uploads, disk and database, with discord.js.

More in Storage

See all 24 articles