It is easy to transfer a domain from one AWS account to another AWS account with the help of AWS CLI.
These commands are done with AWS CLI in bash.
# Make sure that you have the AWS CLI installed
aws --version
We will use the command route53domains and its sub commands to do the transfer.
Three things are needed for the first step, the domain name to transfer, the account id that should have the domain name and the credentials (perhaps as an AWS CLI profile) of the owner of the domain.
aws route53domains transfer-domain-to-another-aws-account \
--domain-name example.com \
--account-id 111122223333 \
--region us-east-1 \
--profile DomainOwner
Note that it's important that this is done in the us-east-1 region since the route53 service is global. The error message would look like this otherwise.
Could not connect to the endpoint URL: "https://route53domains.eu-west-3.amazonaws.com/"
If the transfer was successful, then there would be a response with an operation id and a password.
# the response depending on you output preference
984188c3-1238-457c-a4ab-c6cc064f043d =xfdf%/fj/5nr=
Command for checking the status of the transfer.
aws route53domains get-operation-detail \
--operation-id 984188c3-1238-457c-a4ab-c6cc064f043d \
--profile DomainOwner
--region us-east-1
The last step is to accept the transfer with the account that should receive the domain, which means that we need the credentials for that account when running the AWS CLI commands. The domain name and the password from the first command will also be needed here.
aws route53domains accept-domain-transfer-from-another-aws-account \
--domain-name example.com \
--password =xfdf%/fj/5nr= \
--profile DomainReceiver
--region us-east-1
All done, the last command will also get an operation id in the response that could be used to check the status with the sub command get-operation-detail as described above, remember to use the correct profile.
Resources: