This script can query a website to reveal the client's external IPv4 address, check if any change has occurred, then if needed, use the Route53 API to update a DNS record.
Code is minimal and could be expanded easily. I wrote this because there were no good examples in PHP and I just wanted a workable solution.
- PHP
- curl
- AWS SDK for PHP v3
- Place these files in an existing SDK project, or install the SDK using
composer require aws/aws-sdk-php
- Copy the
config-dist.php
toconfig.php
and provide the DNS details. - Copy the
credentials-dist
to~/.aws/credentials
and provide the AWS keys. - Run like
php -f ddns.php
or cron like*/10 * * * * /usr/bin/php -f /path/to/ddns.php