def create_failover_dns(self, primary_region='us-east-1'):
        """Create dns entries in route53 for multiregion failover setups.

        Args:
            primary_region (str): primary AWS region for failover
        Returns:
            Auto-generated DNS name.
        """
        dns_record = self.generated.dns()['global']
        zone_ids = get_dns_zone_ids(env=self.env, facing=self.elb_subnet)

        elb_dns_aws = find_elb(name=self.app_name, env=self.env, region=self.region)
        elb_dns_zone_id = find_elb_dns_zone_id(name=self.app_name, env=self.env, region=self.region)

        if primary_region in elb_dns_aws:
            failover_state = 'PRIMARY'
        else:
            failover_state = 'SECONDARY'
        self.log.info("%s set as %s record", elb_dns_aws, failover_state)

        self.log.info('Updating Application Failover URL: %s', dns_record)

        dns_kwargs = {
            'dns_name': dns_record,
            'elb_dns_zone_id': elb_dns_zone_id,
            'elb_aws_dns': elb_dns_aws,
            'dns_ttl': self.dns_ttl,
            'failover_state': failover_state,
        }

        for zone_id in zone_ids:
            self.log.debug('zone_id: %s', zone_id)
            update_failover_dns_record(self.env, zone_id, **dns_kwargs)

        return dns_record
def create_failover_dns ( self , primary_region = 'us-east-1' ) : dns_record = self . generated . dns ( ) [ 'global' ] zone_ids = get_dns_zone_ids ( env = self . env , facing = self . elb_subnet ) elb_dns_aws = find_elb ( name = self . app_name , env = self . env , region = self . region ) elb_dns_zone_id = find_elb_dns_zone_id ( name = self . app_name , env = self . env , region = self . region ) if primary_region in elb_dns_aws : failover_state = 'PRIMARY' else : failover_state = 'SECONDARY' self . log . info ( "%s set as %s record" , elb_dns_aws , failover_state ) self . log . info ( 'Updating Application Failover URL: %s' , dns_record ) dns_kwargs = { 'dns_name' : dns_record , 'elb_dns_zone_id' : elb_dns_zone_id , 'elb_aws_dns' : elb_dns_aws , 'dns_ttl' : self . dns_ttl , 'failover_state' : failover_state , } for zone_id in zone_ids : self . log . debug ( 'zone_id: %s' , zone_id ) update_failover_dns_record ( self . env , zone_id , ** dns_kwargs ) return dns_record
Create dns entries in route53 for multiregion failover setups.

        Args:
            primary_region (str): primary AWS region for failover
        Returns:
            Auto-generated DNS name.