LinuxCommandLibrary

cli53

Manage DNS records using AWS Route53

TLDR

List domains

$ cli53 list
copy

Create a domain
$ cli53 create [example.com] --comment "[comment]"
copy

Export a bind zone file to stdout
$ cli53 export [example.com]
copy

Create a www subdomain pointing to a relative record in the same zone
$ cli53 [[rc|rrcreate]] [example.com] ['www 300 CNAME lb']
copy

Create a www subdomain pointing to an external address (must end with a dot)
$ cli53 [[rc|rrcreate]] [example.com] ['www 300 CNAME lb.example.com.']
copy

Create a www subdomain pointing to an IP address
$ cli53 [[rc|rrcreate]] [example.com] ['www 300 A 150.130.110.1']
copy

Replace a www subdomain pointing to a different IP
$ cli53 [[rc|rrcreate]] --replace ['www 300 A 150.130.110.2']
copy

Delete a record A
$ cli53 [[rd|rrdelete]] [example.com] [www] [A]
copy

SYNOPSIS

cli53 [global-options] <command> [command-options] [arguments]

Common Global Options:
--access-key <KEY_ID>
--secret-key <ACCESS_KEY>
--profile <PROFILE_NAME>
--region <REGION>
--json
--help

Examples of Commands:
cli53 list
cli53 create <ZONE_NAME>
cli53 rrlist <ZONE_NAME>
cli53 rrcreate <ZONE_NAME> <NAME> <TYPE> <VALUE> --ttl <TTL>
cli53 import <ZONE_NAME> --file <FILE>
cli53 export <ZONE_NAME> > <FILE>

PARAMETERS

<command>
    The subcommand to execute, e.g., list (zones), create (zone), delete (zone), rrlist (records), rrcreate (record), rrdelete (record), import, export. Each subcommand has its own specific set of options and arguments.

--access-key <KEY_ID>
    Specifies the AWS access key ID to use for authentication, overriding default credentials.

--secret-key <ACCESS_KEY>
    Specifies the AWS secret access key to use for authentication, overriding default credentials.

--profile <PROFILE_NAME>
    Uses a specific profile from the AWS shared credentials file (~/.aws/credentials) or config file (~/.aws/config).

--region <REGION>
    Specifies the AWS region. While Route 53 is a global service, this may be used for credential resolution or other related AWS API calls.

--json
    Outputs results in JSON format, making it suitable for programmatic parsing and scripting.

--help
    Displays help information for the main command or a specific subcommand (e.g., cli53 rrcreate --help).

<ZONE_NAME>
    The full domain name of the hosted zone, typically ending with a dot (e.g., example.com.). Used with zone management commands.

<NAME>
    The full DNS name of the record set (e.g., www.example.com.). Used with resource record commands.

<TYPE>
    The DNS record type (e.g., A, CNAME, MX, TXT, SRV). Used with resource record commands.

<VALUE>
    One or more values for the DNS record, depending on its type (e.g., IP address for A record, hostname for CNAME). Multiple values are space-separated.

--ttl <SECONDS>
    Specifies the Time To Live (TTL) for the DNS record in seconds. Common for rrcreate and rrupdate.

--file <PATH>
    Path to a standard BIND zone file for import or export operations.

--wait
    For certain commands (like rrcreate, rrdelete), this option makes cli53 wait until the DNS changes have propagated before exiting.

DESCRIPTION

cli53 is a command-line interface (CLI) tool designed for managing DNS records and hosted zones within Amazon Web Services (AWS) Route 53. It provides a convenient way to interact with Route 53 from the terminal, enabling users to create, update, delete, list, import, and export various types of DNS records (A, AAAA, CNAME, MX, TXT, SRV, NS, SOA, PTR, SPF, CAA) and hosted zones.

Built as a Python application, cli53 simplifies routine DNS management tasks, making it ideal for scripting, automation, and DevOps workflows. It abstracts the complexities of the AWS Route 53 API, offering a straightforward command syntax. Users can manage public and private hosted zones, set DNS failover configurations, and control health checks, all from the command line. It's a valuable tool for anyone frequently interacting with AWS DNS services.

CAVEATS

  • AWS Credentials Required: cli53 needs proper AWS authentication via environment variables, shared credentials files, or explicit command-line options.
  • IAM Permissions: The AWS IAM user or role used must have sufficient permissions to interact with Route 53 (e.g., route53:ChangeResourceRecordSets, route53:ListHostedZones).
  • Pricing: Using AWS Route 53 and its features incurs costs according to AWS's pricing model.
  • Third-Party Tool: cli53 is a community-maintained open-source tool, not an official AWS product. While widely used and reliable, support is community-driven.
  • Zone File Format: When importing, the tool expects standard BIND zone file syntax. Deviations can lead to errors or incorrect record creation.

AUTHENTICATION

cli53 authenticates with AWS using standard methods. It prioritizes explicit command-line options (--access-key, --secret-key), followed by environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), and then AWS shared credential files (~/.aws/credentials or ~/.aws/config, which can be selected using the --profile option or AWS_PROFILE environment variable).

INSTALLATION

As a Python package, cli53 is typically installed using pip, the Python package installer. Ensure you have Python and pip installed on your system:

pip install cli53

HISTORY

cli53 was developed by Barnaby Gray and released as an open-source project, typically installed via Python's pip package manager. Its origins trace back to the early 2010s, providing a more focused and user-friendly command-line interface for Route 53 operations compared to the broader AWS CLI tools available at the time. It quickly gained popularity within the DevOps and system administration communities for its ease of use in scripting and automating DNS management tasks. The project has undergone continuous development and remains a widely adopted tool for managing AWS DNS.

SEE ALSO

awscli(1) (specifically `aws route53` subcommands), dig(1), nslookup(1), host(1)

Copied to clipboard