use strict; use warnings; use Net::Amazon::Route53; my $route53 = Net::Amazon::Route53->new( id => '...', key => '...' ); my @zones = $route53->get_hosted_zones; for my $zone ( @zones ) { # use the Net::Amazon::Route53::HostedZone object }
The Amazon id, needed to contact Amazon's Route 53.
The Amazon key, needed to contact Amazon's Route 53.
Internal user agent object used to perform requests to Amazon's Route 53
request
my $hr_xml_response = $self->request( $method, $url );
Requests something from Amazon Route 53, signing the request. Uses LWP::UserAgent internally, and returns the hashref obtained from the request. Dies on error, showing the request's error given by the API.
get_hosted_zones
my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' ); my @zones = $route53->get_hosted_zones(); my $zone = $route53->get_hosted_zones( 'example.com.' );
Gets one or more Net::Amazon::Route53::HostedZone objects, representing the zones associated with the account.
Takes an optional parameter indicating the name of the wanted hosted zone.
my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' ); my @records = record_generating_subroutine(); # returning an array of Net::Amazon::Route53::ResourceRecordSets my $change = $route53->batch_create(\@records); # Or ->batch_create(\@records,1) if you want to wait
Turns an arrayref of Net::Amazon::Route53::ResourceRecordSet objects into one big create request. All records must belong to the same hosted zone.
Takes an optional boolean parameter, wait, to indicate whether the request should return straightaway (default, or when wait is 0) or it should wait until the request is INSYNC according to the Change's status.
wait
0
INSYNC
Returns a Net::Amazon::Route53::Change object representing the change requested.
my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' ); my $hosted_zone = $route_53->get_hosted_zones("example.com."); my $old_records = $hosted_zone->resource_record_sets; my $new_records = record_generating_subroutine(); my $change = $route53->atomic_update($old_records,$new_records); # Or ->atomic_update($ref1,$ref2,1) if you want to wait
Be warned: this method can be destructive. Give it the arrayref of records currently in your zone and an arrayref of records representing the desired state of your zone, and it will create, change, and delete the current records in the zone to match the set you submitted.
Don't send the Amazon Route53 NS or SOA record in the set of original records.
This method discovers which records needs to be deleted/created, e.g., changed, which ones need simply to be created for the first time, and deletes records not defined in the new set. It's an "all-in-one, all-at-once" update for all the records in your zone. This, and the fact that it is destructive, is why it is called atomic_update.
atomic_update
my $route53 = Net::Amazon::Route53->new( key => '...', id => '...' ); my $hosted_zone = $route_53->get_hosted_zones("example.com."); my $recordset_changes = recordset_changes_generating_subroutine(); my $change = $route53->batch_change($recordset_changes); # Or ->batch_change($recordset_changes,1) if you want to wait
This method takes an arrayref of Net::Amazon::Route53::ResourceRecordSet::Change objects and the optional wait argument, and makes one big request to change all the records at once.
Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet::Change object and returns the xml to create that single record.
Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet object and returns the xml to delete that single record.
Private method for xml templating. Takes an Net::Amazon::Route53::ResourceRecordSet::Change object and returns the xml to change, i.e., delete and create, that single record.
Private method for xml templating. Returns a header string.
Private method for xml templating. Returns a footer string.
Net::Amazon::Route53::HostedZone http://docs.amazonwebservices.com/Route53/latest/APIReference/
Marco FONTANI <mfontani@cpan.org>
Daiji Hirata <hirata@uva.ne.jp> Amiri Barksdale <amiri@arisdottle.net> Chris Weyl <cweyl@alumni.drew.edu> Jason <jasonjayr+oss@gmail.com> Ulrich Kautz <ulrich.kautz@googlemail.com>
This software is copyright (c) 2011 by Marco FONTANI.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Amazon::Route53, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Amazon::Route53
CPAN shell
perl -MCPAN -e shell install Net::Amazon::Route53
For more information on module installation, please visit the detailed CPAN module installation guide.