
WebService::Amazon::Route53 - Perl interface to Amazon Route 53 API

Version 0.013

WebService::Amazon::Route53 provides an interface to Amazon Route 53 DNS service.
use WebService::Amazon::Route53;
my $r53 = WebService::Amazon::Route53->new(id => 'ROUTE53ID',
key => 'SECRETKEY');
# Create a new zone
$r53->create_hosted_zone(name => 'example.com.',
caller_reference => 'example.com_migration_01');
# Get zone information
my $zone = $r53->find_hosted_zone(name => 'example.com.');
# Create a new record
$r53->change_resource_record_sets(zone_id => $zone->{id},
action => 'create',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
value => '12.34.56.78');
# Modify records
$r53->change_resource_record_sets(zone_id => $zone->{id},
changes => [
{
action => 'delete',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
value => '12.34.56.78'
},
{
action => 'create',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
records => [
'34.56.78.90',
'56.78.90.12'
]
}
]);

Required parameters are marked as such, other parameters are optional.
Instance methods return undef on failure. More detailed error information can be obtained by calling "error".
Creates a new instance of WebService::Amazon::Route53.
my $r53 = WebService::Amazon::Route53->new(id => 'ROUTE53ID',
key => 'SECRETKEY');
Parameters:
(Required) AWS access key ID.
(Required) Secret access key.
Gets a list of hosted zones.
Called in scalar context:
$zones = $r53->list_hosted_zones(max_items => 15);
Called in list context:
($zones, $next_marker) = $r53->list_hosted_zones(marker => '456ZONEID',
max_items => 15);
Parameters:
Indicates where to begin the result set. This is the ID of the last hosted zone which will not be included in the results.
The maximum number of hosted zones to retrieve.
Returns: A reference to an array of hash references, containing zone data. Example:
$zones = [
{
'id' => '/hostedzone/123ZONEID',
'name' => 'example.com.',
'caller_reference' => 'ExampleZone',
'config' => {
'comment' => 'This is my first hosted zone'
}
},
{
'id' => '/hostedzone/456ZONEID',
'name' => 'example2.com.',
'caller_reference' => 'ExampleZone2',
'config' => {
'comment' => 'This is my second hosted zone'
}
}
];
When called in list context, it also returns the next marker to pass to a subsequent call to list_hosted_zones to get the next set of results. If this is the last set of results, next marker will be undef.
Gets hosted zone data.
$zone = get_hosted_zone(zone_id => '123ZONEID');
Parameters:
(Required) Hosted zone ID.
Returns: A reference to a hash containing zone data. Example:
$zone = {
'id' => '/hostedzone/123ZONEID'
'name' => 'example.com.',
'caller_reference' => 'ExampleZone',
'config' => {
'comment' => 'This is my first hosted zone'
}
};
Finds the first hosted zone with the given name.
$zone = $r53->find_hosted_zone(name => 'example.com.');
Parameters:
(Required) Hosted zone name.
Returns: A reference to a hash containing zone data (see "get_hosted_zone"), or 0 if there is no hosted zone with the given name.
Creates a new hosted zone.
$response = $r53->create_hosted_zone(name => 'example.com.',
caller_reference => 'example.com_01');
Parameters:
(Required) New hosted zone name.
(Required) A unique string that identifies the request.
Returns: A reference to a hash containing new zone data, change description, and name servers information. Example:
$response = {
'zone' => {
'id' => '/hostedzone/123ZONEID'
'name' => 'example.com.',
'caller_reference' => 'example.com_01',
'config' => {}
},
'change_info' => {
'id' => '/change/123CHANGEID'
'submitted_at' => '2011-08-30T23:54:53.221Z',
'status' => 'PENDING'
},
'delegation_set' => {
'name_servers' => [
'ns-001.awsdns-01.net',
'ns-002.awsdns-02.net',
'ns-003.awsdns-03.net',
'ns-004.awsdns-04.net'
]
},
};
Deletes a hosted zone.
$change_info = $r53->delete_hosted_zone(zone_id => '123ZONEID');
Parameters:
(Required) Hosted zone ID.
Returns: A reference to a hash containing change information. Example:
$change_info = {
'id' => '/change/123CHANGEID'
'submitted_at' => '2011-08-31T00:04:37.456Z',
'status' => 'PENDING'
};
Lists resource record sets for a hosted zone.
Called in scalar context:
$record_sets = $r53->list_resource_record_sets(zone_id => '123ZONEID');
Called in list context:
($record_sets, $next_record) =
$r53->list_resource_record_sets(zone_id => '123ZONEID');
Parameters:
(Required) Hosted zone ID.
The first domain name (in lexicographic order) to retrieve.
DNS record type of the next resource record set to retrieve.
Set identifier for the next source record set to retrieve. This is needed when the previous set of results has been truncated for a given DNS name and type.
The maximum number of records to be retrieved. The default is 100, and it's the maximum allowed value.
Returns: A reference to an array of hash references, containing record set data. Example:
$record_sets = [
{
name => 'example.com.',
type => 'MX'
ttl => 86400,
records => [
'10 mail.example.com'
]
},
{
name => 'example.com.',
type => 'NS',
ttl => 172800,
records => [
'ns-001.awsdns-01.net.',
'ns-002.awsdns-02.net.',
'ns-003.awsdns-03.net.',
'ns-004.awsdns-04.net.'
]
}
];
When called in list context, it also returns a reference to a hash, containing information on the next record which can be passed to a subsequent call to list_resource_record_sets to get the next set of records (using the name and type parameters). Example:
$next_record = {
name => 'www.example.com.',
type => 'A'
};
If this is the last set of records, next record will be undef.
Makes changes to DNS record sets.
$change_info = $r53->change_resource_record_sets(zone_id => '123ZONEID',
changes => [
# Delete the current A record
{
action => 'delete',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
value => '12.34.56.78'
},
# Create a new A record with a different value
{
action => 'create',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
value => '34.56.78.90'
},
# Create two new MX records
{
action => 'create',
name => 'example.com.',
type => 'MX',
ttl => 86400,
records => [
'10 mail.example.com',
'20 mail2.example.com'
]
}
]);
If there is just one change to be made, you can use the simplified call syntax, and pass the change parameters directly, instead of using the changes parameter:
$change_info = $r53->change_resource_record_sets(zone_id => '123ZONEID',
action => 'delete',
name => 'www.example.com.',
type => 'A',
ttl => 86400,
value => '12.34.56.78');
Parameters:
(Required) Hosted zone ID.
(Required) A reference to an array of hashes, describing the changes to be made. If there is just one change, the array may be omitted and change parameters may be passed directly.
Change parameters:
(Required) The action to perform ("create" or "delete").
(Required) The name of the domain to perform the action on.
(Required) The DNS record type.
The DNS record time to live (TTL), in seconds.
A reference to an array of strings that represent the current or new record values. If there is just one value, you can use the value parameter instead.
Current or new DNS record value. For multiple record values, use the records parameter.
Returns: A reference to a hash containing change information. Example:
$change_info = {
'id' => '/change/123CHANGEID'
'submitted_at' => '2011-08-31T00:04:37.456Z',
'status' => 'PENDING'
};
Returns the last error.
$error = $r53->error;
Returns: A reference to a hash containing the type, code, and message of the last error. Example:
$error = {
'type' => 'Sender',
'message' => 'FATAL problem: UnsupportedCharacter encountered at ',
'code' => 'InvalidDomainName'
};

Michal Wojciechowski, <odyniec at cpan.org>

Please report any bugs or feature requests to bug-webservice-amazon-route53 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Amazon-Route53. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc WebService::Amazon::Route53
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebService-Amazon-Route53

http://docs.amazonwebservices.com/Route53/latest/APIReference/


Copyright 2011 Michal Wojciechowski.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.