Skip to main content

A simple package that updated an AWS Route53 A record to point to the current IP

Project description

route53-ddns

This package provide a simple CLI to update a Route53 Hosted Zone. This can be run as cron job to provide a dynamic DNS functionality.

The package uses ipify to get the current IP (or it can be provided as argument).

Route53 interaction is achieved using boto3. Credentials can be provided in any of the supported way boto3 expects them. See boto3 credentials documentation.

Usage

To update the record home.example.com, giving you have an example.com hosted zone in your AWS account:

$ route53-ddns --zone example.com --record home
2021-09-02 22:09:18,289 - root - INFO - Adjusting target record to be home.example.com
2021-09-02 22:09:18,683 - route53_ddns.ip_utilities - INFO - Detected IP 107.3.160.43
2021-09-02 22:09:19,100 - route53_ddns.route53_interface - INFO - Found zone /hostedzone/XXXXXXXXXXXXXX with name example.com. matching the expected example.com
2021-09-02 22:09:19,100 - route53_ddns.route53_interface - INFO - Checking current records
2021-09-02 22:09:19,437 - route53_ddns.route53_interface - INFO - Found record of type NS with ttl 172800 named example.com.
2021-09-02 22:09:19,437 - route53_ddns.route53_interface - INFO - Found record of type SOA with ttl 900 named example.com.
2021-09-02 22:09:19,437 - route53_ddns.route53_interface - INFO - Found record of type A with ttl 60 named pif.example.com.
2021-09-02 22:09:19,438 - route53_ddns.route53_interface - INFO - Found record of type A with ttl 60 named ppi.example.com.
2021-09-02 22:09:19,438 - route53_ddns.route53_interface - INFO - Found record of type A with ttl 60 named rpi.example.com.
2021-09-02 22:09:19,438 - route53_ddns.route53_interface - INFO - No records found matching home.example.com. A new 'A' record would be created.
2021-09-02 22:09:19,438 - route53_ddns.route53_interface - INFO - The current value of home.example.com points to None. Will update to 10.0.0.1
2021-09-02 22:09:19,438 - route53_ddns.route53_interface - INFO - Submitting the change for home.example.com to point to 10.0.0.1
2021-09-02 22:09:20,112 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:25,556 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:30,942 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:36,155 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:41,318 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:46,619 - route53_ddns.route53_interface - INFO - Status of change /change/C042853219OW934Y2B3A2 is still pending. Waiting 5 seconds
2021-09-02 22:09:51,856 - route53_ddns.route53_interface - INFO - Change /change/C042853219OW934Y2B3A2 has completed with status INSYNC
2021-09-02 22:09:51,856 - route53_ddns.route53_interface - INFO - Update completed
2021-09-02 22:09:51,922 - route53_ddns.ip_utilities - INFO - Record home.example.com points to 10.0.0.1

To check the propagation status:

$ route53-ddns --zone example.com --record home -c
2021-09-02 22:14:43,791 - root - INFO - Adjusting target record to be home.example.com
2021-09-02 22:14:44,145 - route53_ddns.ip_utilities - INFO - Detected IP 10.0.0.1
2021-09-02 22:14:44,145 - root - INFO - Running in check-only mode. Validating propagation of 10.0.0.1
2021-09-02 22:14:44,146 - route53_ddns.ip_utilities - INFO - Record hom.example.com points to 10.0.0.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

route53-ddns-0.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

route53_ddns-0.0.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file route53-ddns-0.0.3.tar.gz.

File metadata

  • Download URL: route53-ddns-0.0.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5

File hashes

Hashes for route53-ddns-0.0.3.tar.gz
Algorithm Hash digest
SHA256 eaab69edfff1e988e0cd90317e611af596f7834b3f02570b36493a0090905fee
MD5 11aa23195004aa6084a44f8bb7a5ae7b
BLAKE2b-256 41fca48aeeb2d09cbc7f5df261ad0f32977de8cec864ee64aaac3022af2a1ec9

See more details on using hashes here.

File details

Details for the file route53_ddns-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: route53_ddns-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5

File hashes

Hashes for route53_ddns-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8da1d3e7ff80bd6c1840d34ca1608a16ac4352ec9ba93e27b61134a2bfff72a9
MD5 6cc32d7669fe92f7d298035cde5e47f9
BLAKE2b-256 98493eb2888c6984477f74cad13adabc71a8b86a2890a609d3a6ed3279a836e7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page