def create_hosted_zone_record()

in create_managed_endpoint.py [0:0]


def create_hosted_zone_record(hzonename,recordname,recordvalue):
    #Update the private hosted zone and create the cname with writer endpoint

    try:
        hzid = hosted_zone_id(hzonename)

        responsedhzrec = dnsclient.change_resource_record_sets(
                        HostedZoneId = hzid,
                        ChangeBatch={
                            "Comment": "Switching endpoint on failover",
                            "Changes": [
                                {
                                    "Action": "CREATE",
                                    "ResourceRecordSet": {
                                        "Name": recordname,
                                        "Type": "CNAME",
                                        "TTL": 1,
                                        "ResourceRecords": [{"Value": recordvalue}]
                                    }
                                }
                            ]
                        }
                    )
                    
        # report cname update status. sucess retuns code 200.
        if (responsedhzrec['ResponseMetadata']['HTTPStatusCode']) == 200:
            print("Cname ",recordname,"Successfully created with endpoint ",recordvalue)
        else:
            print("Error updateing cnname")
    
    except ClientError as e:
        print(e)
        raise