1

My requirement is to download files from S3 bucket on daily basis based on the date filter (ex: day=2018-07-14). We are successfully able to download using AWSCLI using the below code

aws s3 cp s3://<bucketname>/day=2018-07-14  local_dir --recursive

But I would want to download using Python script (may be boto3). Can anyone suggest what are the steps to be taken and mainly the configuration steps (I am using the windows machine) to download using .py scripts.

Thanks in advance.

ltd9938
  • 1,444
  • 1
  • 15
  • 29
Pradeep
  • 11
  • 2
  • 3
    If you are starting out, consider taking a look at this code sample for [downloading a file](https://boto3.readthedocs.io/en/latest/guide/s3-example-download-file.html#downloading-a-file). Also, read the documentation on querying by [S3 Objects](https://boto3.readthedocs.io/en/latest/reference/services/s3.html#object). – benSooraj Jul 23 '18 at 15:52
  • 2
    _WHY_ do you want to do it in Python? If the AWS CLI works for you, what additional benefit are you seeking? (By the way, the AWS CLI is written in Python too!) – John Rotenstein Jul 23 '18 at 23:15

1 Answers1

0
import boto3 

This will unlock the python functionality you desire: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html

Eric Nord
  • 4,674
  • 3
  • 28
  • 56