bshaw/route53-dyndns

By bshaw

Updated 4 days ago

A simple dynamic DNS service for Route53

Image
Networking
3

1M+

bshaw/route53-dyndns repository overview

Amazon Route53 Dynamic DNS

A simple dynamic DNS service for Route53.

:warning: WARNING
Version 4 and newer no longer keeps the container running with a sleep script.
You should either run on a schedule via cron or as a Kubernetes CronJob.
If you want to continue using this the old way, use the :3 or 3.0.1 tag (no longer maintained).

Supported Architectures

ArchitectureSupported
linux/amd64Yes
linux/arm64Yes
linux/arm/v7No

:warning: arm/v7 (32-bit ARM) support was dropped after v4.0.0 due to incompatibility with the uv package manager. Use arm64 for modern ARM devices (Raspberry Pi 4 and later). If you need arm/v7, use the :4 or :4.0.0 tag (no longer maintained).

Requirements

Usage

Kubernetes - CronJob
Secret

Create a secret containing multiple key-value pairs to store your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

kubectl create secret generic aws-secret --from-literal=AWS_ACCESS_KEY_ID='my_access_-_key_id' --from-literal=AWS_SECRET_ACCESS_KEY='my_secret_access_key'
CronJob

Run every 5 minutes for the domain example.com, using the values from the secret created above. Make sure to set the record to update in the args section.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: route53-dyndns-cron
spec:
  schedule: "*/5 * * * * "
  jobTemplate:
    spec:
      ttlSecondsAfterFinished: 100
      template:
        spec:
          containers:
          - image: docker.io/bshaw/route53-dyndns
            name: route53-dyndns
            imagePullPolicy: Always
            envFrom:
            - secretRef:
                name: route53-dyndns-secret
            args:
            - --record
            - example.com
            - --verbose
          restartPolicy: OnFailure
Docker / Podman

Run once for the domain example.com. Make sure to set values for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and the record to update.

docker run \
    --rm \
    --name route53 \
    -e AWS_ACCESS_KEY_ID= \
    -e AWS_SECRET_ACCESS_KEY= \
    bshaw/route53-dyndns \
    --record example.com --verbose
Cron

Add to your crontab / scheduler.

Run every 5 minutes for the domain example.com. Make sure to set values for AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and the record to update.

*/5 * * * *  docker run --rm --name route53 -e AWS_ACCESS_KEY_ID="access_key_id" -e AWS_SECRET_ACCESS_KEY="secret_access_key" bshaw/route53-dyndns --record example.com --verbose

Command line

python3 r53dyndns.py --help
usage: r53dyndns.py [-h] -r RECORD [-v]

Update a Route53 A record with the current external IP address.

options:
  -h, --help           show this help message and exit
  -r, --record RECORD  specify the DNS A record to update
  -v, --verbose        enable verbose output

Required Environment Variables

  • AWS_ACCESS_KEY_ID - An AWS Access Key
  • AWS_SECRET_ACCESS_KEY - An AWS Secret Key

Credentials

Boto supports multiple ways to supply credentials.

See the official documentation for more details: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.htm

Retrieving your external IP

This service performs a DNS query to retrieve your IP address from an OpenDNS resolver. This method arguably faster and more reliable than using an http(s) service.

Similar functionality could be done via the shell using dig: dig +short myip.opendns.com @resolver1.opendns.com;

Tag summary

Content type

Image

Digest

sha256:cb39cda19

Size

57.1 MB

Last updated

4 days ago

docker pull bshaw/route53-dyndns:5