- 以下のようにしてスクリプトを取得する。もしくは、downloadして解凍。
$ git clone git://gist.github.com/3973319.git
- 実行
- 自マシンでのIPアドレスを取得してRoute53にhoge.example.com.のAレコードを設定する
$ ruby r53_set_dynamicdns.rb --help
Usage: r53_set_dynamicdns [options]
-a, --access-key-id=VAL
-s, --secret-access-key=VAL
-z, --hosted-zone-name=VAL
-r, --record-name=VAL
-v, --record-value=VAL default:192.168.0.1
-t, --record-ttl=VAL default:300
-k, --record-kind=VAL default:A
-c, --timeout-count=VAL default:10
-w, --timeout-wait=VAL default:5
$ ruby r53_set_dynamicdns.rb -a [access-key-id] -s [secret-access-key] -z example.com. -r hoge.example.com.
$ sudo yum update -y
$ sudo yum install rubygem-aws-sdk git -y
$ git clone git://gist.github.com/3973319.git
$ cd 3973319
$ ruby r53_set_dynamicdns.rb -a [access-key-id] -s [secret-access-key] -z example.com. -r hoge.example.com.
# => 実行を確認
$ echo "ruby /home/ec2-user/3973319/r53_set_dynamicdns.rb -a [access-key-id] -s [secret-access-key] -z example.com. -r hoge.example.com." | sudo tee -a /etc/rc.local
# => 起動時に実行するように設定
$ ruby -a [access-key-id] -s [secret-access-key] r53_set_dynamicdns.rb -z example.com. -r hoge.example.com. -k CNAME -v `wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname`