Transfer a public domain registration to another AWS account

One of our pilot projects required registration of a dedicated DNS domain, which was easily performed with Amazon Route53 Domain Registration feature. Once the pilot ended and Amazon Web Services (AWS) sandbox account was scheduled for deletion, we wanted to preserve the domain registration to put it for use in another pilot.

Detailed steps are described in Amazon documentation and are easy to follow:

Step 1. Log into Amazon account where your domain name was originally registered with a proper Amazon IAM role, then open Amazon CloudShell and use pre-installed Amazon CLI to initiate the transfer to the target account (we will use a mock domain name and the target account number 1234567890 in code samples below)

>aws route53domains transfer-domain-to-another-aws-account --domain-name --account-id 1234567890

You will receive a response similar to the one below - capture the password to be used later. In Route53 tab, the domain will be shown in a "Pending Transfer" state.

    "OperationId": "d7f09f39-4190-4c8b-b1e4-35e41fea37cd",
    "Password": "HA646byRR%RwL<"

Switch to the target account 1234567890 and run this CLI command in CloudShell (note required quotations around the password due to use of special characters)

> aws route53domains accept-domain-transfer-from-another-aws-account --domain-name --password "HA646byRR%RwL<"

We made a mistake by closing the original sandbox account without transferring previously used Route53 hosted zone to the target account first... Upon creation of a new public hosted zone in the new account, Fully-Qualified Domain Names (FQDN) of assigned Amazon DNS name servers in the Zone did not match those in the Domain Registration record. Domain records were manually updated with NS names from the Hosted Zone.