Code Monkey home page Code Monkey logo

aws_godaddy_update_record's Introduction

Update GoDaddy DNS A record for AWS instance

Update GoDaddy DNS A record for AWS instance, using GoDaddyPy python library.

GoDaddyPy - Python library useful for updating DNS settings through the GoDaddy v1 API.

AWS Instances very often change their public IP addresses (after rebooting, reconfiguring etc.) This script allow you to update actual IP address of AWS instance in A record subdomain name in GoDaddy DNS.

GoDaddyPy library works only with Python v. 2.7.

We recommend to use virtualenv.

Make clone of repo and change dir:

git clone https://github.com/vensder/aws_godaddy_update_record.git
cd aws_godaddy_update_record

Make virtual environment for python 2.7 version. For example, do this on CentOS-like distros:

sudo yum install python27-virtualenv.noarch
virtualenv env
source env/bin/activate
pip install godaddypy

Or for Ubuntu-like distros:

sudo apt-get install virtualenv
virtualenv env
source env/bin/activate
pip install godaddypy

You can add running command of the script into file /etc/rc.local for auto starting after rebooting. This is example of the /etc/rc.local file:

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

/bin/bash /home/ec2-user/aws_godaddy_update_record/update_ip.sh

touch /var/lock/subsys/local

On Ubuntu 14.04 you can get an error:

/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "aws_godaddy_record_update.py", line 37, in <module>
    a_records = client.get_a_records(MY_DOMAIN)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/godaddypy/client.py", line 112, in get_a_records
    data = self._get(url, headers=self._get_headers()).json()
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/godaddypy/client.py", line 52, in _get
    resp = requests.get(url, **kwargs)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/api.py", line 67, in get
    return request('get', url, params=params, **kwargs)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/ubuntu/aws_godaddy_update_record/env/local/lib/python2.7/site-packages/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: hostname 'api.godaddy.com' doesn't match either of 'developer.godaddy.com', 'www.developer.godaddy.com'

Just update a ndg-httpsclient with command:

source env/bin/activate
pip install --upgrade ndg-httpsclient

aws_godaddy_update_record's People

Contributors

vensder 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.