Giter VIP home page Giter VIP logo

update-route53's Introduction

update-route53

Script to update AWS Route 53 record set on startup of Lightsail instance.

The public IP address given to a Lightsail instance changes after an instance stops and starts again. This causes any Route53 recordsets to become instantly outdated. An easy fix is to use (VPC) Elastic IPs, which stick with the EC2 after a restart; however, you can only have 5 per region and need a good excuse when asking Amazon to increase it.

Table of Contents

  Pre-requisites
    IAM Role
    AWS CLI
  Download the Script
  Update Script Variables
  Set Script Permissions
  Add to Runlevels
  References

1. Pre-requisites

IAM Role already created with permissions to update Route53.

We are using DNSManagers_NCCER. We have three NCCER policies, one for each domain in Route53. BYF domain is separate.

AWS Command Line Interface is already installed

Install the AWS CLI

unzip awscliv2.zip
sudo ./aws/install 

### AWS ClI is already correctly configured Configure the AWS CLI using sudo so that the configuration applies to root. ```sudo aws configure``` TODO: Add instructions for service-linked role configuration (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-using-service-linked-roles)

2. Download the Script

Download the script into your /etc/init.d directory.

 sudo curl --location "https://raw.githubusercontent.com/nccer-org/update-route53/master/update-route53.sh" --output /etc/init.d/update-route53.sh 



3. Update Script AWS Variables

Update the ZONEID and RECORDSET variables in the script to reflect the Zone and Route53 record you want to change.

4. Set Script Permissions

Give the script execute permissions.

sudo chmod +x /etc/init.d/update-route53.sh

5. Add to Runlevels

Add the script to the default runlevels so it will be called at runtime.

sudo update-rc.d update-route53.sh defaults

Note: To remove the script from runlevels...sudo update-rc.d /etc/init.d/update-route53.sh remove


### Testing Functionality IP addresses dont usually change when you reboot. To force an IP change on an existing instance, stop the instance, wait until it has completely shut down, then start it again. This will cause a new IP to be applied, and the script will update DNS.

If something doesn't work, check the log file as configured

References

Creating the script:

Running script at startup:

AWS Command Line Interface Installation:

AWS IAM Policies:

update-route53's People

Contributors

jeremyhatfield avatar bmercernccer avatar

Forkers

amykrizanwang

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.