Open In App

How To Download Floder From AWS S3 CLI & UI ?

The AWS Simple Storage Service (S3) is a cloud service provided by Amazon Web Services (AWS) to store your data securely. There are different approaches to storing and retrieving data from AWS S3; one of them is by using AWS CLI provided by Amazon Web Services. In this article, we will provide you with step-by-step instructions on how to use AWS CLI download folders from Amazon S3 securely.

What Is Amazon S3?

Amazon S3 is a simple storage service provided by Amazon Web Services. It is highly durable and provides security and scalability to any kind of data. This data is stored as objects within resources called buckets.



Downloading Folder From Amazon S3

Create an AWS account and an IAM Role. Identity and Access Management (IAM) helps you secure the services you want to use by providing authentication and authorization as per your team’s requirements. Use the IAM role for accessing the S3 bucket data instead of directly using your main or root account.

Step 1: Create An Amazon S3 Bucket



Step 2: Configure The Amazon S3 Bucket

Step 3: Create Folder On Your Amazon S3 bucket

Step 4: Add files To Your Folder

Step 4: Configure AWS CLI

curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /

aws --version

aws configure

aws s3 ls

Step 5: Download Folder From Amazon S3

Download Entire S3 bucket

aws s3 sync s3://<bucket_name> .

Download A Specific Folder From The Amazon S3 bucket

aws s3 sync s3://<bucket_name>/<folder_name> .

aws s3 sync s3://<bucket_name>/<folder_name> <download_path>

In this way, you can downloaded the entire S3 bucket or specific folders from the S3 bucket using AWS CLI.

Amazon S3 – FAQ’s

What Operations Can You Perform On Aws S3 Using AWS CLI?

You can perform several operations on AWS S3 using AWS CLI including:

  • mb: Create a S3 bucket from the AWS CLI
  • cp: Copy a local file or S3 object to another location locally or in S3.
  • mv: Move a local file or S3 object to another location locally or in S3.
  • presign: Generate a pre-signed URL for an Amazon S3 object
  • rb: Delete an empty S3 bucket.
  • rm: Delete an S3 object.

How Do You Delete All Files Under A Specified Directory On The Amazon S3?

By using below command you can delete all files under a specified directory:

  aws s3 rm s3://my-bucket/path --recursive

How Do I Upload File From My Local Directory To Aws S3 Using AWS CLI?

On using below command you can upload files from my local directory:

  aws s3 cp /path/to/source s3://bucket-name/ --recursive

Which Command Returns List Of All Objects In A Bucket Recursively?

The following commands helps in returning list of all objects in a bucket recursively:

 aws s3 ls s3://<bucket_name> --recursive

Article Tags :