Created
June 2, 2016 13:46
-
-
Save dagrz/4a9348e00b3f7b46bce6dbfe661bb054 to your computer and use it in GitHub Desktop.
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 json | |
import urllib | |
import boto3 | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
bucket = event['Records'][0]['s3']['bucket']['name'] | |
key = urllib.unquote_plus(event['Records'][0]['s3']['object']['key']).decode('utf8') | |
try: | |
response = s3.delete_object(Bucket=bucket, Key=key) | |
except Exception as e: | |
print(e) | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment