Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agorf/dyndns53
Run your own dynamic DNS service with Amazon Route 53
https://github.com/agorf/dyndns53
amazon aws cron crontab dns dynamic-dns dyndns dyndns-service golang iam-policy route53
Last synced: 4 months ago
JSON representation
Run your own dynamic DNS service with Amazon Route 53
- Host: GitHub
- URL: https://github.com/agorf/dyndns53
- Owner: agorf
- License: mit
- Archived: true
- Created: 2017-01-28T11:51:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-30T20:38:33.000Z (over 6 years ago)
- Last Synced: 2024-08-02T15:48:55.681Z (7 months ago)
- Topics: amazon, aws, cron, crontab, dns, dynamic-dns, dyndns, dyndns-service, golang, iam-policy, route53
- Language: Go
- Size: 26.4 KB
- Stars: 31
- Watchers: 6
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# dyndns53
dyndns53 lets you run your own [dynamic DNS][] service with [Amazon Route 53][]
by updating a domain of your choice with the public IP address of the machine it
runs on.[dynamic DNS]: https://en.wikipedia.org/wiki/Dynamic_DNS
[Amazon Route 53]: https://aws.amazon.com/route53/## Installation
[Install Go][] and issue:
$ go get github.com/agorf/dyndns53
[Install Go]: https://golang.org/doc/install
## Configuration
Register a domain name, if you haven't already. Then log in to the [AWS
management console][] and follow the steps below.[AWS management console]: https://console.aws.amazon.com/
### Step 1: Create a hosted zone
Go to the [Route 53 Hosted Zones page][] and click _Create Hosted Zone_.
Fill in your domain name in _Domain Name_ and choose _Public Hosted Zone_ for
_Type_, then click _Create_.In the hosted zone page, note down the domain names of the Amazon name servers
(row with type _NS_). You need to set them as name servers in your domain name
registrar.**Note:** DNS propagation usually takes a few hours for newly-registered
domain names. If resolving your domain doesn't work, try again later.Click _Back to Hosted Zones_ and note down the _Hosted Zone ID_ since you will
need it in the next step.[Route 53 Hosted Zones page]: https://console.aws.amazon.com/route53/home#hosted-zones:
### Step 2: Create an IAM policy
Go to to the [IAM Policies page][] and click _Create Policy_.
Click _Select_ on the _Policy Generator_ section.
In the following form, choose _Allow_ for _Effect_, _Amazon Route 53_ for _AWS
Service_, _ChangeResourceRecordSets_ for _Actions_, fill in
`arn:aws:route53:::hostedzone/` for _Amazon Resource Name (ARN)_
(replacing `` with the one from the previous step) and click _Add
Statement_ and then _Next Step_.Fill in a name for _Policy Name_ so that you can look up the policy later and
click _Create Policy_.[IAM Policies page]: https://console.aws.amazon.com/iam/home#/policies
### Step 3: Create an IAM user
Go to the [IAM Users page][] and click the _Add user_ button.
Fill in the user name, check _Programmatic access_ for _Access type_ and click
_Next: Permissions_.On the permissions page, click the last option _Attach existing policies
directly_ and fill in the _Search_ field with the name of the policy you created
in the previous step. Click on the policy to check it and click _Next: Review_.Click _Create user_ and you will be presented with an _Access key ID_ and a
_Secret access key_ (masked), the credentials dyndns53 needs to access the
service programmatically. Don't close the window since you will need them in the
next step.[IAM Users page]: https://console.aws.amazon.com/iam/home#/users
### Step 4: Create an AWS credentials file
In the machine you plan to run dyndns53, issue:
$ mkdir -p ~/.aws
$ touch ~/.aws/credentials
$ chmod go-r ~/.aws/credentials # prevent other users from reading the fileEdit the file with your editor:
$ $EDITOR ~/.aws/credentials
And write:
[dyndns53]
aws_access_key_id =
aws_secret_access_key =Replacing `` and `` with the actual values you
were presented in the previous step.You are now ready to use dyndns53.
## Usage
Running the program with no arguments prints a usage text:
$ dyndns53
Usage of dyndns53:
-log string
file name to log to (default is stdout)
-name value
record set names (-name domain1 -name domain2 -name domain3 ...)
-ttl int
TTL (time to live) in seconds (default 300)
-type string
record set type; "A" or "AAAA" (default "A")
-zone string
hosted zone idYou can set [Cron][] (with `crontab -e`) to run the program e.g. every five
minutes:*/5 * * * * ~/go/bin/dyndns53 -name mydomain1 -name mydomain2 -zone HOSTEDZONEID -log ~/dyndns53.log
Where `~/go` is your `$GOPATH`, `mydomain1` and `mydomain2` are the names of the
record sets (domains) you want to update and `HOSTEDZONEID` is the id of the
[hosted zone][] they belong to.If the record set does not exist, it will be created the first time dyndns53
runs.Assuming that the IP address changes right after dyndns53 runs (with a default
TTL of 5 minutes), the above [Cron][] entry has a worst-case scenario of a
10-minute delay until the domain name resolves to the new IP address (5 minutes
until next run that issues the update + 5 minutes for the DNS change to
propagate).[Cron]: https://en.wikipedia.org/wiki/Cron
[hosted zone]: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ListInfoOnHostedZone.html## License
Licensed under the MIT license (see [LICENSE.txt][]).
[LICENSE.txt]: https://github.com/agorf/dyndns53/blob/master/LICENSE.txt
## Author
Angelos Orfanakos, https://agorf.gr/