Sign inSign up

martyca/r53_upserter

By martyca

Updated almost 5 years ago

Update route 53 record with local ip on a set interval.

Image
0

1.7K

martyca/r53_upserter repository overview

R53_Upserter

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.

Environment variables

The script uses 4 environment variables:

VariableRequired?Description
AWS_ACCESS_KEY_IDrequiredSpecifies an AWS access key associated with an IAM user or role.
AWS_SECRET_ACCESS_KEYrequiredSpecifies the secret key associated with the access key. This is essentially the "password" for the access key.
A_RECORDrequiredThe a record you wish to create or update, example: record.domain.com
INTERVALoptionalThe interval in seconds at which the update occurs, default is 900 seconds, or 15 minutes
IP_URLoptionalThe 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

More information.

Running the script manually

Set the environment variables as explained, run the script using python3

python3 r53_upserter.py

Docker

For your convenience a dockerfile is provided.

Manual build

run docker build in the root of this repo.

docker build -t r53_upserter .
Premade docker image

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 container

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

Tag summary

Content type

Image

Digest

Size

35.5 MB

Last updated

almost 5 years ago

docker pull martyca/r53_upserter