Skip to content

Commit 856ed60

Browse files
author
Brightside56
committed
initial commit
0 parents  commit 856ed60

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# cli53-remove
2+
3+
Mass records/zones deletion process in AWS Route53 is very annoying process. If you're using AWS webui and you need to delete zone, you have to remove DNS-records one by one first to get a possibility to remove zone. To automate this I've created simple bash script over [cli53](https://github.com/barnybug/cli53) utility for mass removing route53 zones with their records
4+
5+
## READ FIRST!!!
6+
7+
- Current version of script was tested to work against cli53 v0.8.16 (but might work with other versions)
8+
- Use script carefully on your own risk, because under some circumstances or you might delete something useful :D
9+
10+
## HOW-TO:
11+
First you need to install cli53 utility using instructions [here](https://github.com/barnybug/cli53). Then download script, make it executable. Then run it and specify domain names or part of domain names of zones you want to delete as arguments to
12+
13+
```sh
14+
$ ./cli53-remove.sh domain1 domain2.com 3dom
15+
```
16+
In example above all zones containing in its name "domain1" or "domain2.com" "3dom" will be removed from your route53. Or just
17+
```sh
18+
$ ./cli53-remove.sh domain5.com
19+
```
20+
21+
If you need only remove records, but keep zone itself, you can comment out following line in script
22+
```
23+
cli53 delete ${line};
24+
```

cli53-remove.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
for var in "$@"
4+
do
5+
cli53 list | tr -s ' ' | grep -e "$var" | cut -f 2 -d ' ' |
6+
while read line;
7+
do
8+
printf "Processing ${line} \n";
9+
cli53 rrpurge ${line} --confirm;
10+
cli53 delete ${line};
11+
done
12+
done

0 commit comments

Comments
 (0)