# # This template demonstrates how to configure Amazon Route53 Failover record sets that use # Amazon Route53 Application Recovery Controller (ARC) healthchecks # # For a full description of how it works, please read # https://aws.amazon.com/fr/blogs/aws/amazon-route-53-application-recovery-controller/ # AWSTemplateFormatVersion: '2010-09-09' Description: 'This template creates Amazon Route53 DNS Failover Records with healthcheck for the Tic Tac Toe demo app' Parameters: VpcIdEast: Description: The VPC in region us-east-1 Type: String VpcIdWest: Description: The VPC in region us-west-2 Type: String VpcIdClient: Description: The VPC in region us-east-2 Type: String LoadBalancerDNSNameEast: Description: The load balancer DNS name in region us-east-1 Type: String LoadBalancerDNSNameWest: Description: The load balancer DNS name in region us-west-2 Type: String LoadBalancerHostedZoneEast: Description: The load balancer hosted zone id in us-east-1 Type: String LoadBalancerHostedZoneWest: Description: The load balancer hosted zone id in us-west-2 Type: String DNSDomainName: Description: The DNS domain name for that hosted zone ID Type: String DNSHealthcheckIdEast: Description: The DNS domain name for that hosted zone ID Type: String DNSHealthcheckIdWest: Description: The DNS domain name for that hosted zone ID Type: String ProjectId: AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*' ConstraintDescription: Must begin with a letter and contain only alphanumeric characters. Default: TicTacToe Description: The name of the project MaxLength: '64' MinLength: '1' Type: String Resources: PrivateZone: Type: "AWS::Route53::HostedZone" Properties: Name: !Ref DNSDomainName VPCs: - VPCId: !Ref VpcIdWest VPCRegion: 'us-west-2' - VPCId: !Ref VpcIdEast VPCRegion: 'us-east-1' - VPCId: !Ref VpcIdClient VPCRegion: 'us-east-2' # # The PRIMARY and SECONDARY failover DNS records. # These are A records as Aliases to the Load Balancer DNS name. # FrontEndAliasRecordPrimary: Type: AWS::Route53::RecordSet Properties: Comment: Failover Recordset to route traffic to the load balancer HostedZoneId: !Ref PrivateZone Name: !Sub ${ProjectId}.${DNSDomainName}. Type: A AliasTarget: DNSName: !Sub ${LoadBalancerDNSNameEast} EvaluateTargetHealth: true HostedZoneId: !Sub ${LoadBalancerHostedZoneEast} SetIdentifier: !Sub ${ProjectId}-east Failover: PRIMARY HealthCheckId: !Sub ${DNSHealthcheckIdEast} FrontEndAliasRecordSecondary: Type: AWS::Route53::RecordSet Properties: Comment: Failover Recordset to route traffic to the load balancer HostedZoneId: !Ref PrivateZone Name: !Sub ${ProjectId}.${DNSDomainName}. Type: A AliasTarget: DNSName: !Sub ${LoadBalancerDNSNameWest} EvaluateTargetHealth: true HostedZoneId: !Sub ${LoadBalancerHostedZoneWest} SetIdentifier: !Sub ${ProjectId}-west Failover: SECONDARY HealthCheckId: !Sub ${DNSHealthcheckIdWest} Outputs: DNSRecordName: Value: !Ref FrontEndAliasRecordSecondary