Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I sync two amazon buckets using the AWS CLI?

I'm using the AWS S3 CLI to sync two buckets, following the Amazon CLI S3 SYNC format specified in the documentation, as follows:

aws s3 sync s3://source_bucket s3://target_bucket --exclude *.tmp

Bug I get the following error:

A region must be specified --region or specifying the region in a configuration file or as an environment variable. Alternately, an endpoint can be specified with --endpoint-url

I have scoured the internet in addition to AWS CLI docs and find no reference to --region in the context of S3 SYNC. Any guidance would be appreciated!

Probably immaterial, but I am running Mac OS X Mavericks 10.9.1 on a MBPr (16GB RAM, 512GB SSD, quad-core)

like image 654
Jasper33 Avatar asked Jan 29 '14 11:01

Jasper33


People also ask

How does AWS CLI Sync work?

Sync objectsThe s3 sync command synchronizes the contents of a bucket and a directory, or the contents of two buckets. Typically, s3 sync copies missing or outdated files or objects between the source and target.

What is AWS sync command?

Description. Syncs directories and S3 prefixes. Recursively copies new and updated files from the source directory to the destination. Only creates folders in the destination if they contain one or more files.


1 Answers

You can set the AWS_DEFAULT_REGION environment variable.

export AWS_DEFAULT_REGION="us-east-1"
like image 104
mbdvg Avatar answered Nov 03 '22 10:11

mbdvg