This is a small Go tool that updates an AWS Route53 A record with a dynamic public IP address.
The process has two stages:
The tool expects an external HTTP endpoint that accepts a GET request and returns JSON in either of these forms:
{
"ip": "127.0.0.1"
}or:
{
"ip_address": "127.0.0.1"
}An example implementation of such a service can be found here.
Once the public IP is resolved, the tool sends an UPSERT request to Route53 for the configured A record.
Configuration is provided through environment variables. If any required variable is missing, the process exits with an error.
RESOLVER_URL: URL of the IP resolver endpoint.API_KEY: API key sent as thex-api-keyrequest header.HOSTED_ZONE_ID: Route53 hosted zone ID.RECORD_SET: FQDN of the record to update.
The application logs extensively to STDOUT with UTC timestamps, including:
- startup and configuration loading (without printing secrets),
- resolver request/response metadata and IP parsing,
- Route53 client initialization and UPSERT submission,
- success/failure status and error context.
RESOLVER_URL='<AN_URL>' \
API_KEY='<AN_API_KEY>' \
HOSTED_ZONE_ID='<YOUR_ZONE_ID>' \
RECORD_SET='<YOUR_RECORD_SET>' \
go run ./main.goRESOLVER_URL='https://resolver.example.org/whatsmyip' \
API_KEY='123456' \
HOSTED_ZONE_ID='FOO' \
RECORD_SET='dynamic.example.org' \
go run ./main.go