Contents

Amazon S3 Auto Downloader

Ever been in a situation where you need to download tons of buckets from Amazon s3 and find the task tedious? Well here is a solution! This script will automaticly make a directory named after the bucket and start the sync right after the creation. No need to manually make a directory and change into it for the sync

1 Dependencies

2 The script

Before we begin we need to make a file where we store the name of all the buckets we want to sync to our local system. You can call it whatever you want to, but I called mine buckets. Inside the buckets file just put the name of your bucket and seperate them with a new line like so:

my-bucket-1
my-bucket-2
my-bucket-3

Then we can create the script, just call it something you think is nice. I picked autoDownload.sh

#!/bin/bash
while IFS= read -r line; do
   mkdir $line
   aws s3 sync s3://$line $line
done <buckets
Info
Remember to change buckets to whatever you named you file in the last step

Save the file and make it executable by: chmod +x autoDownload.sh

Success
That’s it! Just ./autoDownlaod.sh and sit back and drink your favorite drink while you watch it do it’s magic