Skip to content

Instantly share code, notes, and snippets.

@pkqk
Created September 17, 2024 22:08
Show Gist options
  • Save pkqk/5c399f28b1ec4521f60b65be2a295ca6 to your computer and use it in GitHub Desktop.
Save pkqk/5c399f28b1ec4521f60b65be2a295ca6 to your computer and use it in GitHub Desktop.
delete Route53 Record
#!/bin/bash
hostedzoneid=${1?usage: $0 hostedzoneid rrtype}
rrtype=${2?usage: $0 hostedzoneid rrtype}
aws route53 list-resource-record-sets --hosted-zone-id "${hostedzoneid}" --query "ResourceRecordSets[?Type=='${rrtype}']" |
jq 'map({Changes: [{Action: "DELETE", ResourceRecordSet: .}]})[0]' |
aws route53 change-resource-record-sets --hosted-zone-id "${hostedzoneid}" --change-batch file:///dev/stdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment