Created
April 11, 2014 13:09
-
-
Save einyx/cb419479f45bc3126868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'aws-sdk' | |
r53 = AWS::Route53.new | |
# unique id - could be the instance id | |
instance_name = 'webserver-autoscaling-{unique-id}.example.org' | |
public_ip = '123.123.123.123' | |
hosted_zone_id = 'ABC123' | |
r53_options = { | |
:comment => "auto scaling awesomness - *optional*", | |
:changes => [{ | |
:action => "CREATE", | |
:resource_record_set => { | |
:type => "A", | |
:resource_records => [{ | |
:value => public_ip | |
}], | |
:name => instance_name, | |
:ttl => 300 | |
} | |
}] | |
} | |
# make sure check the response for errors | |
r53.client.change_resource_record_sets(:hosted_zone_id => hosted_zone_id, :change_batch => r53_options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment