Giter Club home page Giter Club logo

ruby_route_53's Introduction

Ruby Interface for Amazon's Route 53

This interface can either be used as a command line tool or as a library from within your existing ruby project. It provides a way to interact with Amazon's Route 53 service.

Costs & Impact

At the time of this writing Amazon charges $1/zone/month. This includes zones that have been created and deleted and then recreated outside of the normal 12 hour grace period. The creator of this gem is not responsible for costs incurred while using this interface or unexpected oepration or bugs which may incur a cost for the user. The creator is also not responsible for any downtime incurred or disruption in service from the usage of this tool. DNS can be a tricky thing, be careful and always make sure you have a backup of your zone prior to mucking around with it. (route53 -l example.com.)

Latest Version

The latest source should be available on my github account and if you can't obtain it using the gem command you can go directly to the gem page hosted on rubygems.

Installation

Installing the Gem

sudo gem install route53

Ubuntu with precompiled dependencies

sudo apt-get update
sudo apt-get install ruby rubygems libopenssl-ruby libhmac-ruby libbuilder-ruby libhpricot-ruby
sudo gem install route53 --ignore-dependencies
/var/lib/gems/1.X/gems/route53-W.Y.Z/bin/route53

#When working with the library and using this method you may need to require the library manually
require '/var/lib/gems/1.X/gems/route53-W.Y.Z/lib/route53'

Ubuntu with building dependencies

sudo apt-get update
sudo apt-get install ruby rubygems ruby-dev build-essential libopenssl-ruby
sudo gem install route53
/var/lib/gems/1.X/bin/route53

The first time you run the gem in command line mode you'll be prompted to setup. You'll want to have your Amazon access and secret key ready.

You've either elected to run the setup or a configuration file could not be found.
Please answer the following prompts.
Amazon Access Key: []
Amazon Secret Key: []
Amazon Route 53 API Version: [2011-05-05]
Amazon Route 53 Endpoint: [https://route53.amazonaws.com/]
Default TTL: [3600]
Save the configuration file to "~/.route53"?: [Y]

Command Line Options

Usage: route53 [options]

-v, --version                    Print Version Information
-h, --help                       Show this message
-V, --verbose                    Verbose Output
-l, --list [ZONE]                Receive a list of all zones or specify a zone to view
-n, --new [ZONE]                 Create a new Zone
-d, --delete [ZONE]              Delete a Zone
-z, --zone [ZONE]                Specify a zone to perform an operation on. Either in 'example.com.' or '/hostedzone/XXX' format
-c, --create                     Create a new record
-r, --remove                     Remove a record
-g, --change                     Change a record
    --name [NAME]                Specify a name for a record
    --type [TYPE]                Specify a type for a record
    --ttl [TTL]                  Specify a TTL for a record
    --weight [WEIGHT]            Specify a Weight for a record
    --ident [IDENTIFIER]         Specify a unique identifier for a record
    --values [VALUE1],[VALUE2],[VALUE3]
                                 Specify one or multiple values for a record
    --zone-apex-id [ZONE_APEX_ID]
                                 Specify a zone apex if for the record
-m, --comment [COMMENT]          Provide a comment for this operation
    --no-wait                    Do not wait for actions to finish syncing.
-s, --setup                      Run the setup ptogram to create your configuration file.
-f, --file [CONFIGFILE]          Specify a configuration file to use
    --access [ACCESSKEY]         Specify an access key on the command line.
    --secret [SECRETKEY]         Specify a secret key on the command line. WARNING: Not a good idea
    --no-upgrade                 Do not automatically upgrade the route53 api spec for this version.

Command Line Usage

Once route53 is installed, started and has been setup you're ready to start. You can use the following examples to get started.

#Creating a new zone
route53 -n example.com.

#List Operations
route53 -l #Get all zones for this account
route53 -l example.com. #Get all records for this account within the zone example.com.

#Create a new record within our newly created zone.
route53 --zone example.com. -c --name foo.example.com. --type CNAME --ttl 3600 --values example.com.

#New MX Record for a Google Apps hosted domain
route53 --zone example.com. -c --name example.com. --type MX --ttl 3600 \
--values "10 ASPMX.L.GOOGLE.com.","20 ALT1.ASPMX.L.GOOGLE.com.","30 ALT2.ASPMX.L.GOOGLE.com.","40 ASPMX2.GOOGLEMAIL.com.","50 ASPMX3.GOOGLEMAIL.com."

#Update the TTL of a record (Leave values nil to leave them alone)
#You'll be prompted to select the record from a list.
#If updating values for a record, make sure to includ all other values. Otherwise they will be dropped
route53 --zone example.com. -g --ttl 600

#Creating a record that corresponds to an Amazon ELB (zone apex support)
route53 --zone example.com. -c --name example. --zone-apex-id Z3DZXE0XXXXXXX --type A --values my-load-balancer-XXXXXXX.us-east-1.elb.amazonaws.com

#Creating weighted record sets
route53 example.com. -c --name www.example.com. --weight 15 --ident "75 percent of traffic to pool1" --type CNAME --values pool1.example.com.
route53 example.com. -c --name www.example.com. --weight 5 --ident "25 percent of traffic to pool2" --type CNAME --values pool2.example.com.

#Creating a wildcard domain
route53 example.com. -c --name *.example.com --type CNAME --values pool1.example.com.

#Deleting a zone - First remove all records except the NS and SOA record. Then delete the zone.
route53 --zone example.com. -r
route53 -d example.com.

Library Usage

If you're using this as a library for your own ruby project you can load it and perform operations by using the following examples.

require 'route53'

#Creating a Connection object
conn = Route53::Connection.new(my_access_key,my_secret_key) #opens connection

#Creating a new zone and working with responses
new_zone = Route53::Zone.new("example.com.",nil,conn) #Create a new zone "example.com."
resp = new_zone.create_zone #Creates a new zone
exit 1 if resp.error? #Exit if there was an error. The AWSResponse Class automatically prints out error messages to STDERR.
while resp.pending? #Waits for response to sync on Amazon's servers.
  sleep 1 #If you'll be performing operations on this newly created zone you'll probably want to wait.
end

#List Operations
zones = conn.get_zones #Requests list of all zones for this account
records = zones.first.get_records #Gets list of all records for a specific zone

#Create a new record within our newly created zone.
new_record = Route53::DNSRecord.new("foo.example.com.","CNAME","3600",["example.com."],new_zone)
resp = new_record.create 

#New MX Record for a Google Apps hosted domain
new_mx_record = Route53::DNSRecord.new("example.com.","MX","3600",
                  ["10 ASPMX.L.GOOGLE.com.",
                  "20 ALT1.ASPMX.L.GOOGLE.com.",
                  "30 ALT2.ASPMX.L.GOOGLE.com.",
                  "40 ASPMX2.GOOGLEMAIL.com.",
                  "50 ASPMX3.GOOGLEMAIL.com."],
                  new_zone)
resp = new_mx_record.create

#Update the TTL of a record (Leave values nil to leave them alone)
#If updating values for a record, make sure to includ all other values. Otherwise they will be dropped
resp = new_record.update(nil,nil,"600",nil)

#Deleting a zone
#A zone can't be deleted until all of it's records have been deleted (Except for 1 NS record and 1 SOA record)
new_zone.get_records.each do |record|
  unless record.type == 'NS' || record.type == 'SOA'
    record.delete
  end
end
new_zone.delete_zone

Requirements

Written with Ruby 1.9.2 on an Ubuntu Linux machine. Smoke tested on an Ubuntu Linux machine with Ruby 1.8.7.

Amazon AWS account with Route 53 opted into - See the signup link at http://aws.amazon.com/route53/ ruby openssl support ruby-hmac nokogiri builder

Support and Bugs

Bug reports are appreciated and encouraged. Please either file a detailed issue on Github or send an email to [email protected].

Contact

This ruby interface for Amazon's Route 53 service was created by Philip Corliss ([email protected]) 50projects.com. You can find more information on him and 50projects at http://blog.50projects.com

License

Ruby Route 53 is licensed under the GPL. See the LICENSE file for details.

ruby_route_53's People

Contributors

ab avatar andytinycat avatar ekohl avatar garrettg avatar kvz avatar patrickviet avatar pcorliss avatar rsprabery avatar sawanoboly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby_route_53's Issues

undefined method `innerText'

When removing a record, I suddenly get:

/Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53.rb:173:in `get_records': undefined method `innerText' for nil:NilClass (NoMethodError)
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53.rb:164:in `each'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53.rb:164:in `get_records'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53/cli.rb:233:in `remove_record'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53/cli.rb:232:in `each'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53/cli.rb:232:in `remove_record'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53/cli.rb:128:in `process_arguments'
from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/lib/route53/cli.rb:32:in `run'
    from /Users/kevin/.gem/ruby/1.8/gems/route53-0.1.8/bin/route53:11
    from /usr/bin/route53:19:in `load'
    from /usr/bin/route53:19

Any ideas?

Finding the closest zone

Reading

unless name.nil? || name.start_with?("/hostedzone/")
name_arr = name.split('.')
(0 ... name_arr.size).each do |i|
search_domain = name_arr.last(name_arr.size-i).join('.')+"."
zone_select = zones.select { |z| z.name == search_domain }
return zone_select
end
return nil
end
it would suggest that it almost is able to find the closes zone for a record. I'd expect that if the return was changed to return zone_select if zone_select.any? it is able to find example.com when you call get_zones('host.sub.example.com') but right now it would return []. Is this an oversight, by design or am I missing something?

Impossible to update a zone apex A record to a regular A record

Given a DNSRecord object that represents a zone apex virtual A record, it isn't possible to update it to be a regular A record (with IP address) using update:

record.update(nil,nil,nil,ip_address,nil,nil)

causes the error below, because passing nil for the zone_apez param of update() indicates no-change. There seems to be no way to set it to nil (if that is the appropriate value for non-apex virtual A records).

ERROR: Amazon returned an error for the request.
ERROR: RAW_XML:
<Error>SenderInvalidChangeBatchTried to create an alias that targets resortsvacation.com., type A in zone Z3DZXE0Q79N41H, but that target was not foundedc17977-1d34-11e1-9388-b50d1a7693b8
ERROR: InvalidChangeBatch: Tried to create an alias that targets resortsvacation.com., type A in zone Z3DZXE0Q79N41H, but that target was not found
.
What now? You may have tried to delete a NS or SOA record. This error is safe to ignore if you're just trying to delete all records as part of a zone prior to deleting the zone. Or you may have tried to create a record that already exists. Otherwise please file a bug by sending a detailed bug ...

cant create A record

Hello I'm having some problem creating an A record with route53 the only example I have is with a CNAME and not sure if it works the same way but I keep getting:

var/lib/gems/1.9.1/gems/route53-0.2.1/lib/route53.rb:364:in create': undefined methodperform_actions' for "XXXmyinfoXXX":String (NoMethodError)
from ./pf_zone-test.rb:22:in amazon' from ./pf_zone-test.rb:25:in

'

here is an example code strip down so you can review:

!/usr/bin/env ruby

require 'rubygems'
require 'zonefile'
require 'route53'

domain="mydomain.com"
bindfile="named/zones/db.#{domain}"
my_access_key="xxxxxxxxxxxxxx"
my_secret_key="xxxxxxxxxxxxxxx"

conn = Route53::Connection.new(my_access_key,my_secret_key)

here only if we want to create a new zone, this works

new_zone = Route53::Zone.new("#{domain}",nil,conn)

resp = new_zone.create_zone

def amazon(type, record1, record2, domain)
puts "#{type} #{record1} #{record2} #{domain}"
new_record = Route53::DNSRecord.new("#{record1}","#{type}","600",["#{record2}"],domain )
resp = new_record.create
end

amazon("A","new.mydomain.com","4.4.4.4","#{domain}")

hope you can help me on this im stuck.

Rate Exceeded Throttling

I have no idea of it.Several Days ago ,It went well.But those days ,It always throws exceptions. The message is Rate exceeded and type is Sender ,Code is Throttling.Not just one server threw the error.Three of our servers are throwing the exception.When retrieving data from Amazon,the error is NFO Exception Retriable invalid response returned from DescribeJobFlows: {"Error"=>{"Message"=>"Rate exceeded", "Code"=>"Throttling", "Type"=>"Sender"}} while calling DescribeJobFlows on Amazon::Coral::ElasticMapReduceClient, retrying in 3.0 seconds Again.
Please,help me ! I really have no idea of it .Thanks very much.

can't update DNS records

I tried this and it was sucessful but the issue is when i tried to update that i could not find a way how to fix it.:
route53 --zone testdomain.com --name vpn01.testdomain.com. --type A --values 10.146.15.26 -c

I have tried this:
route53 --zone testdomain.com --name vpn01.testdomain.com. --type A --values 10.146.15.27 -g

but it did not work

change all records in hosted zone

is it possible to change all TTL records to hosted zone without to choose one by one ?
"Please select the record to perform the action on."

Doesn't handle PriorRequestNotComplete response

When multiple records are updated by different processes at almost the same time, AWS can respond with a PriorRequestNotComplete error message. This condition doesn't appear to be handled and instead dumps out a nice error

ERROR: Amazon returned an error for the request.
ERROR: RAW_XML: <?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2011-05-05/"><Error><Type>Sender</Type><Code>PriorRequestNotComplete</Code><Message>The request was rejected because Route 53 was still processing a prior request.</Message></Error><RequestId>26cce805-5e34-11e3-8f30-116c04f74132</RequestId></ErrorResponse>
ERROR: PriorRequestNotComplete: The request was rejected because Route 53 was still processing a prior request.

What now? It looks like you've run into an unhandled error. Please send a detailed bug report with the entire input and output from the program to [email protected] or to https://github.com/pcorliss/ruby_route_53/issues and we'll do out best to help you.

The documentation says you should do an incremental backoff in this scenario. While I'm not certain that handling this backoff should be up to the library, when running it as the route53 command line utility, the utility exits with status 0 instead of non-zero to indicate error.


To duplicate this, I just run 2 route53 commands at the same time:

route53 --zone foo --change --name pop ... & route53 --zone foo --change --name tart ...

(it doesn't happen every time, sometimes you have to do it a few times to get it to happen, but it is frequent)

Rate exceeded

I've received a lot of such messages when tried to upload a bunch of changes in a single loop:

ERROR: Amazon returned an error for the request.
ERROR: RAW_XML: <?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2011-05-05/"><Error><Type>Sender</Type><Code>Throttling</Code><Message>Rate exceeded</Message></Error><RequestId>c4aa67a4-d9b3-11e0-bbf6-2d3eee7674ab</RequestId></ErrorResponse>
ERROR: Throttling: Rate exceeded

What now? It looks like you've run into an unhandled error. Please send a detailed bug report with the entire input and output from the program to [email protected] or to https://github.com/pcorliss/ruby_route_53/issues and we'll do out best to help you.

I think there are two options to deal with that: either catch such errors and provide friendly error messages, or adhere to Amazon's rate limit rules.

UPDATE: we are using Route53::DNSRecord.new, not command-line client.

Can't create TXT records with multiple values

Hi,

creating TXT records with multiple values doesn't work. I removed the if/else in forms.py to make it work for me, but that obviously doesn't work for all txt records.

thanks,
Florian

Update SOA record

I would like to know if it's possible to update the default SOA record with the route53 lib.

Because when I update it, I have this error: "ERROR: InvalidChangeBatch: Tried to delete resource record set [name='test.fr.', type='SOA'] but the values provided do not match the current values"

Is it because the function update do a Delete/Create actions(and we can't delete the SOA record), so when he want to delete the prev SOA, he refuse?

Thank you for your answer.

RuntimeError: The underlying hash algorithm has not yet been initialized.

I've got a script which looks something like this; it's about as simple as I could come up with.

def shakedown
    conn = Route53::Connection.new(@key, @secret)
    puts conn.get_zones.inspect
end

It results in a backtrace like the following.```
RuntimeError: The underlying hash algorithm has not yet been initialized.
/Users/me/.rvm/gems/ruby-1.9.2-p180@snet/gems/ruby-hmac-0.4.0/lib/hmac.rb:36:incheck_status' /Users/me/.rvm/gems/ruby-1.9.2-p180@snet/gems/ruby-hmac-0.4.0/lib/hmac.rb:68:in update'
/Users/me/.rvm/gems/ruby-1.9.2-p180@snet/gems/route53-0.2.1/lib/route53.rb:41:in`request'
/Users/me/.rvm/gems/ruby-1.9.2-p180@snet/gems/route53-0.2.1/lib/route53.rb:63:in `get_zones'
/Users/me/git/ops/dns.rb:19:in`shakedown'

--delete Documentation

Should be updated to show that you can delete a zone by the hostedzone id as well, because Route53 allows multiple hosted zones for the same domain.

route53 --zone '/hostedzone/XXXXXXXXXXXXXXX' --delete

The command line documentation and help does not show that as an option, but it does work.

Add support for `UPSERT` type of actions

Current implementation of update method is DELETE and CREATE (

def update(name,type,ttl,values,comment=nil, zone_apex = nil)
prev = self.clone
@name = name unless name.nil?
@type = type unless type.nil?
@ttl = ttl unless ttl.nil?
@values = values unless values.nil?
@zone_apex = zone_apex unless zone_apex.nil?
@zone.perform_actions([
{:action => "DELETE", :record => prev},
{:action => "CREATE", :record => self},
],comment)
end
).

I suggest to change it to action UPSERT, which AWS describe as update of record set (see https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html)

This change optimize our workflow with DNS record sets.

Make this feature sense for you ? Do you prefer implement new method upsert instead of change current update ?

Thx

Unhandled AccessDenied error (minor)

ERROR: Amazon returned an error for the request.
ERROR: RAW_XML:
<Error>SenderAccessDeniedUser: arn:aws:iam::123456789012:user/MyUser is not authorized to perform: route53:ListHostedZonesc87e019b-1c5e-11e1-9388-b50d1a7693b8
ERROR: AccessDenied: User: arn:aws:iam::123456789012:user/MyUser is not authorized to perform: route53:ListHostedZones
What now? It looks like you've run into an unhandled error. Please send a detailed bug report with the entire input and output from the program to [email protected] or to https://github.com/pcorliss/ruby_route_53/issues and we'll do out best to help you.

(Obviously easily avoided by granting the appropriate access)

Alias records can't be created due to lack of EvaluateTargetHealth Parameter

I'm using this library to create record sets that point to websites on S3, but I kept getting the following error:

ERROR: Amazon returned an error for the request.
ERROR: RAW_XML: <?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2012-12-12/">
<Error>
<Type>Sender</Type>
<Code>InvalidInput</Code>
<Message>
Invalid XML ; cvc-complex-type.2.4.b: The content of element 'AliasTarget' is not complete. 
One of '{&quot;https://route53.amazonaws.com/doc/2012-12-12/&quot;:EvaluateTargetHealth}' is expected.
</Message>
</Error>
<RequestId>f75ebc93-87df-11e3-a434-47fc69294b29</RequestId>
</ErrorResponse>

I was able to fix this by making changes in route53.rb. I've added an evaluate_target_health parameter to the constructor that defaults to false and gets inserted when specifying a zone_apex.

I'll send a pull request shortly and you can tell me what you think. Maybe I'm just doing something wrong and code changes aren't necessary.

Thanks!

Unhandled error for bad record type

$ route53 -z connexive.com -c --name jobs.connexive.com --type a --ttl 14400 --values 174.129.219.193
Creating Record
Creating Record jobs.connexive.com. a 14400 174.129.219.193
ERROR: Amazon returned an error for the request.
ERROR: RAW_XML: <?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2010-10-01/"><Error><Type>Sender</Type><Code>ValidationError</Code><Message>1 validation error detected: Value 'a' at 'changeBatch.changes.1.member.resourceRecordSet.type' failed to satisfy constraint: Member must satisfy enum value set: [AAAA, A, NS, SOA, SPF, MX, PTR, CNAME, TXT, SRV]</Message></Error><RequestId>9a99b165-04b5-11e0-9bde-d11c7fd928aa</RequestId></ErrorResponse>
ERROR: ValidationError: 1 validation error detected: Value 'a' at 'changeBatch.changes.1.member.resourceRecordSet.type' failed to satisfy constraint: Member must satisfy enum value set: [AAAA, A, NS, SOA, SPF, MX, PTR, CNAME, TXT, SRV]

With ruby-2.0.0-p247 and builder-3.2.2 in file lib/route53.rb:348 @values is a String, but an Array is expected

Code Usage

puts "       *** generating DNSRecord Object"
new_record = Route53::DNSRecord.new(fqdn, type, ttl, target, zone)
puts "       *** Creating Record using DNSRecord Object"
new_record.create

Console Output

       *** generating DNSRecord Object
           **** FQDN..: [hostname.mydomain.com.] (String)
           **** TTL...: [300] (String)
           **** Type..: [CNAME] (String)
           **** Target: [ec2-x-x-x-x.compute-1.amazonaws.com] (String)
       *** Creating Record using DNSRecord Object

Errors Produced during new_record.create

~/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:348:in `block (3 levels) in gen_change_xml': undefined method `each' for "ec2-x-x-x-x.compute-1.amazonaws.com":String (NoMethodError)
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:347:in `block (2 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:335:in `block in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:333:in `gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:214:in `block (4 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:213:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:213:in `block (3 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:212:in `block (2 levels) in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:210:in `block in gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `call'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:175:in `_nested_structures'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:68:in `tag!'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/builder-3.2.2/lib/builder/xmlbase.rb:93:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:209:in `gen_change_xml'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:225:in `perform_actions'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/route53-0.2.1/lib/route53.rb:364:in `create'
    from ./aws_r53_update_zones.rb:49:in `aws_r53_create_record'
    from ./aws_r53_update_zones.rb:87:in `aws_r53_update_record'
    from ./aws_r53_update_zones.rb:208:in `block in update_r53_for_account'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:290:in `block (2 levels) in each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:97:in `block in method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:289:in `block in each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:97:in `block in method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `each'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/core/data.rb:96:in `method_missing'
    from /home/devon/.rvm/gems/ruby-2.0.0-p247/gems/aws-sdk-1.22.1/lib/aws/ec2/instance_collection.rb:288:in `each'
    from ./aws_r53_update_zones.rb:126:in `update_r53_for_account'
    from ./aws_r53_update_zones.rb:279:in `block in '
    from ./aws_r53_update_zones.rb:269:in `each'
    from ./aws_r53_update_zones.rb:269:in `'

Patch

--- route53.rb  2013-11-18 08:21:04.015019761 -0500
+++ route53.rb  2013-11-18 08:21:04.015019761 -0500
@@ -345,6 +345,10 @@
             }
           else
             record.ResourceRecords { |resources|
+            ### DPH - Accomodate Ruby-2+Builder-3.2.2 Returning a String instead of Array
+            ###       Ruby-1.8/1.9+Builder-x Returned an Array, so probably need this hack
+            ###       for backward compatibiltiy?
+            puts "\nDEBUG: @values ["[email protected]_s+"]\n"
+            if (@values.class.to_s == "String") then @values = [@values] end
+            ### / DPH
               @values.each { |val|
                 resources.ResourceRecord { |record|
                   record.Value(val)

Unable to remove wildcard A record

Hello,

First of all thanks for this wonderful gem. Works great for us.
I may have found 1 issue though. I'm able to add wildcard records like so:

route53 --zone transloadit.com. -r --name \*.camilla.transloadit.com. --type A --values 123.123.123.123

But am unable to remove them:

route53 --zone transloadit.com. -r --name \*.camilla.transloadit.com. --type A
ERROR: Couldn't Find Record for @options.zone of type A.

I tried different ways of quoting & escaping the asterisk, but to no avail.
Any idea?

Allow removal of records without prompt

I was disappointed to discover that this generates a prompt:

route53 --zone example.com. -r --name test.example.com. --type CNAME

I expected that no prompt would be necessary, since I specified the name and type of record to remove. That prompt makes it difficult to use your route53 script in automation scripts (e.g. if you wanted to allow all of your EC2 instances to update their own DNS records).

Import BIND Zone File

It would be very nice to have the ability to import a BIND Zone file like cli53 can do.

"The AWS Access Key Id needs a subscription for the service" error

I think this error will be common for users - perhaps capture it and display the english error?

$ route53 
...
An Error has occured

SenderOptInRequiredThe AWS Access Key Id needs a subscription for the service7ed72d75-03e5-11e0-9bde-d11c7fd928aa
/Library/Ruby/Gems/1.8/gems/route53-0.1.3/lib/route53/cli.rb:209:in `process_arguments': undefined method `each' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/route53-0.1.3/lib/route53/cli.rb:30:in `run'
    from /Library/Ruby/Gems/1.8/gems/route53-0.1.3/bin/route53:11
    from /usr/bin/route53:19:in `load'
    from /usr/bin/route53:19

cant create CNAME in existing zone.

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.