-
-
Save mikehsieh97/7704b99d1d276673cbaec0cfc67813c0 to your computer and use it in GitHub Desktop.
Revisions
-
earljon created this gist
Aug 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ #!/bin/sh # NOTE: # Make sure that the value of Name, Type, TTL are the same with your DNS Record Set HOSTED_ZONE_ID=<YOUR_HOSTED_ZONE_ID> RESOURCE_VALUE=<YOUR_DNS_RESOURCE_VALUE-ex:IP or dns> DNS_NAME=<YOUR_DNS_NAME-ex: subdomain.domain.com> RECORD_TYPE=<DNS_RECORD_TYPE-ex: A, CNAME> TTL=<TTL_VALUE> JSON_FILE=`mktemp` ( cat <<EOF { "Comment": "Delete single record set", "Changes": [ { "Action": "DELETE", "ResourceRecordSet": { "Name": "$DNS_NAME.", "Type": "$RECORD_TYPE", "TTL": $TTL, "ResourceRecords": [ { "Value": "${RESOURCE_VALUE}" } ] } } ] } EOF ) > $JSON_FILE echo "Deleting DNS Record set" aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_ID} --change-batch file://$JSON_FILE echo "Deleting record set ..." echo echo "Operation Completed."