Created
April 5, 2018 18:59
-
-
Save mbklein/ef433ba3830cced6a3204b9fa4d7039e to your computer and use it in GitHub Desktop.
Lambda for pushing URL to S3
This file contains 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 characters
import boto3 | |
import botocore.vendored.requests.packages.urllib3 as urllib3 | |
def lambda_handler(event, context): | |
url=event.url | |
bucket = event.s3_bucket_name | |
key = event.s3_key | |
s3=boto3.client('s3') | |
http=urllib3.PoolManager() | |
s3.upload_fileobj(http.request('GET', url,preload_content=False), bucket, key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment