GithubHelp home page GithubHelp logo

octodns-route53's Introduction

octoDNS Logo

DNS as code - Tools for managing DNS across multiple providers

In the vein of infrastructure as code octoDNS provides a set of tools & patterns that make it easy to manage your DNS records across multiple providers. The resulting config can live in a repository and be deployed just like the rest of your code, maintaining a clear history and using your existing review & workflow.

The architecture is pluggable and the tooling is flexible to make it applicable to a wide variety of use-cases. Effort has been made to make adding new providers as easy as possible. In the simple case that involves writing of a single class and a couple hundred lines of code, most of which is translating between the provider's schema and octoDNS's. More on some of the ways we use it and how to go about extending it below and in the /docs directory.

Table of Contents

Getting started

Workspace

Running through the following commands will install the latest release of octoDNS and set up a place for your config files to live. To determine if provider specific requirements are necessary see the providers table below.

$ mkdir dns
$ cd dns
$ python -m venv env
...
$ source env/bin/activate
# provider-specific-requirements would be things like: octodns-route53 octodns-azure
$ pip install octodns <provider-specific-requirements>
$ mkdir config

Installing a specific commit SHA

If you'd like to install a version that has not yet been released in a repeatable/safe manner you can do the following. In general octoDNS is fairly stable in between releases thanks to the plan and apply process, but care should be taken regardless.

$ pip install -e git+https://[email protected]/octodns/octodns.git@<SHA>#egg=octodns

Config

We start by creating a config file to tell octoDNS about our providers and the zone(s) we want it to manage. Below we're setting up a YamlProvider to source records from our config files and both a Route53Provider and DynProvider to serve as the targets for those records. You can have any number of zones set up and any number of sources of data and targets for records for each. You can also have multiple config files, that make use of separate accounts and each manage a distinct set of zones. A good example of this this might be ./config/staging.yaml & ./config/production.yaml. We'll focus on a config/production.yaml.

Dynamic Zone Config

octoDNS supports dynamically building the list of zones it will work with when source providers support it. The most common use of this would be with YamlProvider and a single dynamic entry to in effect use the files that exist in the provider's directory as the source of truth. Other providers may support the list_zones method and be available to populate zones dynamically as well. This can be especially useful when using octodns-dump to create an initial setup from an existing provider.

An example config would look something like:

---
providers:
  config:
    class: octodns.provider.yaml.YamlProvider
    directory: ./config
    default_ttl: 3600
    enforce_order: True
  ns:
    class: octodns_ns1.Ns1Provider
    api_key: env/NS1_API_KEY
  route53:
    class: octodns_route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_SECRET_ACCESS_KEY

zones:
  # This is a dynamic zone config. The source(s), here `config`, will be
  # queried for a list of zone names and each will dynamically be set up to
  # match the dynamic entry.
  '*':
    sources:
      - config
    targets:
      - ns1
      - route53

Static Zone Config

In cases where finer grained control is desired and the configuration of individual zones varies zones can be an explicit list with each configured zone listed along with its specific setup. As exemplified below alias zones can be useful when two zones are exact copies of each other, with the same configuration and records. YAML anchors are also helpful to avoid duplication where zones share config, but not records.

---
manager:
  include_meta: True
  max_workers: 2

providers:
  config:
    class: octodns.provider.yaml.YamlProvider
    directory: ./config
    default_ttl: 3600
    enforce_order: True
  ns:
    class: octodns_ns1.Ns1Provider
    api_key: env/NS1_API_KEY
  route53:
    class: octodns_route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_SECRET_ACCESS_KEY

zones:
  example.com.: &dual_target
    sources:
      - config
    targets:
      - ns1
      - route53

  # these have the same setup as example.com., but will have their own files
  # in the configuration directory for records.
  third.tv.: *dual_target
  fourth.tv.: *dual_target

  example.net.:
    # example.net. is an exact copy of example.com., there will not be an
    # example.net.yaml file in the config directory as `alias` includes
    # duplicating the records of the aliased zone along with its config.
    alias: example.com.

  other.com.:
    lenient: True
    sources:
      - config
    targets:
      - ns1

General Configuration Concepts

class is a special key that tells octoDNS what python class should be loaded. Any other keys will be passed as configuration values to that provider. In general any sensitive or frequently rotated values should come from environmental variables. When octoDNS sees a value that starts with env/ it will look for that value in the process's environment and pass the result along.

Further information can be found in the docstring of each source and provider class.

The include_meta key in the manager section of the config controls the creation of a TXT record at the root of a zone that is managed by octoDNS. If set to True, octoDNS will create a TXT record for the root of the zone with the value provider=<target-provider>. If not specified, the default value for include_meta is False.

The max_workers key in the manager section of the config enables threading to parallelize the planning portion of the sync.

Quick Example Record

Now that we have something to tell octoDNS about our providers & zones we need to tell it about our records. We'll keep it simple for now and just create a single A record at the top-level of the domain.

config/example.com.yaml

---
'':
  ttl: 60
  type: A
  values:
    - 1.2.3.4
    - 1.2.3.5

Further information can be found in Records Documentation.

Noop

We're ready to do a dry-run with our new setup to see what changes it would make. Since we're pretending here we'll act like there are no existing records for example.com. in our accounts on either provider.

$ octodns-sync --config-file=./config/production.yaml
...
********************************************************************************
* example.com.
********************************************************************************
* route53 (Route53Provider)
*   Create <ARecord A 60, example.com., [u'1.2.3.4', '1.2.3.5']>
*   Summary: Creates=1, Updates=0, Deletes=0, Existing Records=0
* dyn (DynProvider)
*   Create <ARecord A 60, example.com., [u'1.2.3.4', '1.2.3.5']>
*   Summary: Creates=1, Updates=0, Deletes=0, Existing Records=0
********************************************************************************
...

There will be other logging information presented on the screen, but successful runs of sync will always end with a summary like the above for any providers & zones with changes. If there are no changes a message saying so will be printed instead. Above we're creating a new zone in both providers so they show the same change, but that doesn't always have to be the case. If, to start, one of them had a different state, you would see the changes octoDNS intends to make to sync them up.

Making changes

WARNING: octoDNS assumes ownership of any domain you point it to. When you tell it to act it will do whatever is necessary to try and match up states including deleting any unexpected records. Be careful when playing around with octoDNS. It's best to experiment with a fake zone or one without any data that matters until you're comfortable with the system.

Now it's time to tell octoDNS to make things happen. We'll invoke it again with the same options and add a --doit on the end to tell it this time we actually want it to try and make the specified changes.

$ octodns-sync --config-file=./config/production.yaml --doit
...

The output here would be the same as before with a few more log lines at the end as it makes the actual changes. After which the config in Route53 and Dyn should match what's in the yaml file.

Workflow

In the above case we manually ran octoDNS from the command line. That works and it's better than heading into the provider GUIs and making changes by clicking around, but octoDNS is designed to be run as part of a deploy process. The implementation details are well beyond the scope of this README, but here is an example of the workflow we use at GitHub. It follows the way GitHub itself is branch deployed.

The first step is to create a PR with your changes.

GitHub user interface of a pull request

Assuming the code tests and config validation statuses are green the next step is to do a noop deploy and verify that the changes octoDNS plans to make are the ones you expect.

Output of a noop deployment command

After that comes a set of reviews. One from a teammate who should have full context on what you're trying to accomplish and visibility into the changes you're making to do it. The other is from a member of the team here at GitHub that owns DNS, mostly as a sanity check and to make sure that best practices are being followed. As much of that as possible is baked into octodns-validate.

After the reviews it's time to branch deploy the change.

Output of a deployment command

If that goes smoothly, you again see the expected changes, and verify them with dig and/or octodns-report you're good to hit the merge button. If there are problems you can quickly do a .deploy dns/main to go back to the previous state.

Bootstrapping config files

Very few situations will involve starting with a blank slate which is why there's tooling built in to pull existing data out of providers into a matching config file.

