route53 - Manage your DNS entries on Amazon's Route53 service
route53 will manage your Amazon Route 53 account
route53 {key and id} [options] action [action arguments]
Either -keyfile and -keyname or -id and -key must be provided.
-keyfile
-keyname
-id
-key
The file which contains the keys and ids for the Route53 service, in the format used by Amazon's "route53.pl" script:
%awsSecretAccessKeys = ( "my-aws-account" => { id => "ABCDEFG", key => "12345", }, );
Defaults to ~/.aws-secrets when not given.
~/.aws-secrets
The name of the key to be used; in the above -keyfile example, it could be my-aws-account.
my-aws-account
The AWS id to be used; in the above example it could be ABCDEFG.
ABCDEFG
The AWS key to be used; in the above example it could be 12345.
12345
For the commands which support it, waits for the change requested to be in INSYNC status before returning. This is done by querying for the change status every 2 seconds until the change is INSYNC. Defaults to 0, meaning the requests return immediately.
INSYNC
Prints the help page and exits
Prints the manual page and exits
route53 performs a number of actions, each of which may take a number of arguments:
Lists the hosted zones currently associated with the account. Takes no arguments.
Lists the nameservers for all the hosted zones currently associated with the account. Takes a hosted zone name as an optional argument to just show the nameservers associated with that zone.
Performs actions on a specific DNS zone. If a zone name is given, rather than an action, it shows the nameservers associated with the zone.
Possible actions are:
Needs --comment and optional --callerreference. Creates a new zone. Supports the --wait option.
--comment
--callerreference
--wait
Deletes the zone. The zone needs to be empty (containing only NS and SOA entries) before Amazon's Route53 allows its deletion. Supports the --wait option.
Performs actions on a specific DNS zone record. A DNS zone name must be given. If no action is provided, it lists all records for the zone.
This is the default action if no action is specified. Lists all DNS records for the zone.
If a --type is given, it lists only the records of the given type. If a --name is given, it lists only the records which have the given name. If a --ttl is given, it lists only the records which have the given TTL. If a --value is given, it lists only the records which have a value matching the given one.
--type
--name
--ttl
--value
Wildcard records (i.e. *.example.com) are displayed as \052.example.com. The same format must be used to create a wildcard record.
*.example.com
\052.example.com
Deletes one DNS record for the zone given. Can only delete a record which is univocally identified by filtering the records list by --name, --type, --ttl and --value. Dies listing the matching records if too many entries match. Supports the --wait option.
Creates a DNS record for the zone given. Needs all the following options in order to create the record: --name, --type, --ttl and one or more --value. Supports the --wait option.
You need to specify your credentials with one of the following notations. All the examples below use the --keyname notation, defaulting to using the ~/.aws-secrets file.
--keyname
# Uses ~/.aws-secrets as repository, key name is specified $ route53 --keyname my-aws-keyname # Uses the given key file and key name $ route53 --keyfile ~/.aws --keyname my-aws-keyname # Uses the given key and id $ route53 --key ABCDE --id DEFG
Lists the zones names, ids and comments:
$ route53 --keyname my-aws-account list Hosted zone: id: /hostedzone/ABCDEFG name: example.com. callerreference: FGHIJK comment: Zone for example.com. Hosted zone: id: /hostedzone/FGHJKL name: anotherexample.com. callerreference: QWERTY comment: Zone for anotherexample.com.
Displays a verbose list of the zone details and the nameservers which are authoritative for the zone:
$ route53 --keyname my-aws-account nameservers Hosted zone: id: /hostedzone/ABCDEFG name: example.com. callerreference: FGHIJK comment: Zone for example.com. nameserver: ns-123.awsdns-123.com nameserver: ns-123.awsdns-123.co.uk nameserver: ns-123.awsdns-123.org Hosted zone: id: /hostedzone/FGHJKL name: anotherexample.com. callerreference: QWERTY comment: Zone for anotherexample.com. nameserver: ns-456.awsdns-456.com nameserver: ns-456.awsdns-456.co.uk nameserver: ns-456.awsdns-456.org
Displays a terse list of the nameservers, one per line:
$ route53 --keyname my-aws-account nameservers example.com. ns-123.awsdns-123.com ns-123.awsdns-123.co.uk ns-123.awsdns-123.org
This allows the nameservers to be used in scripting:
$ for nameserver in $( route53 --keyname my-aws-account nameservers example.com. ); do # do whatever you want with $nameserver done;
Creates a new zone:
$ route53 --keyname my-aws-account zone create example.com. \ --comment 'Zone for example.com.' --callerreference 'unique id for this'
You can optionally specify --wait to wait for the zone to have been effectively created. Otherwise the command returns as soon as the request has been sent to Route 53.
Deletes a zone (assuming the zone contains only SOA and NS records):
SOA
NS
$ route53 --keyname my-aws-account zone delete example.com.
You can optionally specify --wait to wait for the zone to have been effectively deleted. Otherwise the command returns as soon as the request has been sent to Route 53.
Lists all DNS records for a zone:
$ route53 --keyname my-aws-account record list example.com. example.com. A 14400 127.0.0.1 example.com. MX 14400 127.0.0.1 example.com. NS 172800 ns-123.awsdns-123.com. ns-123.awsdns-123.co.uk. ns-123.awsdns-123.org. example.com. SOA 900 ns-123.awsdns-123.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400 \052.example.com. A 300 127.0.0.1
You can optionally specify --type to display only DNS records of a given type:
$ route53 --keyname my-aws-account record list example.com. --type A example.com. A 14400 127.0.0.1 \052.example.com. A 300 127.0.0.1
This example assumes we want to remove the \052.example.com. entry. One can check which parameters are needed to get the correct entry with the record list first:
\052.example.com.
record list
$ route53 --keyname my-aws-account record list example.com. --type A example.com. A 14400 127.0.0.1 \052.example.com. A 300 127.0.0.1 $ route53 --keyname my-aws-account record list example.com. --type A --ttl 300 \052.example.com. A 300 127.0.0.1
Or can read the error message given in case there are too many matching records:
$ route53 --keyname my-aws-account record delete example.com. --type A Too many records match: example.com. A 14400 127.0.0.1 \052.example.com. A 300 127.0.0.1
The lone record deletion:
$ route53 --keyname my-aws-account record delete example.com. --type A --ttl 300
This adds a new record for the zone:
$ route53 --keyname my-aws-account record create example.com. \ --name test.example.com. --type A --ttl 300 \ --value 127.0.0.1
Marco FONTANI <mfontani@cpan.org>
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.