File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,35 @@ hosted-zone-ns-records(){
6565 done
6666}
6767
68+ hosted-zone-records (){
69+
70+ # List Records in a Route53 Hosted Zone
71+ # NOTE: AWS alias records are shown with a fake TTL of 86400.
72+ #
73+ # $ hosted-zones bash-my-aws.org
74+ # /hostedzone/ZJ6ZCG2UD6OKX 5 NotPrivateZone bash-my-aws.org.
75+ #
76+ # $ hosted-zones bash-my-aws.org | hosted-zone-records
77+ # bash-my-aws.org. 900 SOA ns-1549.awsdns-01.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400
78+ # bash-my-aws.org. 300 NS ns-1464.awsdns-55.org.
79+ # bash-my-aws.org. 300 A 185.199.108.153
80+ # bash-my-aws.org. 300 A 185.199.109.153
81+ # bash-my-aws.org. 300 TXT "google-site-verification=RbKejqu95y4Q78BkWnjaiM0rl6SYugtTdVLexK35b2k"
82+ # lb.bash-my-aws.org. 86400 ALIAS dualstack.lb-bmaorg-12345.us-east-1.elb.amazonaws.com
83+
84+ local hosted_zone_id=" $( __bma_read_inputs $@ ) "
85+ [[ -z " $hosted_zone_id " ]] && __bma_usage " hosted-zone-id" && return 1
86+
87+ aws route53 list-resource-record-sets \
88+ --hosted-zone-id " $hosted_zone_id " \
89+ --output json |
90+ jq --raw-output ' .ResourceRecordSets[] |
91+ (select(.ResourceRecords) |
92+ "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[].Value)\n"),
93+ (select(.AliasTarget) |
94+ "\(.Name) \t86400 \tALIAS \t\(.AliasTarget.DNSName)\n")'
95+ }
96+
6897hosted-zone-a-records (){
6998
7099 # Generate NS records for delegating domain to AWS
You can’t perform that action at this time.
0 commit comments