AWS Lanbda Create a Route53 A Records Record

You can use the following Python AWS Lambda function to create/update an A Record in Route53:

import json
import boto3

route53 = boto3.client('route53')

def lambda_handler(event, context):
    print("Received event: " + json.dumps(event, indent=2))
    domain = event['domain']

            'Comment': 'Update or Insert an A Record',
            'Changes': [
                    'Action': 'UPSERT',
                    'ResourceRecordSet': {
                        'Name': domain,
                        'Type': 'A',
                        'SetIdentifier': domain,
                        'Region': 'region',
                        'ResourceRecords': [
                                'Value': ''
                        'TTL': 300


To do this, the Labda function must have the necessary rights for Route53.

The documentation is here.

The function can be tested with:

  "domain": ""