1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17import boto3 import uuid def lambda_handler(event, context): dynamodb=boto3.resource("dynamodb","eu-west-1") table=dynamodb.Table("todo-table") table.put_item( ConditionExpression="attribute_not_exists(id)", Item={ "id" : str(uuid.uuid4()), "task" : event["task"] } ) return { 'statusCode': 200 }