s3cmd
Upload, download and sync files with s3cmd.
s3cmd is a free command-line tool for S3 storage. Use it to upload, download and sync files with your Zata buckets.
Before you start
- A bucket. See Create a bucket.
- An access key and secret key from the same region as the bucket. See Access keys.
Connection settings
Setting in ~/.s3cfg | Value |
|---|---|
host_base | idr01.zata.ai for Indore, bom01.zata.ai for Mumbai |
host_bucket | the same value as host_base, with nothing added |
bucket_location | us-east-1 |
access_key / secret_key | from Access Keys in the Zata console. The key must be from the same region as the bucket. |
use_https | True |
signature_v2 | False (Signature V4) |
Install s3cmd
On Ubuntu or Debian:
sudo apt install -y s3cmd
s3cmd --version
For other systems, see the s3cmd download page, or install it with pip install s3cmd.
Set up s3cmd
Write the configuration file yourself instead of using s3cmd --configure.
nano ~/.s3cfg
Replace the two keys with yours. Keep each setting on its own line.
[default]
access_key = YOUR_ACCESS_KEY
secret_key = YOUR_SECRET_KEY
host_base = idr01.zata.ai
host_bucket = idr01.zata.ai
bucket_location = us-east-1
use_https = True
signature_v2 = False
For Mumbai, replace both idr01.zata.ai with bom01.zata.ai.
Save with Ctrl+O and Enter, then close nano with Ctrl+X. Make the file readable only by you, because it contains your secret key:
chmod 600 ~/.s3cfg
Test it
Replace my-bucket with your bucket name:
echo "hello from s3cmd" > test.txt
s3cmd put test.txt s3://my-bucket/
s3cmd ls s3://my-bucket/
s3cmd get s3://my-bucket/test.txt ./downloaded-test.txt
s3cmd ls lists your buckets. A sub-user's key may show none; use the bucket name directly.
Upload or sync a folder
s3cmd put --recursive ./my-folder/ s3://my-bucket/my-folder/
s3cmd sync ./my-folder/ s3://my-bucket/my-folder/
sync uploads new and changed files. With --delete-removed, it also deletes files in Zata that are not in the local folder, so try it on a small folder first.
Troubleshooting
| Problem | Fix |
|---|---|
403 (SignatureDoesNotMatch) | Check the secret key, and that host_bucket is exactly idr01.zata.ai (or bom01.zata.ai). A value like idr01.zata.ai/%(bucket)s fails. |
403 (AccessDenied) | The key has no permission on that bucket. Ask the account owner. |
| SSL or connection error | Check that host_base matches your bucket's region and that use_https = True. |
For other errors, see Signature errors and Access denied.