at logo

Sync a directory with S3

Using the aws cli you can perform actions on S3, the most common is cp which copies a file or directory to an S3 bucket.

aws s3 cp ./dist s3://my-bucket --recursive

This will copy the dist folder and all its contents and sub folders.

Sync

The sync command is similar to cp but will only copy files that have changed. Useful for keeping a directory in sync with a bucket for backup or uploading any new files in a directory on a schedule.

aws s3 sync ./dist s3://my-bucket
timney.net
Site published