Created
October 17, 2018 22:41
Revisions
-
TonyFNZ created this gist
Oct 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #! /bin/python # This script will download a file from a URL and stream it directly # into AWS S3 without persisting the file to local disk. # File is streamed as it arrives, so memory usage is low (typically <100MB) import boto3, urllib2 source_url = 'http://<Your URL Here>' target_bucket = '<Target S3 Bucket Here>' target_key = '<Target S3 Filename/Key>' S3 = boto3.client('s3') file_data = urllib2.urlopen( source ) S3.upload_fileobj(file_data, target_bucket, target_key)