Update route 53 record with local ip on a set interval.
1.7K
This project is a python script that updates a route53 based A record to the public ip address of the host running the script through the use of the AWS api.
The script uses 4 environment variables:
| Variable | Required? | Description |
|---|---|---|
| AWS_ACCESS_KEY_ID | required | Specifies an AWS access key associated with an IAM user or role. |
| AWS_SECRET_ACCESS_KEY | required | Specifies the secret key associated with the access key. This is essentially the "password" for the access key. |
| A_RECORD | required | The a record you wish to create or update, example: record.domain.com |
| INTERVAL | optional | The interval in seconds at which the update occurs, default is 900 seconds, or 15 minutes |
| IP_URL | optional | The url used for determining local IP, defaults to "icanhazip.com" |
Set the environment variables in a way that is appropriate for your operating system.
Example:
Linux/MacOS
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export INTERVAL=300
export A_RECORD=record.domain.com
Set the environment variables as explained, run the script using python3
python3 r53_upserter.py
For your convenience a dockerfile is provided.
run docker build in the root of this repo.
docker build -t r53_upserter .
This docker image is prebuild and available on duckerhub. https://hub.docker.com/repository/docker/martyca/r53_upserter Pull from dockerhub:
docker pull martyca/r53_upserter
Run the container setting the required environment variables:
docker run -d \
-e A_RECORD \
-e AWS_ACCESS_KEY_ID\
-e AWS_SECRET_ACCESS_KEY\
-e INTERVAL\
-e IP_URL \
martyca/r53_upserter
Content type
Image
Digest
Size
35.5 MB
Last updated
almost 5 years ago
docker pull martyca/r53_upserter