cli53 export/imports domains zones to file and create/delete domains.





- Requriments:
Do you need your awscli profile configured.

➜  Downloads sudo yum install awscli -y
Last metadata expiration check: 0:29:05 ago on Thu 12 Apr 2018 12:05:59 PM -03.
Package awscli-1.11.133-1.fc27.noarch is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!

➜  Downloads aws configure --profile itshellws-dev
AWS Access Key ID [None]: 1
AWS Secret Access Key [None]: 1
Default region name [None]: 1
Default output format [None]: 1

# aws profile use boto3 credentials for authentication.

Donwload cli53 here: https://github.com/barnybug/cli53/releases/latest

sudo mv /usr/local/bin/cli53-linux-amd64 /usr/local/bin/cli53

sudo chmod +x /usr/local/bin/cli53

Commands:

# Export domains zone records to file
cli53 export example.com.ar > /tmp/example.com.ar.txt --profile itshellws-dev
cli53 export vikingo.com > /tmp/vikingo.com.txt --profile itshellws-dev
cli53 export perro.com > /tmp/perro.com.txt --profile itshellws-dev

# Create a new zone in route53.

cli53 create example.com.ar --comment example.com.ar --profile itshellws-dev
cli53 create vikingo.com --comment vikingo.com --profile itshellws-dev
cli53 create perro.com --comment perro.com --profile itshellws-dev

# Import file zone to route53

cli53 import --file example.com.ar.txt example.com.ar --profile itshellws-dev
cli53 import --file vikingo.com.txt vikingo.com --profile itshellws-dev
cli53 import --file perro.com.ar.txt perro.com.ar --profile itshellws-dev

# Create A record pointed 1.1.1.1 with TTL of 120 seconds
cli53 rrcreate example.com 'www 120 A 1.1.1.1' --profile itshellws-dev
cli53 rrcreate vikingo.com 'www 120 A 1.1.1.1' --profile itshellws-dev
cli53 rrcreate perro.com 'www 120 A 1.1.1.1' --profile itshellws-dev

# Delete all records and domain zone.
cli53 rrpurge example.com.ar --profile itshellws-dev --confirm && cli53 delete example.com.ar --profile itshellws-dev
cli53 rrpurge vikingo.com --profile itshellws-dev --confirm && cli53 delete vikingo.com --profile itshellws-dev
cli53 rrpurge perro.com --profile itshellws-dev --confirm && cli53 delete perro.com --profile itshellws-dev


Output:
➜  /tmp cli53 list |grep vikingo
Z17L4GGBRE72JA vikingo.com.               2            vikingo.com

➜  /tmp cli53 import --file vikingo.com.txt vikingo.com
7 records imported (2 changes / 2 additions / 0 deletions)

➜  /tmp cli53 rrcreate vikingo.com 'www 120 A 1.1.1.1' --profile itshellws-dev
Error: InvalidChangeBatch: RRSet of type A with DNS name www.vikingo.com. is not permitted because a conflicting RRSet of type  CNAME with the same DNS name already exists in zone vikingo.com.
    status code: 400, request id: a6396058-3e6f-11e8-91b4-a939920df833


➜  /tmp cli53 rrpurge vikingo.com --profile itshellws-dev --confirm 
2 record sets deleted

➜  /tmp cli53 rrcreate vikingo.com 'www 120 A 1.1.1.1' --profile itshellws-dev
Created record: 'www.vikingo.com. 120 IN A 1.1.1.1'

➜  /tmp cli53 rrcreate vikingo.com 'www 120 A 1.1.1.1' --profile itshellws-dev

➜  /tmp cli53 rrpurge vikingo.com --profile itshellws-dev --confirm && cli53 delete vikingo.com --profile itshellws-dev
1 record sets deleted
Deleted zone: 'vikingo.com.' ID: '/hostedzone/Z17L4GGBRE72JA'

Dejar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Conoce cómo se procesan los datos de tus comentarios.