How to use the command cli53 (with examples)

How to use the command cli53 (with examples)

cli53 is a command line tool for managing Amazon Route 53, which is a scalable and highly available domain name system (DNS) web service offered by Amazon Web Services (AWS). The cli53 command provides a convenient way to interact with the Amazon Route 53 service using the command line interface.

Use case 1: List domains

Code:

cli53 list

Motivation:

  • To retrieve a list of all the domains hosted in the Amazon Route 53 service.

Explanation:

  • list: This subcommand is used to list all the domains hosted under the user’s AWS account.

Example output:

example1.com
example2.com
example3.com

Use case 2: Create a domain

Code:

cli53 create mydomain.com --comment "comment"

Motivation:

  • To create a new domain named “mydomain.com” in the Amazon Route 53 service.

Explanation:

  • create: This subcommand is used to create a new domain in the Amazon Route 53 service.
  • mydomain.com: The name of the domain to be created.
  • --comment "comment": An optional parameter to add a comment to the domain.

Example output:

Domain created successfully: mydomain.com

Use case 3: Export a bind zone file to stdout

Code:

cli53 export mydomain.com

Motivation:

  • To export the DNS records of the “mydomain.com” domain in the bind zone file format.

Explanation:

  • export: This subcommand is used to export the DNS records of a domain in a specific format.
  • mydomain.com: The name of the domain to be exported.

Example output:

$ORIGIN mydomain.com.
$TTL 300
@   IN    SOA    ns-123.awsdns-12.net. hostmaster.mydomain.com. (
        1        ; serial
        7200     ; refresh (2 hours)
        900      ; retry (15 minutes)
        1209600  ; expire (2 weeks)
        86400    ; minimum (1 day)
        )

@   300    IN    NS    ns-123.awsdns-12.net.
@   300    IN    NS    ns-456.awsdns-34.org.
@   300    IN    NS    ns-789.awsdns-56.com.
@   300    IN    NS    ns-012.awsdns-78.co.uk.

@   300    IN    MX    10 mail.mydomain.com.
mail    300    IN    A     150.130.110.1
www     300    IN    CNAME lb
...

Use case 4: Create a “www” subdomain pointing to a relative record in the same zone

Code:

cli53 rc|rrcreate mydomain.com 'www 300 CNAME lb'

Motivation:

  • To create a subdomain named “www.mydomain.com ” pointing to a relative record “lb” in the same zone.

Explanation:

  • rc|rrcreate: This subcommand is used to create a new resource record in the Amazon Route 53 service.
  • mydomain.com: The name of the domain in which the new resource record will be created.
  • 'www 300 CNAME lb': The details of the new resource record to be created. In this case, it creates a CNAME record for “www.mydomain.com ” pointing to “lb” in the same zone.

Example output:

Resource record created successfully: www.mydomain.com CNAME lb

Use case 5: Create a “www” subdomain pointing to an external address

Code:

cli53 rc|rrcreate mydomain.com 'www 300 CNAME lb.externalhost.com.'

Motivation:

  • To create a subdomain named “www.mydomain.com ” pointing to an external address “lb.externalhost.com”.

Explanation:

  • rc|rrcreate: This subcommand is used to create a new resource record in the Amazon Route 53 service.
  • mydomain.com: The name of the domain in which the new resource record will be created.
  • 'www 300 CNAME lb.externalhost.com.': The details of the new resource record to be created. In this case, it creates a CNAME record for “www.mydomain.com ” pointing to an external host “lb.externalhost.com”.

Example output:

Resource record created successfully: www.mydomain.com CNAME lb.externalhost.com.

Use case 6: Create a “www” subdomain pointing to an IP address

Code:

cli53 rc|rrcreate mydomain.com 'www 300 A 150.130.110.1'

Motivation:

  • To create a subdomain named “www.mydomain.com ” pointing to an IP address “150.130.110.1”.

Explanation:

  • rc|rrcreate: This subcommand is used to create a new resource record in the Amazon Route 53 service.
  • mydomain.com: The name of the domain in which the new resource record will be created.
  • 'www 300 A 150.130.110.1': The details of the new resource record to be created. In this case, it creates an A record for “www.mydomain.com ” pointing to the IP address “150.130.110.1”.

Example output:

Resource record created successfully: www.mydomain.com A 150.130.110.1

Use case 7: Replace a “www” subdomain pointing to a different IP

Code:

cli53 rc|rrcreate --replace 'www 300 A 150.130.110.2'

Motivation:

  • To replace the IP address of the subdomain “www.mydomain.com ” with a different IP address “150.130.110.2”.

Explanation:

  • rc|rrcreate: This subcommand is used to create or replace a resource record in the Amazon Route 53 service.
  • --replace: An option to specify that the resource record being created should replace any existing resource record with the same name and type.
  • 'www 300 A 150.130.110.2': The details of the new resource record to be created or replaced. In this case, it replaces the existing A record for “www.mydomain.com ” with the new IP address “150.130.110.2”.

Example output:

Resource record replaced successfully: www.mydomain.com A 150.130.110.2

Use case 8: Delete a record A

Code:

cli53 rd|rrdelete mydomain.com www A

Motivation:

Explanation:

  • rd|rrdelete: This subcommand is used to delete a resource record from the Amazon Route 53 service.
  • mydomain.com: The name of the domain from which the resource record will be deleted.
  • www: The name of the subdomain for which the resource record will be deleted.
  • A: The type of the resource record to be deleted.

Example output:

Resource record deleted successfully: www.mydomain.com A

Conclusion:

In this article, we have explored various use cases of the cli53 command for managing Amazon Route 53. It provides a powerful and flexible way to interact with the Amazon Route 53 service from the command line, allowing users to list domains, create domains, export zone files, create and manage resource records, and more. With the examples provided, users can easily understand how to use the cli53 command for their DNS management needs.

Related Posts

How to use the command pdfseparate (with examples)

How to use the command pdfseparate (with examples)

The pdfseparate command is a utility tool that allows you to extract specific pages from a PDF file and create separate PDF files for each of those pages.

Read More
expr command (with examples)

expr command (with examples)

The expr command in Linux is a handy utility that allows you to evaluate expressions and manipulate strings.

Read More
How to use the command eksctl (with examples)

How to use the command eksctl (with examples)

eksctl is the official CLI for Amazon Elastic Kubernetes Service (EKS).

Read More