-2

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

greenking
  • 151
  • 3
  • 10
  • Probably best to download the aws cli and run it from the command line.https://stackoverflow.com/questions/27130448/how-to-access-a-file-on-amazon-s3-from-the-command-line – Daniel Lee Feb 14 '20 at 12:51
  • Does this answer your question? [How to access a file on Amazon S3 from the Command Line?](https://stackoverflow.com/questions/27130448/how-to-access-a-file-on-amazon-s3-from-the-command-line) – Daniel Lee Feb 14 '20 at 12:52
  • The requirement is to download via python boto3 script – greenking Feb 14 '20 at 12:55
  • https://aws.amazon.com/blogs/mobile/downloading-large-files-from-amazon-s3-with-the-aws-sdk-for-ios/ – error404 Feb 14 '20 at 13:12
  • https://stackoverflow.com/questions/37442444/download-s3-files-with-boto – Daniel Lee Feb 14 '20 at 13:18

1 Answers1

1

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')