$ octodns-dump --config-file=config/production.yaml --output-dir=tmp/ example.com. route53
2017-03-15T13:33:34  INFO  Manager __init__: config_file=tmp/production.yaml
2017-03-15T13:33:34  INFO  Manager dump: zone=example.com., sources=('route53',)
2017-03-15T13:33:36  INFO  Route53Provider[route53] populate:   found 64 records
2017-03-15T13:33:36  INFO  YamlProvider[dump] plan: desired=example.com.
2017-03-15T13:33:36  INFO  YamlProvider[dump] plan:   Creates=64, Updates=0, Deletes=0, Existing Records=0
2017-03-15T13:33:36  INFO  YamlProvider[dump] apply: making changes

The above command pulled the existing data out of Route53 and placed the results into tmp/example.com.yaml. That file can be inspected and moved into config/ to become the new source. If things are working as designed a subsequent noop sync should show zero changes.

Note that a Dynamic Zone Config and be really powerful in combination with octodns-dump allowing you to quickly create a set of octoDNS zone files for all the zones configured in your sources.

$ octodns-dump --config-file=config/production.yaml --output-dir=tmp/ '*' route53
...

It is important to review any WARNING log lines printed out during an octodns-dump invocation as it will give you information about records that aren't supported fully or at all by octoDNS and thus won't be exact matches or included in the dumps. Generally records that cannot be converted are either of a type that octoDNS does not support or those that include "dynamic" functionality that doesn't match octoDNS's behaviors.

Providers

The table below lists the providers octoDNS supports. They are maintained in their own repositories and released as independent modules.

Provider Module Notes
Akamai Edge DNS octodns_edgedns
Amazon Route 53 octodns_route53
Azure DNS octodns_azure
BIND, AXFR, RFC-2136 octodns_bind
Cloudflare DNS octodns_cloudflare
Constellix octodns_constellix
DigitalOcean octodns_digitalocean
DNS Made Easy octodns_dnsmadeeasy
DNSimple octodns_dnsimple
Dyn (deprecated) octodns_dyn
easyDNS octodns_easydns
EdgeCenter DNS octodns_edgecenter
/etc/hosts octodns_etchosts
Gandi octodns_gandi
G-Core Labs DNS octodns_gcore
Google Cloud DNS octodns_googlecloud
Hetzner DNS octodns_hetzner
Mythic Beasts DNS octodns_mythicbeasts
NS1 octodns_ns1
OVHcloud DNS octodns_ovh
PowerDNS octodns_powerdns
Rackspace octodns_rackspace
Scaleway octodns_scaleway
Selectel octodns_selectel
SPF Value Management octodns_spf
TransIP octodns_transip
UltraDNS octodns_ultra
YamlProvider built-in Supports all record types and core functionality

Updating to use extracted providers

  1. Include the extracted module in your python environment, e.g. if using Route53 that would require adding the octodns_route53 module to your requirements.txt, setup.py, or similar.
  2. Update the class value for your provider to the new path, e.g. again for Route53 that would be replacing octodns.provider.route53.Route53Provider with octodns_route53.Route53Provider

The module required and provider class path for extracted providers can be found in the table above.

Sources

Similar to providers, but can only serve to populate records into a zone, cannot be synced to.

Source Record Support Dynamic Notes
EnvVarSource TXT No read-only environment variable injection
AxfrSource A, AAAA, CAA, CNAME, LOC, MX, NS, PTR, SPF, SRV, TXT No read-only
ZoneFileSource A, AAAA, CAA, CNAME, MX, NS, PTR, SPF, SRV, TXT No read-only
TinyDnsFileSource A, CNAME, MX, NS, PTR No read-only

Notes

  • ALIAS support varies a lot from provider to provider care should be taken to verify that your needs are met in detail.
    • Dyn's UI doesn't allow editing or view of TTL, but the API accepts and stores the value provided, this value does not appear to be used when served
    • Dnsimple's uses the configured TTL when serving things through the ALIAS, there's also a secondary TXT record created alongside the ALIAS that octoDNS ignores
  • octoDNS itself supports non-ASCII character sets, but in testing Cloudflare is the only provider where that is currently functional end-to-end. Others have failures either in the client libraries or API calls

Processors

Processor Description
AcmeMangingProcessor Useful when processes external to octoDNS are managing acme challenge DNS records, e.g. LetsEncrypt
AutoArpa See Automatic PTR generation below
EnsureTrailingDots Processor that ensures ALIAS, CNAME, DNAME, MX, NS, PTR, and SRVs have trailing dots
ExcludeRootNsChanges Filter that errors or warns on planned root/APEX NS records changes.
IgnoreRootNsFilter Filter that IGNORES root/APEX NS records and prevents octoDNS from trying to manage them (where supported.)
MetaProcessor Adds a special meta record with timing, UUID, providers, and/or version to aid in debugging and monitoring.
NameAllowlistFilter Filter that ONLY manages records that match specified naming patterns, all others will be ignored
NameRejectlistFilter Filter that IGNORES records that match specified naming patterns, all others will be managed
ValueAllowlistFilter Filter that ONLY manages records that match specified value patterns based on rdata_text, all others will be ignored
ValueRejectlistFilter Filter that IGNORES records that match specified value patterns based on rdata_text, all others will be managed
OwnershipProcessor Processor that implements ownership in octoDNS so that it can manage only the records in a zone in sources and will ignore all others.
SpfDnsLookupProcessor Processor that checks SPF values for violations of DNS query limits
TtlRestrictionFilter Processor that restricts the allow TTL values to a specified range or list of specific values
TypeAllowlistFilter Filter that ONLY manages records of specified types, all others will be ignored
TypeRejectlistFilter Filter that IGNORES records of specified types, all others will be managed
octodns-spf SPF Value Management for octoDNS

Automatic PTR generation

octoDNS supports automatically generating PTR records from the A/AAAA records it manages. For more information see the auto-arpa documentation.

Compatibility and Compliance

lenient

lenient mostly focuses on the details of Records and standards compliance. When set to true octoDNS will allow non-compliant configurations & values where possible. For example CNAME values that don't end with a ., label length restrictions, and invalid geo codes on dynamic records. When in lenient mode octoDNS will log validation problems at WARNING and try and continue with the configuration or source data as it exists. See Lenience for more information on the concept and how it can be configured.

strict_supports

strict_supports is a Provider level parameter that comes into play when a provider has been asked to create a record that it is unable to support. The simplest case of this would be record type, e.g. SSHFP not being supported by AzureProvider. If such a record is passed to an AzureProvider as a target the provider will take action based on the strict_supports. When true it will throw an exception saying that it's unable to create the record, when set to false it will log at WARNING with information about what it's unable to do and how it is attempting to work around it. Other examples of things that cannot be supported would be dynamic records on a provider that only supports simple or the lack of support for specific geos in a provider, e.g. Route53Provider does not support NA-CA-*.

It is worth noting that these errors will happen during the plan phase of things so that problems will be visible without having to make changes.

This concept is currently a work in progress and only partially implemented. While work is on-going strict_supports will default to false. Once the work is considered complete & ready the default will change to true as it's a much safer and less surprising default as what you configure is what you'll get unless an error is thrown telling you why it cannot be done. You will then have the choice to explicitly request that things continue with work-arounds with strict_supports set to false. In the meantime it is encouraged that you manually configure the parameter to true in your provider configs.

Configuring strict_supports

The strict_supports parameter is available on all providers and can be configured in YAML as follows:

providers:
  someprovider:
    class: whatever.TheProvider
    ...
    strict_supports: true

Custom Sources and Providers

You can check out the source and provider directory to see what's currently supported. Sources act as a source of record information. AxfrSource and TinyDnsFileSource are currently the only OSS sources, though we have several others internally that are specific to our environment. These include something to pull host data from gPanel and a similar provider that sources information about our network gear to create both A & PTR records for their interfaces. Things that might make good OSS sources might include an ElbSource that pulls information about AWS Elastic Load Balancers and dynamically creates CNAMEs for them, or Ec2Source that pulls instance information so that records can be created for hosts similar to how our GPanelProvider works.

