How to Bulk Download Files from Amazon S3 Bucket using the AWS CLI Command
In this tutorial, we will learn how to download multiple files from an Amazon S3 bucket to your local directory using the AWS CLI command.
- The first thing you'll need to do is, check if AWS CLI is installed on your computer using the following command:
- Open to edit the AWS credentials profile file on your local system which is located at:
- ~/.aws/credentials on Linux, Ubuntu, Mac, or Unix.
- C:\Users\username\.aws\credentials on Windows.
- Next, open a terminal and navigate to the directory where you want the s3 files to be downloaded, then execute the following command:
aws --version
Put the following AWS credentials in the AWS credentials profile file:
[default]
aws_access_key_id = YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
region= YOUR_AWS_REGION
Replace the values of aws_access_key_id, aws_secret_access_key, and region with your own AWS credentials.
aws s3 sync s3://bucket-name/folder-name .
The dot "." in the above command indicates the destination on your local system to which files should be downloaded from Amazon S3 bucket.