Move domain from one AWS account to another one with the CLI

Move domain from one AWS account to another one with the CLI

Last week I had the task of moving a domain that was in one AWS account to another one.

It's really easy you just need:

  1. Programmatic access to the account that has the domain.

  2. Programmatic access to the account that will receive the domain.

Command to start the transfer

aws route53domains transfer-domain-to-another-aws-account is the AWS CLI command you need to run with a few extra parameters like:

  • --domain-name self-explanatory.

  • --account-id the account owning the domain.

  • --region, I'll save you time, and set the region to us-east--1. I spent a bit of time on an error that said something like Could not connect to the endpoint URL...; the Route53 API has not been expanded to other regions and fails if you have a different region set in your machine.

% aws route53domains transfer-domain-to-another-aws-account --domain-name growboratory.com --account-id 123456789012 --region us-east-1

That command will return a payload like this:

 {
    "OperationId": "hy76gf4-19o9-84031-uj99-plo908iju7",
    "Password": "SUPER\\SEcret.P4ss\\WORD"
}

❗❗❗Save the "Password" from the payload, you'll use it later.

Also, if you go to your AWS console you will see in Route53 Domain \=> Pending Requests the transfer in pending process, that state changes when the domain transfer is accepted by the receiving account.

Command to finalise the transfer

aws route53domains acccept-domain-transfer-from-another-aws-account is the CLI command you'll use the following parameters:

  • --domain-name self-explanatory.

  • --password the password from the Route53 response from the previous step.

  • --region use us-east-1

aws route53domains acccept-domain-transfer-from-another-aws-account --domain-name growboratory.com --pasword SUPER\\SEcret.P4ss\\WORD --region us-east-1

If successful, that will respond with an OperationId payload.

Finally, you can check that your domain is in the receiving account.