Most of the things included in octoDNS are providers, the obvious difference being that they can serve as both sources and targets of data. We'd really like to see this list grow over time so if you use an unsupported provider then PRs are welcome. The existing providers should serve as reasonable examples. Those that have no GeoDNS support are relatively straightforward. Unfortunately most of the APIs involved to do GeoDNS style traffic management are complex and somewhat inconsistent so adding support for that function would be nice, but is optional and best done in a separate pass.

The class key in the providers config section can be used to point to arbitrary classes in the python path so internal or 3rd party providers can easily be included with no coordination beyond getting them into PYTHONPATH, most likely installed into the virtualenv with octoDNS.

For examples of building third-party sources and providers, see Related Projects & Resources.

Other Uses

Syncing between providers

While the primary use-case is to sync a set of yaml config files up to one or more DNS providers, octoDNS has been built in such a way that you can easily source and target things arbitrarily. As a quick example the config below would sync githubtest.net. from Route53 to Dyn.

---
providers:
  route53:
    class: octodns.provider.route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_SECRET_ACCESS_KEY
  dyn:
    class: octodns.provider.dyn.DynProvider
    customer: env/DYN_CUSTOMER
    username: env/DYN_USERNAME
    password: env/DYN_PASSWORD

zones:

  githubtest.net.:
    sources:
      - route53
    targets:
      - dyn

Dynamic sources

Internally we use custom sources to create records based on dynamic data that changes frequently without direct human intervention. An example of that might look something like the following. For hosts this mechanism is janitorial, run periodically, making sure the correct records exist as long as the host is alive and ensuring they are removed after the host is destroyed. The host provisioning and destruction processes do the actual work to create and destroy the records.

---
providers:
  gpanel-site:
    class: github.octodns.source.gpanel.GPanelProvider
    host: 'gpanel.site.github.foo'
    token: env/GPANEL_SITE_TOKEN
  powerdns-site:
    class: octodns.provider.powerdns.PowerDnsProvider
    host: 'internal-dns.site.github.foo'
    api_key: env/POWERDNS_SITE_API_KEY

zones:

  hosts.site.github.foo.:
    sources:
      - gpanel-site
    targets:
      - powerdns-site

Contributing

Please see our contributing document if you would like to participate!

Getting help

If you have a problem or suggestion, please open an issue in this repository, and we will do our best to help. Please note that this project adheres to the Contributor Covenant Code of Conduct.

Related Projects and Resources

If you know of any other resources, please do let us know!

License

octoDNS is licensed under the MIT license.

The MIT license grant is not for GitHub's trademarks, which include the logo designs. GitHub reserves all trademark and copyright rights in and to all GitHub trademarks. GitHub's logos include, for instance, the stylized designs that include "logo" in the file title in the following folder: https://github.com/octodns/octodns/tree/main/docs/logos/

GitHubยฎ and its stylized versions and the Invertocat mark are GitHub's Trademarks or registered Trademarks. When using GitHub's logos, be sure to follow the GitHub logo guidelines.

Authors

octoDNS was designed and authored by Ross McFarland and Joe Williams. See https://github.com/octodns/octodns/graphs/contributors for a complete list of people who've contributed.

octodns-route53's People

Contributors

allen-pattern avatar bencaron avatar hugovk avatar javajawa avatar jmittermair avatar jonnangle avatar mochipon avatar nodomain avatar rasturic avatar ross avatar solvaholic avatar stokkie90 avatar uduncanu avatar viranch avatar yzguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

octodns-route53's Issues

ALIAS record dump issue

Dumped a zone with an ALIAS record.

With version 0.0.5, the dumped zone contains the evaluate-target-health and hosted-zone-id elements (using a dash).
Running a sync with the unmodified dumped zone completes correctly with no changes.

With version 0.0.5+b10ce65c (latest version), the dumped zone contains the evaluate_target_health and hosted_zone_id elements (using an underscore).
Running a sync with the unmodified dumped zone fails with validation error service alias without hosted-zone-id.

See below for the full outputs.

WORKING CORRECTLY with octodns_route53 0.0.5:

% octodns-dump --config-file=config/production.yaml --output-dir=config/ 'mytest.com.' route53
2023-10-16T22:06:44  [140704378021632] INFO  Manager __init__: config_file=config/production.yaml, (octoDNS 1.2.1)
2023-10-16T22:06:44  [140704378021632] INFO  Manager _config_executor: max_workers=1
2023-10-16T22:06:44  [140704378021632] INFO  Manager _config_include_meta: include_meta=False
2023-10-16T22:06:44  [140704378021632] INFO  Manager _config_auto_arpa: auto_arpa=False
2023-10-16T22:06:44  [140704378021632] INFO  Manager __init__: global_processors=[]
2023-10-16T22:06:44  [140704378021632] INFO  Manager __init__: global_post_processors=[]
2023-10-16T22:06:44  [140704378021632] INFO  Manager __init__: provider=config (octodns.provider.yaml 1.2.1)
2023-10-16T22:06:44  [140704378021632] INFO  botocore.credentials Found credentials in environment variables.
2023-10-16T22:06:44  [140704378021632] INFO  Manager __init__: provider=route53 (octodns_route53 0.0.5)
2023-10-16T22:06:44  [140704378021632] INFO  Manager dump: zone=mytest.com., output_dir=config/, output_provider=None, lenient=False, split=False, sources=['route53']
2023-10-16T22:06:44  [140704378021632] INFO  Manager dump: using custom YamlProvider
2023-10-16T22:06:45  [140704378021632] INFO  Route53Provider[route53] populate:   found 2 records, exists=True
2023-10-16T22:06:45  [140704378021632] INFO  YamlProvider[dump] plan: desired=mytest.com.
2023-10-16T22:06:45  [140704378021632] INFO  YamlProvider[dump] plan:   Creates=2, Updates=0, Deletes=0, Existing Records=0
2023-10-16T22:06:45  [140704378021632] INFO  YamlProvider[dump] apply: making 2 changes to mytest.com.


% cat config/mytest.com.yaml                                                                  
---
? ''
: ttl: 172800
  type: NS
  values:
  - test.co.uk.
  - test.com.
  - test.net.
  - test.org.
myalias:
  ttl: 942942942
  type: Route53Provider/ALIAS
  value:
    evaluate-target-health: false
    hosted-zone-id: Z2FDTNDATAQYW2
    name: xxx.cloudfront.net.
    type: A


% octodns-sync --config-file=config/production.yaml 
2023-10-16T22:07:18  [140704378021632] INFO  Manager __init__: config_file=config/production.yaml, (octoDNS 1.2.1)
2023-10-16T22:07:18  [140704378021632] INFO  Manager _config_executor: max_workers=1
2023-10-16T22:07:18  [140704378021632] INFO  Manager _config_include_meta: include_meta=False
2023-10-16T22:07:18  [140704378021632] INFO  Manager _config_auto_arpa: auto_arpa=False
2023-10-16T22:07:18  [140704378021632] INFO  Manager __init__: global_processors=[]
2023-10-16T22:07:18  [140704378021632] INFO  Manager __init__: global_post_processors=[]
2023-10-16T22:07:18  [140704378021632] INFO  Manager __init__: provider=config (octodns.provider.yaml 1.2.1)
2023-10-16T22:07:18  [140704378021632] INFO  botocore.credentials Found credentials in environment variables.
2023-10-16T22:07:18  [140704378021632] INFO  Manager __init__: provider=route53 (octodns_route53 0.0.5)
2023-10-16T22:07:18  [140704378021632] INFO  Manager sync: eligible_zones=[], eligible_targets=[], dry_run=True, force=False, plan_output_fh=<stdout>
2023-10-16T22:07:18  [140704378021632] INFO  Manager sync:   zone=mytest.com.
2023-10-16T22:07:18  [140704378021632] INFO  Manager sync:   sources=['config']
2023-10-16T22:07:18  [140704378021632] INFO  Manager sync:   targets=['route53']
2023-10-16T22:07:18  [140704378021632] INFO  YamlProvider[config] populate:   found 2 records, exists=False
2023-10-16T22:07:18  [140704378021632] INFO  Route53Provider[route53] plan: desired=mytest.com.
2023-10-16T22:07:19  [140704378021632] INFO  Route53Provider[route53] populate:   found 2 records, exists=True
2023-10-16T22:07:19  [140704378021632] INFO  Route53Provider[route53] plan:   No changes
2023-10-16T22:07:19  [140704378021632] INFO  Plan 
********************************************************************************
No changes were planned
********************************************************************************

