How to use aws s3 sync from the CLI

0 votes
How do I use the aws s3 sync command to upload files from my local computer to S3?
Oct 24 in AWS by Priyanka
• 4,080 points
91 views

1 answer to this question.

0 votes
  • Basically, This command is used to sync files from a local directory to an S3 bucket or from one S3 bucket to another. The best part is it only copies new or modified files, making it more efficient.

  • Before you start, Check whether AWS CLI is installed and configured with the necessary permissions to access your S3 bucket.

  • The general syntax for the command looks like this:

image

  • If you want to sync a local folder to an S3 bucket, the command will look like this:

image

  • Replace /path/to/local/folder with your local directory path and your-bucket-name with the name of your S3 bucket.

  • To sync files from an S3 bucket to your local folder, you would use:

image

  • There are several options you can add to the sync command. For example, you might want to exclude certain files or include a dry run to see what would happen without making any changes. Here are a couple of useful options:

  • --dryrun: This simulates the command without making any changes. It’s great for testing.

image

  • --exclude: You can exclude specific files from being synced. For example, to exclude all .txt files:                image

Here’s how to use this command in AWS CLI. Want a deep dive into AWS S3? Click here for the full tutorial!

answered Oct 28 by Bhoomika

Related Questions In AWS

0 votes
1 answer

How to edit files in the AWS S3 bucket from CLI?

Hi@akhtar, According to my knowledge,  you can't edit ...READ MORE

answered Jun 8, 2020 in AWS by MD
• 95,460 points
9,685 views
0 votes
1 answer

How to download the latest file in a S3 bucket using AWS CLI?

You can use the below command $ aws ...READ MORE

answered Sep 6, 2018 in AWS by Archana
• 4,170 points
19,855 views
–1 vote
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 58,020 points
5,204 views
0 votes
0 answers
+1 vote
3 answers

How to get ARN for s3 Bucket using aws cli .

An ARN is a non-opaque, constructible identifier, ...READ MORE

answered Aug 16, 2018 in AWS by Priyaj
• 58,020 points
5,646 views
0 votes
1 answer

How to install ansible on amazon aws linux?

To install Ansible on Amazon AWS Linux, ...READ MORE

answered Oct 28 in AWS by anonymous
57 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP