How to download S3 Objects With Python and Boto3?

0 votes

Hi Guys,

I am new to boto3. I want to download objects from the S3 bucket. How can I do that?

Oct 7 in AWS by akhtar
• 33,470 points
88 views

1 answer to this question.

0 votes

Hi@akhtar,

You can download one file from a specified S3 bucket. First, you have to create an S3 client using boto3.client as shown below.

import boto3
BUCKET_NAME = 'my_s3_bucket'
BUCKET_FILE_NAME = 'my_file.json'
LOCAL_FILE_NAME = 'downloaded.json'
def download_s3_file():
    s3 = boto3.client('s3')
    s3.download_file(BUCKET_NAME, BUCKET_FILE_NAME, LOCAL_FILE_NAME)
answered Oct 7 by MD
• 79,390 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to open S3 object as a string with Boto3?

Hi@akhtar, If you want to return a string, you ...READ MORE

answered Sep 21 in AWS by MD
• 79,390 points
66 views
0 votes
1 answer

How to download a file from S3 buckets using boto3?

Hi@akhtar, Boto3 supports upload_file() and download_file() APIs to ...READ MORE

answered Oct 7 in AWS by MD
• 79,390 points
148 views