Created
July 11, 2018 16:06
-
-
Save yuji314159/8342d35561b1aa2aa35832df562ed05d to your computer and use it in GitHub Desktop.
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 characters
import gzip | |
import json | |
import boto3 | |
def lambda_handler(event, context): | |
bucket_name = event['Records'][0]['s3']['bucket']['name'] | |
object_key = event['Records'][0]['s3']['object']['key'] | |
s3 = boto3.client('s3') | |
res = s3.get_object(Bucket=bucket_name, Key=object_key) | |
log = json.loads(gzip.decompress(res['Body'].read()).decode('utf-8')) | |
print(json.dumps(log, indent=2)) | |
return log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment