Skip to content
Permalink
master
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
{
"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"
}
}
}
}