Backing up Amazon S3 files to local storage
It’s always good to have a backup of all your files on local storage.
Usually, it’s an easy task.
But if you are using AWS it can be much harder than you expect.
This tutorial will show you how to backup the whole bucket from your AWS account to your local machine using the Command Line Interface (CLI), step by step.
Don’t worry, it’s pretty simple.
The result is you’ll be able to back up all of your Amazon S3 files to your local storage (as pictured in the screenshot below).
Table of Contents
What You’ll Need For This Tutorial
1 – AWS account
2 – AWS Command Line Interface
Configure Command Line Interface (CLI)
1.1 Open command-line interpreter.
1.2 – Enter “aws configure”
1.3 – After that you need to enter the following data:
=> AWS Access Key ID
=> AWS Secret Access Key
=> Default region name
=> Default output format
You can find how to get AWS Access Key ID and AWS Secret Access Key here.
The default region can be chosen by you.
I’ve entered up “us-east-1”.
Set default output format as “json”.
Configure local folder
2.1 – You need to choose a folder where you want to save your files.
To go to the subfolder you need to enter “cd FOLDERNAME”, to go back “cd ../”.
2.2 – When you choose the folder you will see it in command line.
3.1 – To backup files you need to enter “aws s3 sync s3://yourbucket .”
3.2 – After that you will see the backup process.
3.3 – Go to the folder you chose and check if all files were transferred.
You can now back up any bucket from your AWS server and get the files onto your local hard drive. 🙂