How to Download All the Files in an AWS S3 Bucket?

Unfortunately AWS S3 Console doesn’t have an option to download all the content of an S3 bucket at the moment, but there are other options like AWS CLI to do so.

First you need to install the CLI with one of the following commands:

sudo pip install awscli

or

sudo easy_install awscli

Once installed, you can then use the following command:

aws s3 sync s3://<your_source_s3_bucket> <your_local_path>

For instance:

aws s3 sync s3://all_my_stuff_bucket . 

This command will start downloading all the objects in all_my_stuff_bucket to the current directory.

The output will looks something like this:

download: s3://all_my_stuff_bucket/file1.txt to file1.txt
download: s3://all_my_stuff_bucket/file2.txt to file2.txt
download: s3://all_my_stuff_bucket/file3.txt to file3.txt

Notes:

  1. This will not touch or change anything in your S3 bucket.

Interesting thing about this sync command is, you can use it to copy from one S3 bucket to another or from your local to an S3 bucket.

For more examples you can check the official documentation of this command here:

https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

If your bucket has many nested folders, you can download the whole folder recursively with the following command:

aws s3 cp s3://all_my_stuff_bucket/paths/child_fodlers local_folder --recursive

I found this “sync” CLI very useful for many use-cases, so I hope you find it useful too!

Cheers!