Skip to content

Instantly share code, notes, and snippets.

@gardner
Last active March 1, 2022 13:28
Show Gist options
  • Save gardner/8073308c5471bf3083f376bbddc4f5c0 to your computer and use it in GitHub Desktop.
Save gardner/8073308c5471bf3083f376bbddc4f5c0 to your computer and use it in GitHub Desktop.
Wait for a domain name to become available and then register it
#!/bin/bash
# Install the aws cli: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
# Then configure the cli: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
while : ; do
aws --region us-east-1 route53domains check-domain-availability --domain-name domain.com | grep UNAVAILABLE
if [ $? -ne 0 ]; then
aws --region us-east-1 route53domains register-domain --cli-input-json '{"DomainName":"domain.com","DurationInYears":1,"AutoRenew":true,"AdminContact":{"FirstName":"Gardner","LastName":"Bickford","ContactType":"PERSON","AddressLine1":"123 Main St","AddressLine2":"","City":"Boulder","State":"CO","CountryCode":"US","ZipCode":"80301","PhoneNumber":"+1.5555555","Email":"webmaster@spunts.net"},"RegistrantContact":{"FirstName":"Gardner","LastName":"Bickford","ContactType":"PERSON","AddressLine1":"123 Main St","AddressLine2":"","City":"Boulder","State":"CO","CountryCode":"US","ZipCode":"80301","PhoneNumber":"+1.5555555","Email":"webmaster@spunts.net"},"TechContact":{"FirstName":"Gardner","LastName":"Bickford","ContactType":"PERSON","AddressLine1":"123 Main St","AddressLine2":"","City":"Boulder","State":"CO","CountryCode":"US","ZipCode":"80301","PhoneNumber":"+1.5555555","Email":"webmaster@spunts.net"},"PrivacyProtectAdminContact":true,"PrivacyProtectRegistrantContact":true,"PrivacyProtectTechContact":true}'
if [ $? -eq 0 ]; then
exit
fi
fi
date
sleep 900
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment