in scripts/aware_failover.py [0:0]
def instance_dns_endpoint(current_endpoint, db_identifier):
writer_endpoint = None
# Is this an RDS endpoint?
if current_endpoint.endswith(".rds.amazonaws.com"):
# Split the DNS name
temp = current_endpoint.split(".")
# Build the new endpoint
temp[0] = db_identifier
temp[1] = temp[1].replace("cluster-", "")
temp[1] = temp[1].replace("ro-", "")
temp[1] = temp[1].replace("custom-", "")
# Validate endpoint
if len(temp[1]) != 12 or len(temp) != 6:
raise Exception("Nonconforming endpoint DNS name provided")
else:
writer_endpoint = ".".join(temp)
# Return writer endpoint
return writer_endpoint