Giter VIP home page Giter VIP logo

dyndns53's Introduction

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.

Installation

Install Go and issue:

$ go get github.com/agorf/dyndns53

Configuration

Register a domain name, if you haven't already. Then log in to the AWS management console and follow the steps below.

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.

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/<HOSTEDZONEID> for Amazon Resource Name (ARN) (replacing <HOSTEDZONEID> 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.

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.

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 file

Edit the file with your editor:

$ $EDITOR ~/.aws/credentials

And write:

[dyndns53]
aws_access_key_id = <ACCESS_KEY_ID>
aws_secret_access_key = <SECRET_ACCESS_KEY>

Replacing <ACCESS_KEY_ID> and <SECRET_ACCESS_KEY> 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 string
        record set name (domain)
  -ttl int
        TTL (time to live) in seconds (default 300)
  -type string
        record set type; "A" or "AAAA" (default "A")
  -zone string
        hosted zone id

You can set Cron (with crontab -e) to run the program e.g. every five minutes:

*/5 * * * * ~/go/bin/dyndns53 -name mydomain -zone HOSTEDZONEID -log ~/dyndns53.log

Where ~/go is your $GOPATH, mydomain is the name of the record set (domain) you want to update and HOSTEDZONEID is the id of the hosted zone it belongs 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).

License

Licensed under the MIT license (see LICENSE.txt).

Author

Angelos Orfanakos, http://agorf.gr/

dyndns53's People

Contributors

agorf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.