Yes, we have options to download all the objects from an S3 bucket to your local machine. Before we do, make sure that the AWS-CLI package is installed in your local machine and configured with credentials are Access Key and Secret Key.
Install AWS-CLI Package:
Download the awscliv2.zip file using the curl command and extract it.
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
Install the package using the command below,
$ sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin
After installed the package, check the version using the command below,
$ aws --version
Install AWS-CLI another method,
Alternatively, we have another option to install the awscli package which AWS recently released their Command Line Tools$ sudo easy_install awscli
or
$ sudo pip install awscli
run config command and set the IAM role/user credentials,
$ aws configure
We have two options to copy the objects from S3 bucket to local machine, "CP" and "SYNC" and formats are here,
$ aws s3 cp s3://<source_bucket> <local_destination> --recursive
$ aws s3 sync s3://<source_bucket> <local_destination>
$ aws s3 sync s3://<source_bucket> <local_destination>
So, now we use the commands below,
$ aws s3 cp s3://bucket_name/ . --recurisve
$ aws s3 sync s3://bucket_name/ .
If you use the Windows command prompt execute the command below,
$ aws s3 cp s3://bucket_name D:\destination --recursive
$ aws s3 sync s3://bucket_name/ D:\destination\
Comments (0)