简体   繁体   中英

downloading specific files resides in s3 subfolder into my local machine using boto3

I have a file resides in a s3 bucket subfolder. Bucket name "testbucket", folder name-"folder1". File name:"sample.csv". I want to download that into my local machine: "/Users/sameer/desktop/folder1".

What is the most efficient way to do download that if the file size is more than 3gb

Use the AWS CLI

aws s3 cp s3://testbucket/folder1/sample.csv /Users/sameer/desktop/folder1

if you must boto3:

import boto3

s3_client = boto3.client('s3')

s3_client.download_file('testbucket', 'folder1/sample.csv', '/Users/sameer/desktop/folder1/sample.csv')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM