import json import boto3 def main(event, context): payload = event body = payload["body"] body = body.replace('\n', '') query = json.loads(body) client = boto3.resource('dynamodb', region_name="us-east-1") table = client.Table("AWSDynamoDB-g3") table.delete_item(Key={ 'id': query["id"], 'username': query["username"] }) resp = { "statusCode": 200, "headers": { "Access-Control-Allow-Origin": "*", }, "body": "El elemento fue eliminado." } return resp