Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

update53 - DynDNS with AWS Route53

This version allow you to update your AWS Route53 record by your current public ip (from ipinfo.io web service)

Features:

  • Update AWS Route53 DNS Record with your current public IP (Useful for home ISP with non-static IP address)
  • Optional - Send SNS Notification when your ip change
  • Optional - Update the bucket policy of a S3 bucket to only authorize access to this bucket from your public IP (Useful for private static web hosting)

Requirements

  • AWS SDK for Python - boto3 sudo pip install boto3
  • IAM Role attached to your EC2 instance or IAM User with AccessKey/SecretKey
  • SNS Topic (Alerting purpose)
  • Run aws configure to setup at least the region and your AK/SK

Installation

  • Create your AWS Route 53 Zone first, then create your DNS A Record to update (home.example.com)

  • Configure your server with AWS CLI : aws configure with your AccessKey ID and SecretAccess ID

      $ git clone https://github.com/z0ph/update53-pub.git
      $ cd update53-pub/python/
      $ sudo pip install -r requirements.txt
    

Usage

    $ python update53.py [YOUR_HOSTED_ZONE_ID] [YOUR_DNS] -b [YOUR_BUCKET_NAME]

Optional

  • Use this option to change your bucket policy to only allow your new IP: "Action": "s3:GetObject" -b [YOUR_BUCKET_NAME]
  • Setup your SNS ARN on line 113 in update53.py

Example of the Bucket Policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AddPerm",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::draft.zoph.me/*",
            "Condition": {
                "IpAddress": {
                    "aws:SourceIp": [
                        "130.211.YY.XXX/32"
                    ]
                }
            }
        }
    ]
}

Example with only Route53

Run python update53.py ZLJT68NZ2IYSF home.example.com

Example with S3 Bucket

Run python update53.py ZLJT68NZ2IYSF home.example.com -b privatewebsite.example.com

Automation

  • Schedule this script with cron to update record on a daily basis for example.
  • crontab -e to schedule your job :

0 * * * * python /home/user/update53-pub/update53.py ZLJT68NZ2IYSF home.example.com

Credits

Adaptation from:

You can’t perform that action at this time.