Skip to content

Instantly share code, notes, and snippets.

@einyx
Created April 11, 2014 13:09
Show Gist options
  • Save einyx/cb419479f45bc3126868 to your computer and use it in GitHub Desktop.
Save einyx/cb419479f45bc3126868 to your computer and use it in GitHub Desktop.
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