Skip to main content

更新 AWS Route53 A 记录以指向当前 IP 的简单包

项目描述

route53-ddns

该软件包提供了一个简单的 CLI 来更新 Route53 托管区域。这可以作为 cron 作业运行以提供动态 DNS 功能。

该包使用ipify来获取当前 IP(或者它可以作为参数提供)。

Route53 交互是使用boto3实现的。可以以 boto3 期望的任何受支持的方式提供凭据。请参阅boto3 凭据 文档。

用法

要更新记录home.example.com,让您example.com在 AWS 账户中有一个托管区域:

$ 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

检查传播状态:

$ 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

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

route53-ddns-0.0.3.tar.gz (9.3 kB 查看哈希)

已上传 source

内置分布

route53_ddns-0.0.3-py3-none-any.whl (8.1 kB 查看哈希)

已上传 py3