Using S3 with the AWS CLI: connect, copy, sync
An online shop that takes 300 orders a day produces a database dump on its server every night, and that file needs to go somewhere outside the server. The AWS CLI is a common way to send files to S3-compatible storage from the command line. This article shows how to connect to your TreCloud S3 bucket with aws cli s3 commands, copy and sync files, and fix the errors you are most likely to see. The examples are for Ubuntu 24.04 and AWS CLI v2.

Installing AWS CLI v2
On Ubuntu, AWS's official package is the most trouble-free option. The commands below are for an x86_64 server:
sudo apt install -y unzip curl
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip awscliv2.zip
sudo ./aws/install
aws --version
Get the connection details from the client area under Hizmetlerim (My Services) › service › Yönetim (Manage) › Nesne depolama (Object storage). We explain each row in S3 access details and keys. Below, replace ACCESS_KEY, SECRET_KEY and kova-adi (bucket name) with your own values.
Creating a profile
Keeping the settings in a separate profile avoids confusion if you use other S3 accounts on the same machine. Create the profile; for the region, enter the value in the panel's Bölge (Region) row, and you can leave the output format empty:
aws configure --profile trecloud
# AWS Access Key ID: ACCESS_KEY
# AWS Secret Access Key: SECRET_KEY
# Default region name: (Region value from the panel)
# Default output format: (leave empty)
TreCloud S3 uses path-style addressing, and you must connect to its own endpoint. Write both to the profile:
aws configure set s3.addressing_style path --profile trecloud
aws configure set endpoint_url https://s3.trecloud.com.tr --profile trecloud
These two commands create the following section in ~/.aws/config. You can also edit the file by hand:
[profile trecloud]
region = BOLGE
endpoint_url = https://s3.trecloud.com.tr
s3 =
addressing_style = path
The aws configure set default.s3.addressing_style path line shown in the panel writes the same setting to the default profile; if you use only one account, that is enough. If an older AWS CLI version does not recognise endpoint_url in the profile, add --endpoint-url https://s3.trecloud.com.tr to every command or update the AWS CLI.
Listing, copying and syncing
Test the connection by listing the bucket:
aws s3 ls s3://kova-adi/ --profile trecloud
Use cp to send and retrieve a single file. Add --recursive to send a folder:
aws s3 cp /yedek/db-2026-11-24.sql.gz s3://kova-adi/veritabani/ --profile trecloud
aws s3 cp s3://kova-adi/veritabani/db-2026-11-24.sql.gz ./ --profile trecloud
aws s3 cp /yedek/belgeler s3://kova-adi/belgeler/ --recursive --profile trecloud
sync sends only changed files, which suits a nightly backup. First see what it would do with --dryrun:
aws s3 sync /yedek s3://kova-adi/sunucu1/ --dryrun --profile trecloud
aws s3 sync /yedek s3://kova-adi/sunucu1/ --profile trecloud
Be careful with --delete. With this option, sync also deletes files from the target that are not in the source. If a folder on the server is emptied by mistake, the copies in the bucket disappear the next night too. Versioning is not listed on the product card, so a deleted file does not come back. Do not use --delete for backups; manage old files by hand or with dated folders.
Troubleshooting
Checksum error
AWS CLI v2 releases since early 2025 send an extra data integrity checksum by default. Some S3-compatible servers may reject it. If an upload stops with an unexpected error, set these two environment variables and try again:
export AWS_REQUEST_CHECKSUM_CALCULATION=when_required
export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
In scripts run by cron, put these lines at the top of the script.
403 / AccessDenied
The most common cause is using the read key to upload. The read key can only download. For writes, make sure the profile holds the access key (the write key). If you generated a new write key, the old one is invalid; update the profile with aws configure --profile trecloud. A misspelled bucket name also causes an access error.
Quota full
When the limit is full, writing stops and reading continues. If uploads fail but listing and downloading work, check the used/limit gauge in the panel and click Şimdi ölç (Measure now) for a current value. Delete files you no longer need or choose a larger S3 object storage package.
Cannot connect to the endpoint
If the error message mentions amazonaws.com, the profile's endpoint is not being used. You may have forgotten --profile trecloud, or your AWS CLI version is old.
Frequently asked questions
Can I create a new bucket?
Each service gets one bucket. Instead of aws s3 mb, use folders (prefixes) inside your bucket.
Do the same commands work on Windows?
Yes, AWS CLI v2 uses the same commands on Windows. Just write file paths in Windows format.
Are my uploaded files stored encrypted?
The connection is encrypted over HTTPS (TLS). You can also encrypt files yourself before sending them; rclone crypt is one way to do that.
Related pages
Thanks for your feedback!