Wednesday 27 March 2019

How to download an entire S3 bucket to your local system by Raj Gupta

We've basically many options to do that, but the best one is using AWS CLI





  • Step 1
Download and install AWS CLI in your local machine as per operating system
In my case local operating system is Linux
[root@ip-172-31-88-124 ~]# sudo pip install --upgrade awscli
If you are using widow system then follow the below link


  • Step 2
Configure AWS CLI
[root@ip-172-31-88-124 ~]# aws configure
AWS Access Key ID [None]: AKIAJCJBWU2IWDKGCAMA    ----Enter your Access Key
AWS Secret Access Key [None]: sp6F/OOod2stGLmWi22hPTWDZ1dYLzWq/S2mMliu  ---Enter your Secret Access Key
Default region name [None]:   -----Press enter for default value 
Default output format [None]:  ----------Press enter for default value 

  • Step 3
In my S3 bucket(raj03272019) 2 files(pic1.png  pic2.png) are there and all files are going to download in  my local system at same time.




  • Step 4
Sync s3 bucket with following command

[root@ip-172-31-88-124 ~]# ls     
[root@ip-172-31-88-124 ~]#  aws s3 sync s3://raj03272019 /root
download: s3://raj03272019/pic1.png to ./pic1.png
download: s3://raj03272019/pic2.png to ./pic2.png
[root@ip-172-31-88-124 ~]# ls
pic1.png  pic2.png           ------both pic are downloaded to local system


s3://raj03272019 >> your s3 bucket that you want to download

/root >> path in your local system where you want to download all the files in my case I have downloaded all file under root but you can download any where you want.





No comments:

Post a Comment