Syncing a Server Folder with Amazon S3 Using the AWS CLI

Syncing a Server Folder with Amazon S3 Using the AWS CLI

aws s3 sync is a quick way to back up a folder to S3 or pull files back down, and it only transfers what has changed.

1. Configure a profile

aws configure

You will be asked for:

Access key ID
Secret access key
Region
Format

2. Upload to S3

aws s3 sync /var/www/pattofiles/ s3://bucketname

3. Download from S3

aws s3 sync s3://bucketname /var/www/pattofiles/

Use an IAM user or role limited to the one bucket, and add --delete only when you really want removed files to be deleted on the other side too.

Stuck on something similar? Our server and automation work team is happy to take a look.

Keep reading

Related articles

All articles

Need a hand?

Stuck on something similar?
We can fix it with you.

Send us the problem. A senior developer reads every message and replies within one working day.