def update_dns_record()

in functions/source/UpdateDnsRecord/handler.py [0:0]


def update_dns_record(transition, replica_hostname, instance_ip):
  action = 'UPSERT' if transition == LAUNCHING_TRANSITION else 'DELETE'
  response = route53.change_resource_record_sets(
    HostedZoneId=HOSTED_ZONE_ID,
    ChangeBatch={
      'Changes': [
        {
          'Action': action,
          'ResourceRecordSet': {
            'Name': f'{replica_hostname}.{HOSTED_ZONE_NAME}',
            'Type': 'A',
            'TTL': 60,
            'ResourceRecords': [ { 'Value': instance_ip } ]
          }
        }
      ]
    }
  )
  print('successfully updated dns')