Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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')
response = s3.delete_object(Bucket=bucket, Key=key)
except Exception as e:
raise e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment