I'm trying to use ansible to provision Route53 failover (although the fact I'm using ansible isn't particularly relevant).
I have this task that works:
- name: Route 53 Failover | Add ALIAS route53: command: create zone: "{{ top_level_domain }}" record: "{{ cname_record_domain }}" type: A alias: true alias_hosted_zone_id: "Z2FDTNDATAQYW2" value: "{{ cname_target_domain }}" wait: yes failover: SECONDARY identifier: "{{ cname_record_identifier }}" overwrite: true
The hard coded alias_hosted_zone_id
is the hosted zone of my cloudfront distribution. The only way to find this (that I'm aware of) is to choose the cloudfront distribution as an alias in the "Add record set" dialog of the Route53 console. It then states the hosted zone in the dialog.
What I would like to do is replace the hard coded string with a variable that is populated from an aws cli
command or ansible task. Is this possible?
If you want to use your own domain name, use Amazon Route 53 to create an alias record that points to your CloudFront distribution.
Yes, it is possible to use a Cloudfront distribution using a registrar other than AWS without a Route53 public hosted zone. You don't need Cloudflare to do it. You can create an Alias record with the subdomain and target in your registrar's control panel. The target would be something like dabcxyz.cloudfront.net.
You can use the Amazon Route 53 console to list all of the hosted zones that you created with the current AWS account. For information about how to list hosted zones using the Route 53 API, see ListHostedZones in the Amazon Route 53 API Reference.
CloudFront delivers your content through a worldwide network of data centers called edge locations. The regional edge caches are located between your origin web server and the global edge locations that serve content directly to your viewers.
For CloudFront distributions, the value is always Z2FDTNDATAQYW2
.
An actual citation from the Route 53 documentation itself proved more elusive than I expected -- there are (as of this writing) some search engine false-hits for this string (presumably there's some refactoring of the docs going on), but see, for example http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-aliastarget.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With