import json
import boto3


def main(event, context):
    client = boto3.client("sns")
    client.create_topic(
        Name=event['userName']
    )
    client.subscribe(
        TopicArn='arn:aws:sns:us-east-1:025685231147:' + event['userName'],
        Protocol='email',
        Endpoint=event['request']['userAttributes']['email'],
    )

    return event
