Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
102 lines (102 sloc) 2.48 KB
{
"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"
}
}
}
}