Skip to content

Instantly share code, notes, and snippets.

View YarGnawh's full-sized avatar

Ray Hwang YarGnawh

View GitHub Profile
@YarGnawh
YarGnawh / ec2-host-update.sh
Last active February 21, 2017 09:26
AWS EC2 Route53 Update CNAME using JSON USER_DATA
#!/bin/bash
# Write to /usr/local/ec2/ec2-host-update.sh
# Execute chmod 755 ec2-host-update.sh
# Append /usr/local/ec2/ec2-host-update.sh to /etc/rc.local
# Referenced: http://realguess.net/2013/12/06/amazon-route-53-via-command-line/
if ! type "aws" > /dev/null; then
@YarGnawh
YarGnawh / ec2-hostname.sh
Last active March 2, 2016 21:47
AWS EC2 Ubuntu Update HOSTNAME Using JSON USER_DATA
#!/bin/bash
# Write to /usr/local/ec2/ec2-hostname.sh
# Execute chmod 755 ec2-hostname.sh
# Append /usr/local/ec2/ec2-hostname.sh to /etc/rc.local
# Referenced: http://ternarylabs.com/2010/09/15/automatically-configure-hostname-for-new-ec2-instances/
USER_DATA=`/usr/bin/curl -s http://169.254.169.254/latest/user-data`
IPV4=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/public-ipv4`