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 8, 2020 in AWS by akhtar
• 38,260 points
2,647 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 8, 2020 by MD
• 95,460 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, 2020 in AWS by MD
• 95,460 points
4,418 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 8, 2020 in AWS by MD
• 95,460 points
8,271 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP