I'm trying to transfer hundreds of domain to AWS Route53. When I do it using AWS Route53 Console, during the transfer process I can set 'name-server option':
Does anyone know how I can approach the same thing using AWS CLI? I have already migrated my DNS records to Route53, so I'd like to use the 2nd option. I couldn't find anything in the documentation: transfer-domain . There is a 'nameservers' option, but there I can only define nameservers, but I want to use the Hosted Zone I've already created.
Here is my command:
aws route53domains transfer-domain --region us-east-1 --domain-name mydomain.co.uk --cli-input-json '{ ... }'
I've managed to solve this problem, leave the answer here as it might be useful for someone else, too.
As I already transferred the DNS Settings to Route53 I just have to gather the records:
aws route53 list-resource-record-sets --hosted-zone-id $ZONEID --output json
Then scrape the nameservers from the output and place it in the transfer-domain command like this:
aws route53domains transfer-domain --region us-east-1 --domain-name $domain --cli-input-json '{
"DomainName": "'"$domain"'",
"IdnLangCode": "",
"DurationInYears": 1,
"Nameservers": [
{
"Name": "nameserver1",
"GlueIps": []
},
{
"Name": "nameserver2",
"GlueIps": []
},
{
"Name": "nameserver3",
"GlueIps": []
},
{
"Name": "nameserver4",
"GlueIps": []
}
],
...}
This way Route53 will find the Hosted Zone with the same name as the domain and import the DNS records from it.