Sync your AWS S3 to VPS using awscli on UBUNTU 18.04
Do you need to take backup of all of your file from Amazone AWS S3 bucket?
You can take backup in local machine as well on VPS too. In this article I’m using VPS with UBUNTU 18.04 for taking backup of S3 files to VPS.
here I use awscli.
Let’s start.
Need to install awscli.
sudo apt-get install awscli
Now check do you before save any configure about awscli ?
aws configure
if you get error like below then do not worry its all about default AWS cli credentials.
fatal error: Unable to locate credentials aws cli
Now here we setup credentials for S3 copy file to VPS.
So, We do not required about region.
aws configure set --profile YOUR_PROFILE_NAME [--profile YOUR_PROFILE_NAME] aws configure set aws_access_key_id YOUR_AWS_ACCESS_KEY aws configure set aws_secret_access_key YOUR_AWS_SECRET_KEY
if you are sync your EC2 or any other services using awscli then you must have to add region in your default configure.
aws configure set default.region us-west-2
Now Downloading a folder from a Bucket
Whereas the above example is how to download a full bucket, you can also download a folder recurively by performing
aws s3 cp s3://BUCKETNAME/PATH/TO/FOLDER LocalFolderName --recursive
OUTPUT
download: s3://BUCKETNAME/FILE.TXT to FILE.TXT
This will download all of your files (one-way sync). It will not delete any existing files in your current directory (unless you specify –delete), and it won’t change or delete any files on S3.
I hope you like this article. Keep visiting my website for more upcoming articles. If you need any help with Sync your AWS S3 to VPS using awscli on UBUNTU 18.04 you can contact me. You can ask me questions in comments also. You can connect me on social media as well links are below in the footer section. Keep connected. Happy Coding.