Created
February 16, 2018 14:41
-
-
Save jroehl/69b40a69da87c730553c50cd22d770d6 to your computer and use it in GitHub Desktop.
Update the nameserver of a domain with the nameservers of a specified hostedzone
This file contains 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 characters
#!/bin/bash | |
# Update the nameserver of a domain with the nameservers of a specified hostedzone | |
# aws-update-nameservers.sh HostedZoneId | |
HOSTED_ZONE_ID=$1 | |
RESULT=(`aws route53 get-hosted-zone --query '[DelegationSet.NameServers,HostedZone.Name]' --output text --region us-east-1 --id $HOSTED_ZONE_ID `) | |
NAMESERVERS=("${RESULT[@]:1}") | |
SANITIZED_NAMESERVERS=${NAMESERVERS[@]/#/Name=} | |
DOMAIN_NAME="${RESULT[0]%?}" | |
echo "Updating nameservers for \"$DOMAIN_NAME\" with nameservers \"$NAMESERVERS\"" | |
OP_ID=`aws route53domains update-domain-nameservers --region us-east-1 --domain-name $DOMAIN_NAME --nameservers $SANITIZED_NAMESERVERS` | |
echo $OP_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment