9 releases (breaking)
| 0.7.0 | Apr 25, 2026 |
|---|---|
| 0.6.0 | Apr 2, 2026 |
| 0.5.0 | Sep 29, 2025 |
| 0.4.0 | Jul 20, 2025 |
| 0.1.1 | Mar 31, 2025 |
#538 in Network programming
160KB
3.5K
SLoC
ddns-route53
ddns-route53 is a utility for creating a Dynamic DNS ("DDNS") solution for zones hosted by AWS Route53. Other hosting providers are not supported.
Overview
ddns-route53 works by first attempting to identify the public IPv4 or IPv6 address it is running at, using several possible algorithms set in its configuration. Once its address(es) are determined, it compares the result with the DNS resource records in a Route53-hosted zone and, if they differ, update the zone to match.
Installing the easy way
- Install the rust compiler, using either your distribution's sources or by following https://www.rust-lang.org/tools/install.
- Run this command:
cargo install ddns-route53 - Once done, you'll find the utility at
~/.cargo/bin/ddns-route53(where~refers to your home directory).
Building/installing (manually)
If you want to build and install it manually, follow these steps instead:
- Install the rust compiler, using either your distribution's sources or by following https://www.rust-lang.org/tools/install.
- Download the
ddns-route53source from GitHub, or check it out using git:git clone https://github.com/johnboy2/ddns-route53.git - Enter into the directory where you downloaded it, and run
cargo build --release - Wait for it to download dependencies and compile the tool (this can take a few minutes).
- Once done, you'll find the utility at
target/release/ddns-route53.
Optional build features:
native-decode
The native-decode feature changes the decoding behavior of any plugin IP address algorithms you have configured.
By default (i.e., without this feature), any plugin output decoding is done as follows:
- If the algorithm provides an
encodingoption, that will be used to decode the plugin's output. - If the output begins with a byte-order mark for any of UTF-8, UTF-16LE, or UTF-16BE, the output will be decoded using the indicated encoding.
- If the first two bytes can be decoded as a valid UTF-16 code unit, and if the resulting code-point is in the range U+0000-U+00FF, then the plugin's output will be decoded with UTF-16 using the system's native byte-order.
- Finally, if all else fails, UTF-8 will be used.
With this feature installed, however, the fourth step instead becomes:
- Depending on your operating system:
- On Unix (including Linux and MacOS), the
LC_ALL,LC_CTYPE, andLANGenvironment variables are read, in that order, for the first to specify a codeset component. (For a list of available codesets on your system, you can often use theiconv -lcommand.) If a supported codeset is found, that will be used to decode the plugin output using the native iconv library. If no codeset is found, decoding falls back on UTF-8. - On Windows, the active code page (i.e., the output from running the
chcpcommand from a terminal window) will be used to decode the plugin output using Windows' native API. There is no fallback from this case, since Windows systems always have an active code page. - For all other systems, UTF-8 remains the fallback decoder (i.e., just as if this feature wasn't installed).
- On Unix (including Linux and MacOS), the
AWS configuration
Querying and updating a Route53 zone requires an IAM identity with appropriate permissions. See the AWS IAM documentation for details.
Example Route53/IAM playbook
The following example shows one way to create an IAM user with limited permissions for exclusive use by ddns-route53.
- Determine the "Zone ID" for your Route53-hosted DNS zone:
- Log into the Route53 console as a user with sufficient administrative rights.
- In the Dashboard, click on "Hosted zones".
- Select the DNS zone for which you want Dynamic-DNS updates.
- Expand "Hosted zone details" (near the top of the page).
- Make note of the "Hosted zone ID" — you'll need it again later.
- Create an IAM user that can update the zone:
-
Log into the IAM console as a user with sufficient administrative rights.
-
In the Dashboard, find "Access Management" and click on "Policies".
-
Click "Create policy".
-
Under the Policy editor, click on "JSON", and replace the default content with the following:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "route53:ChangeResourceRecordSets", "Resource": "arn:aws:route53:::hostedzone/Z01234567890ABCDEFGHI", "Condition": { "ForAllValues:StringEquals": { "route53:ChangeResourceRecordSetsNormalizedRecordNames": "home.example.com", "route53:ChangeResourceRecordSetsRecordTypes": [ "A", "AAAA" ] } } }, { "Effect": "Allow", "Action": "route53:ListResourceRecordSets", "Resource": "arn:aws:route53:::hostedzone/Z01234567890ABCDEFGHI" }, { "Effect": "Allow", "Action": "route53:GetChange", "Resource": "arn:aws:route53:::change/*" } ] }Replace
home.example.comin the IAM policy above with the fully-qualified domain name of the record you want maintained.The first two
"Resource"entries above must be updated to give the "ARN" of your zone, which is comprised of the prefix,"arn:aws:route53:::hostedzone/", followed by your zone ID. For example, if your Zone ID isZ12345, then its ARN is"arn:aws:route53:::hostedzone/Z12345"— so that's what you should put under the first two"Resource"sections of the IAM policy above. -
Click "Next".
-
Set a suitable policy name; e.g.
DynamicDNS-home.example.com. -
Scroll down to the bottom and click "Create Policy".
-
In the Dashboard, find "Access Management" and click on "Users".
-
Click on "Create user".
-
Enter a suitable name into the "User name" field; for example
ddns-user. Then click "Next".Other options on this page can be skipped.
-
On the "Set Permissions" page under "Permissions options", select "Attach policies directly".
-
Under "Permissions policies", enter the policy name you chose above; that will filter the list of available policies to just those containing the name you gave; find your policy, and place a checkmark in the box next to its name.
-
Click "Next".
-
Click "Create user".
-
- Create an access key for your IAM user:
- Log into the IAM console as a user with sufficient administrative rights.
- In the Dashboard, find "Access Management" and click on "Users".
- Click on the user you created.
- Click on the "Security credentials" tab.
- Under "Access keys", click on "Create access key".
- Under use case, select "Other", and click "Next".
- (Optionally) Set a description, such as
DDNS update key. - Click "Create access key".
- Make note of the "Access key" and the "Secret access key", or use the "Download .csv file" button — you'll need these to setup the client configuration (below).
Always keep your AWS IAM credentials confidential!
Client configuration
A template configuration file is available at example/ddns-route53.conf. This file uses a TOML-based format. You should copy this file to another location and edit it to match your needs.
At a minimum, you should set the following:
- The
host_namevalue, which should be a fully-qualified domain name within a Route53-hosted zone. - The
aws_route53_zone_idof your zone.This value is technically optional, because
ddns-route53can determine this dynamically; however that requires theListHostedZonespermission (which the example above omits). See the AWS IAM documentation for help in adding this permission if desired. - You'll either need to specify the
aws_access_key_idandaws_secret_access_keyvalues for the IAM user you created, or else you'll need to make them available to the local user under which you will runddns-route53by following standard AWS SDK credential practices.
Various other configuration options exist; see example/ddns-route53.conf for more information.
Running
Configuration file path
ddns-route53 is usually setup with a configuration file -- so it needs to know where it is located in order to run. You can do this via either of two ways:
- Provide the path to the file explicitly, or
- Rely on the utility locating the configuration file automatically.
To provide the path explicitly, invoke the command with the -c argument followed by the path. For example:
ddns-route53 -c /path/to/config/file
If an explicit path is not given, the utility will automatically use the first file to be found in one of the following locations:
ddns-route53.conf(i.e., a file in the current working directory)- If running on a Posix system (e.g., Linux, Mac, or other Unix):
~/.config/ddns-route53.conf~/.local/share/ddns-route53.conf~/.ddns-route53.conf/usr/local/etc/ddns-route53.conf/etc/opt/ddns-route53.conf/etc/ddns-route53.conf
- If running on a Windows system:
%LOCALAPPDATA%\ddns-route53.conf%ProgramData%\ddns-route53.conf
Alternatively, you can also explicitly specify no configuration file by passing -c -. (This forces use of CLI options only.)
Runtime behavior
This tool is a simple, "fire and forget" utility. That is, it checks your current IP address right now and updates the Route53 record if it differs. It does not recheck later.
If you want to run it periodically, you can use a third-party scheduler to do so. For example, the Windows Task Scheduler, Mac iCal, Mac launchd, Unix/Linux cron jobs, and Linux systemd can all be configured to run ddns-route53 periodically.
See the example folder in the source distribution for available scheduling examples.
License
MIT or Apache-2.0 at the user's choice.
SPDX-License-Identifier: [MIT] OR Apache-2.0
Dependencies
~42–64MB
~1M SLoC