This is my first blog post, I thought it would be good to start giving back to the DevOps community some of the knowledge I have learned, and share code from others that I have found useful.
I wanted to start with an easy shell script I use on my Linux OpenVPN server running in my test VPC environment on AWS. I shutdown this environment nightly when not using this, since I am frugal and do not want to pay $0.005 per hour for an Elastic IP attached to a non-running EC2 instance, I use a dynamic public IP address from Amazon.
So the script will initially create a CNAME record in AWS pointing to the Public DNS record of the EC2 instance (i.e. ec2-52-26-243-195.us-west-2.compute.amazonaws.com). Then add the script to crontab with the “@reboot” option, and each subsequental time the instance is cold booted (picks up new public IP) it will update the CNAME record in Route53. Now this script can be easily modified to create whatever type of DNS record you may choose.
You can find the installation instructions and code over on GitHub (cmachler/ec2-register-dns-route53).
Please feel free to comment with any questions.
Next up I will be discussing using AWS’s Lambda service to backup EBS volumes associated with EC2 instances in my environment. This will be my first time playing with Lambda, so pretty excited to see how it works.