The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

route53 - Manage your DNS entries on Amazon's Route53 service

DESCRIPTION

route53 will manage your Amazon Route 53 account

SYNOPSIS

route53 {key and id} [options] action [action arguments]

Either -keyfile and -keyname or -id and -key must be provided.

OPTIONS

-keyfile

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.

-keyname

The name of the key to be used; in the above -keyfile example, it could be my-aws-account.

-id

The AWS id to be used; in the above example it could be ABCDEFG.

-key

The AWS key to be used; in the above example it could be 12345.

-wait

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.

-help

Prints the help page and exits

-man

Prints the manual page and exits

ARGUMENTS

route53 performs a number of actions, each of which may take a number of arguments:

list

Lists the hosted zones currently associated with the account. Takes no arguments.

nameservers

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.

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:

create

Needs --comment and optional --callerreference. Creates a new zone. Supports the --wait option.

delete

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.

record

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.

Possible actions are:

list

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.

Wildcard records (i.e. *.example.com) are displayed as \052.example.com. The same format must be used to create a wildcard record.

delete

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.

create

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.

EXAMPLES

Specify your credentials

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.

    # 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

List your zones

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.

Get all nameservers (and details) for all zones

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

Get just the nameservers for a specific zone

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;

Create a new zone

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.

Delete a zone

Deletes a zone (assuming the zone contains only SOA and NS records):

    $ 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.

List all DNS records for a zone

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

Delete a specific DNS record for a zone

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:

    $ 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

Create a new DNS record for the zone

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

AUTHOR

Marco FONTANI <mfontani@cpan.org>

COPYRIGHT AND LICENSE

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.