Skip to content

Instantly share code, notes, and snippets.

@cqsd
Last active March 4, 2019 07:09
Show Gist options
  • Save cqsd/fb374572fef4b79323321834713278c3 to your computer and use it in GitHub Desktop.
Save cqsd/fb374572fef4b79323321834713278c3 to your computer and use it in GitHub Desktop.
import json
import boto3
s3 = boto3.client('s3')
def lambda_handler(event, context):
# s3 trigger can have multiple records
for record in event['Records']:
bucket = record['s3']['bucket']['name']
obj_key = record['s3']['object']['key']
obj = s3.get_object(Bucket=bucket, Key=obj_key)
body = obj['Body']
print(body.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment