pcorliss / ruby_route_53

Ruby gem and command line tool for Amazon's Route 53 service.
blog.50projects.com
GNU General Public License v3.0
172 stars 32 forks source link

cant create CNAME in existing zone. #18

Closed willejs closed 10 years ago

willejs commented 12 years ago

I wondered if anyone can help me, I am fairly new at ruby, and dont really understand how to specify the zone when creating a CNAME.

When using the example script to create a new zone, and create records with it it works fine. however, im not sure how to specify the zone when creating a CNAME record. the new_zone object is different, and im not sure how it works.

I am trying this, but it doesent work. what does it expect new_zone to be?

new_zone = 'abcd.net. /hostedzone/Z4W3K5G8FBG6R'

new_record = Route53::DNSRecord.new("cbs.abcd.net.","CNAME","3600",["abcd.net."],new_zone) resp = new_record.create how do I specify the zone? I try to do it with a string, but it fails...

/var/lib/gems/1.8/gems/route53-0.2.1/lib/route53.rb:364:in create': undefined methodperform_actions' for "abcd.net. /hostedzone/Z4W3K5G8FBG6R":String (NoMethodError) from ./cname.rb:12

thanks in advance!

ghost commented 12 years ago

Im having similar issue with an A record...

ghost commented 12 years ago

any luck? I have try diverse things and nothing so far..

ghost commented 12 years ago

found this on another problem http://groups.google.com/group/rubyversionmanager/browse_thread/thread/efd3416656b0c04b im running ruby 1.9 this may be causing the issue? what are you running?

pcorliss commented 10 years ago

First off sorry for the long-long delay in getting to this. By now I'm sure you've found a way around this.

This is related to #19

You'll want to create a connection object first. If you have an existing zone object you can either get a list of zones or instantiate it if you have the proper parameters.

conn = Route53::Connection.new(my_access_key,my_secret_key) #opens connection
# Get all the zones
zones = conn.get_zones
new_zone = zones.detect {|zone| zone.name == 'abcd.net.'}
# Or if you want to skip the extra call to amazon you can create it explicitly via the following
new_zone = Route53::Zone.new 'abcd.net.', '/hostedzone/Z4W3K5G8FBG6R', conn
new_record = Route53::DNSRecord.new("cbs.abcd.net.","CNAME","3600",["abcd.net."],new_zone)
resp = new_record.create