Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
amazon-web-services/cloudformation/templates/route53-dns-failover.json
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
102 lines (102 sloc)
2.48 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "'A' record to 'Alias' record DNS failover.", | |
"Parameters": { | |
"PrimaryRecord": { | |
"Type": "String", | |
"Description": "The primary record. A standard 'A' record to an IP address.", | |
"Default": "1.2.3.4" | |
}, | |
"SecondaryRecord": { | |
"Type": "String", | |
"Description": "The secondary record (fallback). An alias 'A' record to a CloudFront distribution." | |
}, | |
"DomainName": { | |
"Type": "String", | |
"Description": "The domain name.", | |
"Default": "example.com" | |
}, | |
"HealthCheckPath": { | |
"Type": "String", | |
"Description": "The URL to perform the health check against.", | |
"Default": "/index.html" | |
}, | |
"HostedZoneId": { | |
"Type": "String", | |
"Description": "The Route53 HostedZoneId to create these records in." | |
} | |
}, | |
"Resources": { | |
"HealthCheck": { | |
"Type": "AWS::Route53::HealthCheck", | |
"Properties": { | |
"HealthCheckConfig": { | |
"FailureThreshold": 3, | |
"IPAddress": { | |
"Ref": "PrimaryRecord" | |
}, | |
"FullyQualifiedDomainName": { | |
"Ref": "DomainName" | |
}, | |
"Port": 80, | |
"RequestInterval": 30, | |
"ResourcePath": { | |
"Ref": "HealthCheckPath" | |
}, | |
"Type": "HTTP" | |
}, | |
"HealthCheckTags": [ | |
{ | |
"Key": "Name", | |
"Value": { | |
"Ref": "DomainName" | |
} | |
} | |
] | |
} | |
}, | |
"ThePrimaryRecord": { | |
"Type": "AWS::Route53::RecordSet", | |
"Properties": { | |
"Failover": "PRIMARY", | |
"HealthCheckId": { | |
"Ref": "HealthCheck" | |
}, | |
"HostedZoneId": { | |
"Ref": "HostedZoneId" | |
}, | |
"Name": { | |
"Ref": "DomainName" | |
}, | |
"ResourceRecords": [ | |
{ | |
"Ref": "PrimaryRecord" | |
} | |
], | |
"SetIdentifier": "primary-record", | |
"TTL": "60", | |
"Type": "A" | |
} | |
}, | |
"TheSecondaryRecord": { | |
"Type": "AWS::Route53::RecordSet", | |
"Properties": { | |
"AliasTarget": { | |
"DNSName": { | |
"Ref": "SecondaryRecord" | |
}, | |
"HostedZoneId": "Z2FDTNDATAQYW2" | |
}, | |
"Failover": "SECONDARY", | |
"HostedZoneId": { | |
"Ref": "HostedZoneId" | |
}, | |
"Name": { | |
"Ref": "DomainName" | |
}, | |
"SetIdentifier": "secondary-record", | |
"Type": "A" | |
} | |
} | |
} | |
} |