Roger Lehrke 078a431a43
Update dns_aws.sh
Use `hostedzonesbyname` Route 53 API endpoint instead of `hostedzones` endpoint.

The `hostedzones` endpoint returns all hosted zones for a given Route 53 account in groups of 100.  For AWS Route 53 accounts with many domains, this could mean a large number of requests to the `hostedzones` endpoint as it progresses through each page of 100 results.  This will often result in a "Rate exceeded" API error from Route 53.

Instead of using `hostedzones` endpoint, we can use `hostedzonesbyname` and then filter by the specific domain we are looking for and ask for a `max-items` of 1.

The while loop in _get_root() starts with a given domain and removes parts from the front of the given domain if no match is found.

For example, when requesting a certificate for `test.www.domain.co.uk`, the while loop will check for Route 53 hosted zones for:

1st: test.www.domain.co.uk
2nd: www.domain.co.uk
3rd: domain.co.uk
4th: co.uk
5th: uk

The first two checks will result in no matches, while the third check should be successful (if, of course, domain.co.uk is actually a hosted zone in the given AWS account).

Now imagine that the given AWS account owns 2500 domains and, therefore, has 2500 hosted zones.

Using the `hostedzones` endpoint would result in:

1st: 25 GET requests to the Route 53 API looking for a match to test.www.domain.co.uk
2nd: 25 GET requests to the Route 53 API looking for a match to www.domain.co.uk
3rd: 25 GET requests to the Route 53 API looking for a match to domain.co.uk
4th: 25 GET requests to the Route 53 API looking for a match to co.uk
5th: 25 GET requests to the Route 53 API looking for a match to uk

This would far exceed the Route 53 limit of five requests per second.

Using `hostedzonesbyname` results in a dramatic reduction in Route 53 API GET requests for AWS accounts with large numbers of hosted zones.
2020-08-17 13:09:38 -05:00
..
2018-04-03 10:18:54 +02:00
2020-08-17 22:18:20 +08:00
2018-01-15 10:59:50 +01:00
2020-08-17 13:09:38 -05:00
2020-08-17 22:18:20 +08:00
2020-01-22 05:33:46 +01:00
2020-07-16 06:14:50 +02:00
2019-03-09 09:13:49 +08:00
2020-08-17 22:18:20 +08:00
2019-04-29 21:52:22 +08:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-04-16 20:03:34 +02:00
2020-05-02 08:29:44 +02:00
2020-07-16 06:18:12 +02:00
2020-08-17 22:18:20 +08:00
2020-03-25 14:39:52 +08:00
2018-08-12 18:15:20 +08:00
2018-02-13 21:02:38 -08:00
2020-07-03 07:48:38 -04:00
2020-08-09 09:40:22 +08:00
2020-08-17 22:18:20 +08:00
2018-12-20 16:37:11 +01:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-06-24 12:26:11 +03:00
2020-05-13 12:14:27 +02:00
2020-08-17 22:18:20 +08:00
2019-07-13 19:35:55 +08:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2020-01-23 19:20:44 +01:00
2019-10-25 13:46:10 +02:00
2020-07-07 20:52:00 +08:00
2020-01-04 10:52:52 -06:00
2018-12-20 11:00:10 -05:00
2020-04-20 21:05:40 +03:00
2018-02-17 15:12:19 +01:00
2019-05-25 16:55:09 +05:30
2020-03-09 11:34:50 -06:00
2020-01-30 12:06:39 +08:00
2020-01-30 12:06:39 +08:00
2019-02-27 20:41:50 +08:00
2019-03-16 15:09:49 +08:00
2018-12-04 14:36:28 +01:00
2019-05-23 08:15:03 +02:00
2020-08-17 22:18:20 +08:00
2020-01-09 17:05:18 +03:00
2019-05-01 12:25:46 +02:00
2019-02-06 21:49:17 +01:00
2020-08-17 22:18:20 +08:00
2019-02-15 08:56:09 +00:00
2020-04-27 15:41:50 +02:00
2020-04-21 11:43:08 +02:00
2020-08-17 22:18:20 +08:00
2020-08-17 22:18:20 +08:00
2019-01-08 15:59:29 +11:00
2020-08-17 22:18:20 +08:00
2018-01-26 20:39:41 +08:00
2020-01-30 12:06:39 +08:00
2018-05-02 11:13:10 +02:00
2020-05-19 23:09:16 +02:00
2019-03-14 20:41:13 +08:00
2019-11-03 07:21:16 +03:00
2019-10-06 14:40:57 +03:00
2020-07-16 06:18:46 +02:00
2018-03-28 18:14:45 +03:00
2020-01-02 14:55:36 +02:00
2018-02-10 23:34:34 +08:00
2020-01-30 12:06:39 +08:00