NOT WORKING CORRECTLY with octodns_route53 0.0.5+b10ce65c

% octodns-dump --config-file=config/production.yaml --output-dir=config/ 'mytest.com.' route53
2023-10-16T22:12:28  [140704378021632] INFO  Manager __init__: config_file=config/production.yaml, (octoDNS 1.2.1)
2023-10-16T22:12:28  [140704378021632] INFO  Manager _config_executor: max_workers=1
2023-10-16T22:12:28  [140704378021632] INFO  Manager _config_include_meta: include_meta=False
2023-10-16T22:12:28  [140704378021632] INFO  Manager _config_auto_arpa: auto_arpa=False
2023-10-16T22:12:28  [140704378021632] INFO  Manager __init__: global_processors=[]
2023-10-16T22:12:28  [140704378021632] INFO  Manager __init__: global_post_processors=[]
2023-10-16T22:12:28  [140704378021632] INFO  Manager __init__: provider=config (octodns.provider.yaml 1.2.1)
2023-10-16T22:12:28  [140704378021632] INFO  Route53Provider[route53] __init__: id=route53, access_key_id=None, max_changes=1000, delegation_set_id=None, get_zones_by_name=False
2023-10-16T22:12:28  [140704378021632] INFO  botocore.credentials Found credentials in environment variables.
2023-10-16T22:12:28  [140704378021632] INFO  Manager __init__: provider=route53 (octodns_route53 0.0.5+b10ce65c)
2023-10-16T22:12:28  [140704378021632] INFO  Manager dump: zone=mytest.com., output_dir=config/, output_provider=None, lenient=False, split=False, sources=['route53']
2023-10-16T22:12:28  [140704378021632] INFO  Manager dump: using custom YamlProvider
2023-10-16T22:12:29  [140704378021632] INFO  Route53Provider[route53] populate:   found 2 records, exists=True
2023-10-16T22:12:29  [140704378021632] INFO  YamlProvider[dump] plan: desired=mytest.com.
2023-10-16T22:12:29  [140704378021632] INFO  YamlProvider[dump] plan:   Creates=2, Updates=0, Deletes=0, Existing Records=0
2023-10-16T22:12:29  [140704378021632] INFO  YamlProvider[dump] apply: making 2 changes to mytest.com.


% cat config/mytest.com.yaml                                                                  
---
? ''
: ttl: 172800
  type: NS
  values:
  - test.co.uk.
  - test.com.
  - test.net.
  - test.org.
myalias:
  ttl: 942942942
  type: Route53Provider/ALIAS
  value:
    evaluate_target_health: false
    hosted_zone_id: Z2FDTNDATAQYW2
    name: xxx.cloudfront.net.
    type: A


% octodns-sync --config-file=config/production.yaml
2023-10-16T22:13:05  [140704378021632] INFO  Manager __init__: config_file=config/production.yaml, (octoDNS 1.2.1)
2023-10-16T22:13:05  [140704378021632] INFO  Manager _config_executor: max_workers=1
2023-10-16T22:13:05  [140704378021632] INFO  Manager _config_include_meta: include_meta=False
2023-10-16T22:13:05  [140704378021632] INFO  Manager _config_auto_arpa: auto_arpa=False
2023-10-16T22:13:05  [140704378021632] INFO  Manager __init__: global_processors=[]
2023-10-16T22:13:05  [140704378021632] INFO  Manager __init__: global_post_processors=[]
2023-10-16T22:13:05  [140704378021632] INFO  Manager __init__: provider=config (octodns.provider.yaml 1.2.1)
2023-10-16T22:13:06  [140704378021632] INFO  Route53Provider[route53] __init__: id=route53, access_key_id=None, max_changes=1000, delegation_set_id=None, get_zones_by_name=False
2023-10-16T22:13:06  [140704378021632] INFO  botocore.credentials Found credentials in environment variables.
2023-10-16T22:13:06  [140704378021632] INFO  Manager __init__: provider=route53 (octodns_route53 0.0.5+b10ce65c)
2023-10-16T22:13:06  [140704378021632] INFO  Manager sync: eligible_zones=[], eligible_targets=[], dry_run=True, force=False, plan_output_fh=<stdout>
2023-10-16T22:13:06  [140704378021632] INFO  Manager sync:   zone=mytest.com.
2023-10-16T22:13:06  [140704378021632] INFO  Manager sync:   sources=['config']
2023-10-16T22:13:06  [140704378021632] INFO  Manager sync:   targets=['route53']
Traceback (most recent call last):
  File "/private/tmp/dns-latest/env/bin/octodns-sync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/cmds/sync.py", line 57, in main
    manager.sync(
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/manager.py", line 694, in sync
    ps, d = future.result()
            ^^^^^^^^^^^^^^^
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/manager.py", line 60, in result
    return self.func(*self.args, **self.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/manager.py", line 439, in _populate_and_plan
    source.populate(zone, lenient=lenient)
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/provider/yaml.py", line 362, in populate
    self._populate_from_file(source, zone, lenient)
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/provider/yaml.py", line 314, in _populate_from_file
    record = Record.new(
             ^^^^^^^^^^^
  File "/private/tmp/dns-latest/env/lib/python3.11/site-packages/octodns/record/base.py", line 82, in new
    raise ValidationError(fqdn, reasons, context)
octodns.record.exception.ValidationError: Invalid record "myalias.mytest.com.", ./config/mytest.com.yaml, line 11, column 3
  - service alias without hosted-zone-id

Public and Private DNS in Route53

Am I missing step somewhere? How to distinguish between the public and private hosted zone types in Route53?

We have a single domain for both public and private, the data within is obviosuly very different. We'd like to migrate away from RoadWorker and possible use OctoDNS. When I run octodns-dump it only grabs the private data, not the public. How do you grab both, and ultimately manage and sync both from separate config files?

Thanks

Does OctoDNS handle weighted Route53 records?

Hello OctoDNS,

I'm testing it and it's working great!

I'm wondering if OctoDNS handles weighted Route53 records?

For example, I created 2 records:

Record Name           Type      Routing Policy   Differentiator           Value         Record Id
test1.domain.com      A       Weighted                 100                192.169.0.1       (datacenter1)
test1.domain.com      A       Weighted                 0                 192.169.0.2       (datacenter2)
  1. I can't find a way to generate the right YAML.
  2. I used "octodns-dump" in order to dump the 2 records and shows how the Yaml was generetad but the command nevers dumped the records with "weighted".
    If my zone has 5 records, octodns-dump sees only 3 records:
INFO  Route53Provider[route53] populate:   found 3 records, exists=True
INFO  YamlProvider[dump] plan:   Creates=3, Updates=0, Deletes=0, Existing Records=0

Thanks for your help!

Handle R53 'Alias' Records

Route53 Alias records are kinda like CNAME records, but you can have them at the Apex, which as you can imagine isn't going to translate between providers very well.

They also have a different response for list-resource-record-sets (example below)

{
    "ResourceRecordSets": [
        {
            "AliasTarget": {
                "HostedZoneId": "Z1EXAMPLE",
                "EvaluateTargetHealth": false,
                "DNSName": "s3-website-ap-southeast-2.amazonaws.com."
            },
            "Type": "A",
            "Name": "example.com."
        },
        {
            "ResourceRecords": [
                {
                    "Value": "127.0.0.1"
                }
            ],
            "Type": "A",
            "Name": "test.example.com.",
            "TTL": 300
        },

See the AWS Documentation for more info on Alias records

octodns doesn't handle this gracefully, and will throw a KeyError

(env) โ˜  dns  octodns-dump --config-file=./config/production.yaml --output-dir=./tmp example.com. route53 --debug
2017-04-30T20:17:19  [139951851439872] INFO  Manager __init__: config_file=./config/production.yaml
2017-04-30T20:17:19  [139951851439872] DEBUG Manager __init__:   configuring providers
2017-04-30T20:17:19  [139951851439872] DEBUG Route53Provider[route53] __init__: id=route53, access_key_id=***, secret_access_key=***
2017-04-30T20:17:19  [139951851439872] DEBUG Route53Provider[route53] __init__: id=route53, apply_disabled=False
2017-04-30T20:17:19  [139951851439872] INFO  Manager dump: zone=example.com., sources=()
2017-04-30T20:17:19  [139951851439872] DEBUG YamlProvider[dump] __init__: id=dump, directory=./tmp, default_ttl=3600
2017-04-30T20:17:19  [139951851439872] DEBUG YamlProvider[dump] __init__: id=dump, apply_disabled=False
2017-04-30T20:17:19  [139951851439872] DEBUG Manager configured_sub_zones: subs=[]
2017-04-30T20:17:19  [139951851439872] DEBUG Zone __init__: zone=Zone<example.com.>, sub_zones=set([])
2017-04-30T20:17:19  [139951851439872] DEBUG Route53Provider[route53] populate: name=example.com.
2017-04-30T20:17:19  [139951851439872] DEBUG Route53Provider[route53] _get_zone_id: name=example.com.
2017-04-30T20:17:19  [139951851439872] DEBUG Route53Provider[route53] r53_zones: loading
2017-04-30T20:17:20  [139951851439872] DEBUG Route53Provider[route53] _get_zone_id:   id=/hostedzone/Z3IUOSSN6JQ0DU
2017-04-30T20:17:20  [139951851439872] DEBUG Route53Provider[route53] _load_records: zone_id=/hostedzone/Z3IUOSSN6JQ0DU loading
Traceback (most recent call last):
  File "/tmp/dns/env/bin/octodns-dump", line 11, in <module>
    sys.exit(main())
  File "/tmp/dns/env/local/lib/python2.7/site-packages/octodns/cmds/dump.py", line 28, in main
    manager.dump(args.zone, args.output_dir, *args.source)
  File "/tmp/dns/env/local/lib/python2.7/site-packages/octodns/manager.py", line 330, in dump
    source.populate(zone)
  File "/tmp/dns/env/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 365, in populate
    data = getattr(self, '_data_for_{}'.format(record_type))(rrset)
  File "/tmp/dns/env/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 235, in _data_for_geo
    'values': [v['Value'] for v in rrset['ResourceRecords']],
KeyError: u'ResourceRecords'
(env) โ˜  dns

Octodns does one change at a time

Hi!
I just started using Octodns and I came to a problem. I have a bunch of zones and many of them have CNAMEs with no dot at the end. I dumped all the records with --lenient, added trailing dots everywhere but the problem is - when I apply these changes, it changes only one record at a time:

โฏ octodns-sync --config-file zones/_config.yml myzone.com. --target route53 --force --doit --debug
...
2022-12-04T22:07:28  [140143402022720] INFO  Manager sync:   11 total changes

โฏ octodns-sync --config-file zones/_config.yml myzone.com. --target route53 --force --doit --debug
...
2022-12-04T22:08:34  [140034002523968] INFO  Manager sync:   10 total changes

โฏ octodns-sync --config-file zones/_config.yml myzone.com. --target route53 --force --doit --debug
...
2022-12-04T22:09:27  [140107546101568] INFO  Manager sync:   9 total changes

Even with the --debug flag I see no errors or anything. I thought maybe the request contains only one record and so I went patching Route53's _really_apply method to print batch. Apparently, this is not the case since all 8 entries were there:

2022-12-04T22:19:04  [140442529761088] INFO  Route53Provider[route53] _apply:   sending change request for batch of 8 mods, 8 ResourceRecords
[
  {
    "Action": "UPSERT",
    "ResourceRecordSet": {
      "Name": "*.foo.myzone.com",
      "ResourceRecords": [
        {
          "Value": "test.myzone.com"
        }
      ],
      "TTL": 3600,
      "Type": "CNAME"
    }
  },
  ... skipped 6 identical entries
  {
    "Action": "UPSERT",
    "ResourceRecordSet": {
      "Name": "amazonses-eu.myzone.com",
      "ResourceRecords": [
        {
          "Value": "10 feedback-smtp.eu-central-1.amazonses.com."
        }
      ],
      "TTL": 3600,
      "Type": "MX"
    }
  }
]
2022-12-04T22:19:04  [140442529761088] DEBUG Route53Provider[route53] _really_apply:   sending change request, comment=Change: 54fcb03a40ec4c00af42c78449973a3e
2022-12-04T22:19:04  [140442529761088] DEBUG urllib3.connectionpool https://route53.amazonaws.com:443 "POST /2013-04-01/hostedzone/Z01231241214Z6V/rrset/ HTTP/1.1" 200 342
2022-12-04T22:19:04  [140442529761088] DEBUG Route53Provider[route53] _really_apply:   change info={'Id': '/change/C04804732OXR51RNSQD3Y', 'Status': 'PENDING', 'SubmittedAt': datetime.datetime(2022, 12, 4, 19, 19, 4, 465000, tzinfo=tzutc()), 'Comment': 'Change: 54fcb03a40ec4c00af42c78449973a3e'}

Not sure where to look next. Is this a bug?

Regression with `lenient` setting for multi-answer PTR record

Hello!

I'm seeing a regression in version octodns==1.0.0rc0 when processing PTR records that have multiple values (typically not conventional but in this case my data source does have these and I believe it's still "technically allowed").

Versions:

octodns==1.0.0.rc0
octodns-route53=0.0.5

manager config:

zones:
  test.ntat.io.:
    lenient: True
    sources:
      - targetyaml
    targets:
      - route53

test.ntat.io.yaml:

  • picked up from targetyaml source
a:
  type: A
  values:
  - 1.1.1.1
  - 2.2.2.2
ptr:
  type: PTR
  values:
  - 1.1.1.1.
  - 2.2.2.2.

Logs:

Failure on 1.0.0rc0

  File "/var/task/octodns/manager.py", line 629, in sync
    ps, d = future.result()
  File "/var/task/octodns/manager.py", line 70, in result
    return self.func(*self.args, **self.kwargs)
  File "/var/task/octodns/manager.py", line 449, in _populate_and_plan
    plan = target.plan(zone, processors=processors)
  File "/var/task/octodns/provider/base.py", line 239, in plan
    desired = self._process_desired_zone(desired)
  File "/var/task/octodns_route53/__init__.py", line 1197, in _process_desired_zone
    return super(Route53Provider, self)._process_desired_zone(desired)
  File "/var/task/octodns/provider/base.py", line 147, in _process_desired_zone
    self.supports_warn_or_except(msg, fallback)
  File "/var/task/octodns/provider/base.py", line 219, in supports_warn_or_except
    raise SupportsException(f'{self.id}: {msg}')
octodns.provider.SupportsException: route53: multi-value PTR records not supported for ptr.test.ntat.io.

Successful fallback on 0.9.21

WARNING:Route53Provider[route53]:multi-value PTR records not supported for ptr.test.ntat.io.; falling back to single value, 1.1.1.1.
WARNING:Route53Provider[route53]:root NS record supported, but no record is configured for test.ntat.io.
INFO:Route53Provider[route53]:root NS record in existing, but not supported or not configured; ignoring it
INFO:Route53Provider[route53]:plan:   Creates=2, Updates=0, Deletes=0, Existing Records=0
INFO:Plan:
********************************************************************************
* test.ntat.io.
********************************************************************************
* route53 (Route53Provider)
*   Create <ARecord A 3600, a.test.ntat.io., ['1.1.1.1', '2.2.2.2']> (targetyaml)
*   Create <PtrRecord PTR 3600, ptr.test.ntat.io., ['1.1.1.1.']> (targetyaml)
*   Summary: Creates=2, Updates=0, Deletes=0, Existing Records=0
********************************************************************************

AwsAcmMangingProcessor can't be referenced

I'm not sure if this is the only piece missing, but the setup.py in this module should be using the same find_packages() function as in the main octodns repository here

Without this, octodns_route53.processor is missing from the packages and therefore can't be referenced for usage.

Feature Request: Add DS record support to octodns-route53

Hi Ross & Team.

Lack of DS record support is the only thing blocking me from migrating a few of our zones from a custom script over to octodns. All of our other zones are working well with octodns/route53 and we enjoy using it. I'd rather use octodns over my custom script.

With respect to supporting DNSEC-enabled subdomains, DS record values are essentially text records.

Is there a particular reason support was omitted or just a matter of finding someone to do it?

Thanks!

Add IRSA support

For now access_key_id and secret_access_key are mandatory when configuring octodns_route53.Route53Provider. But we want to avoid using bare AWS credentials and use IAM role for service account to interact with Route53 since OctoDNS deployed in our EKS cluster - https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html

As I see provider using boto3 so it should be possible out of the box because when IRSA used all important environment variables are injected in container:

        - name: AWS_STS_REGIONAL_ENDPOINTS
          value: regional
        - name: AWS_DEFAULT_REGION
          value: us-east-1
        - name: AWS_REGION
          value: us-east-1
        - name: AWS_ROLE_ARN
          value: >-
            arn:aws:iam::xxx:role/xxx
        - name: AWS_WEB_IDENTITY_TOKEN_FILE
          value: /var/run/secrets/eks.amazonaws.com/serviceaccount/token

Route53: character limit of 32000 exceeded

I'm trying to sync from dyn to r53. However, this domain have about 2266 records. I'm getting the following error. Our other domains have similar amount of records.

ERROR OUTPUT

2017-06-22T11:58:04  [140736484107200] INFO  Route53Provider[route53] _apply: zone=xyz.net., len(changes)=2266
2017-06-22T11:58:04  [140736484107200] INFO  Route53Provider[route53] _apply:   sending change request for batch of 976 mods, 999 ResourceRecords
Traceback (most recent call last):
  File "/Users/aikram1271/Desktop/CodingStuff/DNS-Automation/octodns/env/bin/octodns-sync", line 11, in <module>
    load_entry_point('octodns==0.8.0', 'console_scripts', 'octodns-sync')()
  File "build/bdist.macosx-10.12-x86_64/egg/octodns/cmds/sync.py", line 39, in main
  File "build/bdist.macosx-10.12-x86_64/egg/octodns/manager.py", line 295, in sync
  File "build/bdist.macosx-10.12-x86_64/egg/octodns/provider/base.py", line 143, in apply
  File "build/bdist.macosx-10.12-x86_64/egg/octodns/provider/route53.py", line 661, in _apply
  File "build/bdist.macosx-10.12-x86_64/egg/octodns/provider/route53.py", line 684, in _really_apply
  File "/Users/aikram1271/Desktop/CodingStuff/DNS-Automation/octodns/env/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/aikram1271/Desktop/CodingStuff/DNS-Automation/octodns/env/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidChangeBatch: An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: RDATA character limit of 32000 exceeded.```

Need to add a space before ";" (semi-colon)?

Hello,

I'm trying to add a DMARC TXT and I always have "unescaped ;".

TEST 1

Input:

_dmarc:
  - type: TXT
    value: 'v=DMARC1; p=quarantine'

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 2

Input:

_dmarc:
  - type: TXT
    value: "v=DMARC1; p=quarantine"

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 3

Input:

_dmarc:
  - type: TXT
    value: "v=DMARC1\; p=quarantine"

Result:

yaml.scanner.ScannerError: while scanning a double-quoted scalar found unknown escape character ';'

TEST 4

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1; p=quarantine

Result:

unescaped ; in "v=DMARC1; p=quarantine"

TEST 5

So I tried with an escaping "" before the ";":

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1\; p=quarantine

Result:

['v=DMARC1\; p=quarantine']> (config)

TEST 6

But there is the "" which is not great. ;)

Input:

_dmarc:
  - type: TXT
    value: v=DMARC1\; p=quarantine

Result:

['v=DMARC1\; p=quarantine']> (config)

What am I doing wrong?

Thanks.

Latency Routing Policy

Working with a company that use OctoDNS to manage their Route53 DNS, we are wanting to implement latency based routing.

Is this supported? Cant see any mention of it in the documentation.

Have you got a full list of supported features including the correct syntaxes to use in the configuration files?

Updating to 0.0.5 breaks previously existing ALIAS records

I had our pipelines pulling the latest version of providers and we had not made any DNS changes since May.

We recently raised some changes and ran the plan to find that showed all of our ALIAS records set for deletion. Even after trying to octodns-dump the records they were still skipped: [4305765760] WARNING YamlProvider[dump] Route53Provider/ALIAS records not supported for cdn.*****.com.; omitting record

Where as usually we would get: [4345644416] WARNING Route53Provider[route53] cdn.****.com. is an Alias record. Skipping... and the record would be skipped.

I am unsure if I would have to add these records in manually(which we have hundreds and would take a very long time) or I am missing something in config here.

An example of the plan output that occurs to all our ALIAS records when running with 0.0.5:

Delete | ****** | Route53Provider/ALIAS | 942942942 | "******.amazonaws.com." A *****
-- | -- | -- | -- | --

I obviously haven't tested if this actually deletes them since I have no intention of deleting them. But also haven't tested this in an isolated environment.

So for now we are pinning to version 0.0.4 which will skip ALIAS records.

OctoDNS bug when deleting domainkeys on Route53

In Route53 domainkeys appear to get pulled as multiple strings - eg.
"k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+kQV0ao2xYF2eMb2YjjLWD7CoRg1oW+WugpnONbTXlEYOMGMIOHW7JV8aHBJ5ArE07sYAYq0JpxUrokjhLS4whiyb0VqFcKP3BHbhR" "awlP4v/52ZD1JgxLadC3vuuPXD4GYNBl0wvedUcpgnn5r/q76eZKmaEM6HkjLLoje77qnHYHvzdjPf/MEp0" "gbtGnHPAIB9uUN+Ij+AAIdIKqMBGLg/xOnz+rkr9l64yaBcRBz2NXQHd9Ac+sZNfSM/zvpUPE5xvAK3vYhoGKVdYPEUHrUGZxkh1LFmCjucoM92O4bBWHqDJc2y8xuXD222Rr8tKV6fAYZvSX1MY4vLJoOA1QIDAQAB"

The domainkey had been previously created as a single string through Octo.

The error received from Octo on deletion is :

When botocore.errorfactory.InvalidChangeBatch: An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: [Tried to delete resource record set [name='mailo._domainkey.xxxxxxx.com.', type='TXT'] but the values provided do not match the current values, Tried to delete resource record set [name='pic._domainkey.system.xxxxxxx.com.', type='TXT'] but the values provided do not match the current values]

Temporary workaround was to delete the keys manually.

TCP health check failure

Hey, we're looking at using OctoDNS to load balance two network load balancers in AWS.

I have the following configuration:

graphite:
  dynamic:
    pools:
      eu:
        values:
          - value: example.elb.eu-central-1.amazonaws.com.
          - value: example.elb.eu-west-1.amazonaws.com.
    rules:
      - pool: eu
  octodns:
    healthcheck:
      port: 2003
      protocol: TCP
    route53:
      healthcheck:
        failure_threshold: 3
        measure_latency: false
        request_interval: 10
  ttl: 60
  type: CNAME
  value: example.elb.eu-west-1.amazonaws.com.

And I get the following error when running octodns-sync --doit:

2022-10-21T09:54:20  [4331390336] DEBUG Manager sync:   checking safety
2022-10-21T09:54:20  [4331390336] DEBUG Manager sync:   applying
2022-10-21T09:54:20  [4331390336] INFO  Route53Provider[route53] apply: making 1 changes to example.com.
2022-10-21T09:54:20  [4331390336] INFO  Route53Provider[route53] _apply: zone=example.com., len(changes)=1
2022-10-21T09:54:20  [4331390336] DEBUG Route53Provider[route53] _get_zone_id: name=example.com.
2022-10-21T09:54:20  [4331390336] DEBUG Route53Provider[route53] _get_zone_id:   id=/hostedzone/Z3RY1PKX3DW9IJ
2022-10-21T09:54:20  [4331390336] DEBUG Route53Provider[route53] get_health_check_id: fqdn=graphite.example.com., type=CNAME, value=example.elb.eu-central-1.amazonaws.com., status=obey
2022-10-21T09:54:20  [4331390336] DEBUG Route53Provider[route53] health_checks: loading
2022-10-21T09:54:21  [4331390336] DEBUG urllib3.connectionpool https://route53.amazonaws.com:443 "GET /2013-04-01/healthcheck HTTP/1.1" 200 80260
2022-10-21T09:54:21  [4331390336] DEBUG urllib3.connectionpool https://route53.amazonaws.com:443 "GET /2013-04-01/healthcheck?marker=805c7fd0-c1c9-4232-8307-418dfdc84869 HTTP/1.1" 200 62828
2022-10-21T09:54:21  [4331390336] DEBUG urllib3.connectionpool https://route53.amazonaws.com:443 "POST /2013-04-01/healthcheck HTTP/1.1" 400 356
Traceback (most recent call last):
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/bin/octodns-sync", line 8, in <module>
    sys.exit(main())
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns/cmds/sync.py", line 57, in main
    manager.sync(
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns/manager.py", line 653, in sync
    total_changes += target.apply(plan)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns/provider/base.py", line 245, in apply
    self._apply(plan)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 1819, in _apply
    mods = mod_type(c, zone_id, existing_rrsets)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 1578, in _mod_Create
    new_records = self._gen_records(change.new, zone_id, creating=True)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 1574, in _gen_records
    return _Route53Record.new(self, record, zone_id, creating)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 199, in new
    ret = cls._new_dynamic(provider, record, hosted_zone_id, creating)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 140, in _new_dynamic
    _Route53DynamicValue(
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 515, in __init__
    self.health_check_id = provider.get_health_check_id(
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/octodns_route53/__init__.py", line 1501, in get_health_check_id
    resp = self._conn.create_health_check(
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/botocore/client.py", line 514, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/samuel.parkinson/.local/share/virtualenvs/dns-mTNxZbUA/lib/python3.10/site-packages/botocore/client.py", line 938, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidInput: An error occurred (InvalidInput) when calling the CreateHealthCheck operation: Invalid parameter : TCP IPv4 health checks must have either IP address or fully qualified domain name specified.

And running octodns-sync without the --doit argument is successful and the plan looks like:

********************************************************************************
* example.com.
********************************************************************************
* route53 (Route53Provider)
*   Create <CnameRecord CNAME 60, graphite.example.com., example.elb.eu-west-1.amazonaws.com., {'eu': {'fallback': None, 'values': [{'value': 'example.elb.eu-central-1.amazonaws.com.', 'weight': 1, 'status': 'obey'}, {'value': 'example.elb.eu-west-1.amazonaws.com.', 'weight': 1, 'status': 'obey'}]}}, [{'pool': 'eu'}]> (config)
*   Summary: Creates=1, Updates=0, Deletes=0, Existing Records=4
********************************************************************************

Seems like the logic below assumes that a TCP type check will have an IP address as a value?

if healthcheck_protocol != 'TCP':
config['FullyQualifiedDomainName'] = healthcheck_host
config['ResourcePath'] = healthcheck_path
if value:
config['IPAddress'] = value

And just to check such a health check can be made in Route 53:

Screenshot 2022-10-21 at 10 03 55

Does Octodns-route53 support sub-domain NS records

Does OctoDNS supports sub domain NS records?

for example.com i have subdomain email.example.com and config file as below however I can't see it is getting created in Route53 and other records are in place.
under config/example.com.yaml i have like below
where I also have other record type of txt with same name!

email:
ttl: 300
type: NS
values:
- a.ns.campaign.adobe.com.
- b.ns.campaign.adobe.com.
- c.ns.campaign.adobe.com.
- d.ns.campaign.adobe.com.
email:
  ttl: 30
  type: TXT
  value: "google.com"

Edit: @ross added yaml quotes so that things would ~format

Single domain that is both public and private in Route53

I have been poking at this off and on for a few months, and I wasn't sure if it was an octoDNS issue or a me issue.

We have a single domain set as two hosted zones in Route53, one public and one private. When attempting an octodns-dump against the domain, octoDNS is throwing an error about an empty geo value. There are no geo records set for either hosted zone.

config:

---
providers:
  config:
    class: octodns.provider.yaml.YamlProvider
    directory: ./data
  route53:
    class: octodns.provider.route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_SECRET_ACCESS_KEY

zones:
  sillydomain.com.:
    sources:
      - route53
    targets:
      - config

octodns-dump debug output:

2018-02-06T09:50:14  [140736519537600] INFO  Manager __init__: config_file=config/ro_config_route53.yaml
2018-02-06T09:50:14  [140736519537600] INFO  Manager __init__:   max_workers=1
2018-02-06T09:50:14  [140736519537600] INFO  Manager __init__:   max_workers=False
2018-02-06T09:50:14  [140736519537600] DEBUG Manager __init__:   configuring providers
2018-02-06T09:50:14  [140736519537600] DEBUG YamlProvider[config] __init__: id=config, directory=./data, default_ttl=3600, enforce_order=1
2018-02-06T09:50:14  [140736519537600] DEBUG YamlProvider[config] __init__: id=config, apply_disabled=False, update_pcent_threshold=0, delete_pcent_threshold=0
2018-02-06T09:50:14  [140736519537600] DEBUG Route53Provider[route53] __init__: id=route53, access_key_id=KEY, secret_access_key=***
2018-02-06T09:50:14  [140736519537600] DEBUG Route53Provider[route53] __init__: id=route53, apply_disabled=False, update_pcent_threshold=0, delete_pcent_threshold=0
2018-02-06T09:50:14  [140736519537600] INFO  Manager dump: zone=sillydomain.com., sources=()
2018-02-06T09:50:14  [140736519537600] DEBUG YamlProvider[dump] __init__: id=dump, directory=data/, default_ttl=3600, enforce_order=1
2018-02-06T09:50:14  [140736519537600] DEBUG YamlProvider[dump] __init__: id=dump, apply_disabled=False, update_pcent_threshold=0, delete_pcent_threshold=0
2018-02-06T09:50:14  [140736519537600] DEBUG Manager configured_sub_zones: subs=[]
2018-02-06T09:50:14  [140736519537600] DEBUG Zone __init__: zone=Zone<sillydomain.com.>, sub_zones=set([])
2018-02-06T09:50:14  [140736519537600] DEBUG Route53Provider[route53] populate: name=sillydomain.com., target=False, lenient=False
2018-02-06T09:50:14  [140736519537600] DEBUG Route53Provider[route53] _get_zone_id: name=sillydomain.com.
2018-02-06T09:50:14  [140736519537600] DEBUG Route53Provider[route53] r53_zones: loading
2018-02-06T09:50:15  [140736519537600] DEBUG Route53Provider[route53] _get_zone_id:   id=/hostedzone/PRIVATEID
2018-02-06T09:50:15  [140736519537600] DEBUG Route53Provider[route53] _load_records: zone_id=/hostedzone/PRIVATEID loading
Traceback (most recent call last):
  File "~/tmp/nosync/dns/env/bin/octodns-dump", line 11, in <module>
    load_entry_point('octodns', 'console_scripts', 'octodns-dump')()
  File "~/tmp/nosync/dns/env/src/octodns/octodns/cmds/dump.py", line 31, in main
    manager.dump(args.zone, args.output_dir, args.lenient, *args.source)
  File "~/tmp/nosync/dns/env/src/octodns/octodns/manager.py", line 360, in dump
    source.populate(zone, lenient=lenient)
  File "~/tmp/nosync/dns/env/src/octodns/octodns/provider/route53.py", line 464, in populate
    data = getattr(self, '_data_for_{}'.format(record_type))(rrset)
  File "~/tmp/nosync/dns/env/src/octodns/octodns/provider/route53.py", line 314, in _data_for_geo
    'values': [v['Value'] for v in rrset['ResourceRecords']],
KeyError: u'ResourceRecords'

Please let me know if this is a PEBCAK. ๐Ÿ˜„

Add option to turn off trailing dot enforcing

Hello!

By default OctoDNS is very particular about trailing dots in records to enforce unified syntax between DNS providers. Meanwhile, Route 53 assumes that the domain name is fully qualified. This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.

This can be worked around by running octodns-dump with the --lenient flag, to dump all records into a OctoDNS file, fixing syntax issues and then running octodns-sync.

However, there is a ongoing issue in Route53 that causes the records not to be updated with the trailing dot. The record can be modified in AWS console or with OctoDNS to add the trailing dot, however this change is not applied on save/sync. Therefore OctoDNS tries to apply the trailing dots each run, failing.

In case the trailing dots are removed from OctoDNS config, and sync run the process will exit in the following error:
octodns.record.exception.ValidationError: Invalid record

AWS Support is aware of the issue at hand and are working on a fix from AWS side. Direct quote:

-> I have checked internally and this is also a known issue to our team and they are working on a fix but there is also no ETA.

-> It was brought to the team's attention that via console updating existing records to have the trailing dot will not reflect as well as when using UPSERT for multiple CNAME records with trailing dot not all of them will reflect and have the dot. As seen here: https://repost.aws/questions/QUj9pIHHnyRIGKNJqjqLgaZQ/questions/QUj9pIHHnyRIGKNJqjqLgaZQ/route53-batch-of-changes-succeeding-but-only-making-one-of-the-changes ?

I'm suggesting a feature to be added, where trailing period enforcing could be switched off for octodns-route53 provider. This would make OctoDNS a bit more flexible with Route53 given their stance on the record syntax.

Is there a way to hide "root NS record supported"?

Hi Ross,

I managed many records and I'm asking if there is a way to hide this lines (I'm already using the --quiet mode):

[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466193733376] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain1.com.
[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466100107008] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain2.com.
[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466183243520] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain3.com.
[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466193733376] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain4.com.
[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466100107008] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain5.com.
[2023-10-23T15:20:29.695Z] 2023-10-23T15:20:29  [140466089617152] WARNING Route53Provider[route53] root NS record supported, but no record is configured for domain6.com.
[...]

For this case, the NS are already set inside Route53 and I want to keep them by default without surcharging them.

I think I don't want to hide all WARNING lines because it could interesting to have some, isn't it?

Thanks.

Route53 pool with health check that doesn't match the cname

Hi, I'm trying to do something that might be a little different than the general usecase, hope you might be able to help me.
I've created the following setup manually in route53 UI, and now trying to write it down to my octodns config:

In my example.com zone, 2 CNAME records for the same name test.example.com with Weighted routing policy, each with its own matching health check. However, the health checks and the CNAME targets have different domains

  1. test-primary.mydomain.com target, with weight 3, attached to health check that monitors test-health-primary.mydomain.com
  2. test-secondary.mydomain.com target, with weight 7, attached to health check that monitors test-health-secondary.mydomain.com

I'm not sure how to do that, as each record in the yaml requires type and value that have to be defined before the weighted routes and I couldn't find out how to create said healthchecks at all.

Can someone please help me with this?

Route 53: Too many values to unpack MX

Here's my config:

  config:
    class: octodns.provider.yaml.YamlProvider
    directory: /opt/dns/octozones
    enforce_order: false
  # nsone:
  #   class: octodns.provider.ns1.Ns1Provider
  #   api_key: env/NSONE_KEY
  zonefile:
    class: octodns.source.axfr.ZoneFileSource
    directory: /opt/dns/zonefiles
  route53:
    class: octodns.provider.route53.Route53Provider
    access_key_id: env/AWS_ACCESS_KEY_ID
    secret_access_key: env/AWS_ACCESS_KEY
zones:
  example.com.:
    sources:
      - route53
    targets:
      - config

When I then run octodns-sync against this config, i recieve the following error:

2019-03-28T14:17:39  [140109562977128] INFO  Manager __init__:   max_workers=1
2019-03-28T14:17:39  [140109562977128] INFO  Manager __init__:   max_workers=False
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync: eligible_zones=[], eligible_targets=[], dry_run=True, force=False
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync:   zone=example.com.
2019-03-28T14:17:40  [140109562977128] INFO  Manager sync:   sources=['route53'] -> targets=['config']
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] awards.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] aws.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] beoplay.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] beta.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] bowersandwilkins.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] css.cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] images.cdn.example.com. is an Alias record. Skipping...
2019-03-28T14:17:41  [140109562977128] WARNING Route53Provider[route53] community.example.com. is an Alias record. Skipping...
Traceback (most recent call last):
  File "/usr/local/bin/octodns-sync", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/octodns/cmds/sync.py", line 39, in main
    dry_run=not args.doit, force=args.force)
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 301, in sync
    plans = [p for f in futures for p in f.result()]
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 56, in result
    return self.func(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/site-packages/octodns/manager.py", line 224, in _populate_and_plan
    source.populate(zone)
  File "/usr/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 491, in populate
    data = getattr(self, '_data_for_{}'.format(record_type))(rrset)
  File "/usr/local/lib/python2.7/site-packages/octodns/provider/route53.py", line 385, in _data_for_MX
    preference, exchange = rr['Value'].split(' ')
ValueError: too many values to unpack

There are only 8 MX records, and a total of 86 record sets in this zone. I have tested on smaller zones with identical MX records and the error does not occur. Similarly, i have tested on larger zones with no MX records, and the error does not occur.

Route53: dynamic record triggers update even with no changes to the record

I have the following dynamic record:

www:
  dynamic:
    pools:
      eu:
        values:
        - value: aloadofELBstuffhere.amazonaws.com.
    rules:
    - geos:
      - EU
      pool: eu
  ttl: 300
  type: CNAME
  value: web.example.com.

When I sync to route53, it creates the record(s) the first time. All good. When I run a sync the second time, it reports an update, even though nothing has changed:

* route53 (Route53Provider)
*   Update
*     <CnameRecord CNAME 300, www.testing123.com., web.example.com., {'eu': {'fallback': None, 'values': [{'value': 'aloadofELBstuffhere.amazonaws.com.', 'weight': 1}]}}, [{'pool': 'eu', 'geos': ['EU']}]> ->
*     <CnameRecord CNAME 300, www.testing123.com., web.example.com., {'eu': {'fallback': None, 'values': [{'value': 'aloadofELBstuffhere.amazonaws.com.', 'weight': 1}]}}, [{'pool': 'eu', 'geos': ['EU']}]> (config)
*   Summary: Creates=0, Updates=1, Deletes=0, Existing Records=3

I expect the sync to detect that nothing has changed and Updates=0.

route53 with healthcheck record sync issue

source: route53
target: digitalocean

failover record bind healthcheck
master:
a.example.com
1.1.1.1
backup:
a.example.com
2.2.2.2

octodns will sync backup records to digitalocean DNS
Not in line with expectations
like:
a.example.com
2.2.2.2
hope:
a.example.com
1.1.1.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.