DEV Community

Cover image for Transfer a domain between AWS accounts
Stefan Alfbo
Stefan Alfbo

Posted on

Transfer a domain between AWS accounts

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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/"
Enter fullscreen mode Exit fullscreen mode

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=
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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:

Top comments (1)

Collapse
 
szabgab profile image
Gabor Szabo

Congratulations for your first post!