DEV Community

Vinod Kumar
Vinod Kumar

Posted on • Edited on

Using AWS CLI to transfer a domain from one AWS account to another one

If you want to transfer an existing domain that is registered with AWS Route 53 domain registrar to another AWS (Amazon Web Services) account, you can of course contact the AWS Customer Support team and get this thing done however that takes a lot of time especially if you are on a Free-Tier plan.
The best approach to transfer a domain from one AWS account to another one very quickly on your own without waiting in a queue is by using the AWS CLI (or Command Line Interface) in 3 simple steps.

Alt Text

There is no option on AWS Console to transfer domains between AWS accounts. The only domain transfer you can do on the console is to bring it from outside domain registrars like GoDaddy.com or Google Domains into AWS Route 53.

In this blog, I will show you how you can transfer the domain using the AWS CLI (Command Line Interface) option. To do this, you must ensure that you have at least version aws-cli 2.09 configured in your machine before proceeding further. If yes, then follow the given steps below:-

Step 1: Using old account IAM CLI credentials, check if you can see your domain(s) or not by executing the below command:-

aws route53domains list-domains

You see an output like this:-

{
"Domains": [
{
"DomainName": "example.com",
"AutoRenew": true,
"TransferLock": true,
"Expiry": "2022-08-25T11:34:02+05:30"
}
]
}

Then initiate the domain transfer using the below command:-

aws route53domains transfer-domain-to-another-aws-account — domain-name <your domain name> — account-id <destination AWS account id>

Step 2: From the above step, you will get an output in a JSON format with OperationId and Password like:-

{
“OperationId”: “c837dj8–5eae-29334-ah72-hs873ns8282”,
“Password”: “ZKAHD\\WE.4LK\\US”
}

Change that OperationId to DomainName and store it in a new JSON file (acceptDomainTransfer.json) along with the same password that was auto-generated like below:-

{
“DomainName”: “example.com”
“Password”: “ZKAHD\\WE.4LK\\US”
}

Step 3: Execute the last command to accept that domain using the IAM CLI credentials of your destination/new AWS account or profile like below:-

aws route53domains accept-domain-transfer-from-another-aws-account — cli-input-json file://acceptDomainTransfer.json — profile gsp

Step 4: Cool, it's all done :) Just execute that list-domains command again using new account CLI credentials and you will see your domain moved from the older account and started appearing here:-

aws route53domains list-domains

{
"Domains": [
{
"DomainName": "example.com",
"AutoRenew": true,
"TransferLock": true,
"Expiry": "2022-08-25T11:34:02+05:30"
}
]
}

Hope you liked this article :)

Summary:
In this blog, we have learned that how easily we can move our domain from one AWS account to another one using the AWS CLI (Command Line Interface) without creating any support ticket to the AWS Customer Support team. And the transfer happens instantly without any delays.

Top comments (0)