'route53 transfer domain to another aws account
I am trying to transfer my domain from one AWS account to another AWS account. I have tried boto3 SDK Route53domains client as given here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53domains.html#Route53Domains.Client.transfer_domain_to_another_aws_account but my code returns this error:
'Route53Domains' object has no attribute 'transfer_domain_to_another_aws_account'. How do i try to transfer my domain other than contacting AWS Support.
import boto3
client = boto3.client('route53domains')
if __name__ == "__main__":
response = client.transfer_domain_to_another_aws_account(
DomainName='domain.com',
AccountId='MY_ACCOUNT_ID'
)
print(response)
Solution 1:[1]
The process has changed a lot but it is still simple.
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 the purview of AWS Route53 like GoDaddy.com or Google Domains into AWS.
However, you can do the transfer by yourself using the CLI option. To do this, you must ensure that you have aws-cli 2.09 at least. If yes, then follow the steps using the cli to transfer from 1 AWS account into another one:-
Step 1: Using old account IAM cli credentials, check if you can see your domains or not by aws route53domains list-domains. 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 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 along with the password like below:-
{
"Password": "ZKAHD\\WE.4LK\\US",
"DomainName": "example.com"
}
Step 3: Execute the last command to accept that domain using the IAM CLI credentials of your destination 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: Done :) Just execute that list-domains command again using new account CLI credentials and you will see your domain moved and listed here:-
aws route53domains list-domains
Solution 2:[2]
Unless you have a need to automate or repeat this procedure with many domains, I would recommend that you simply use the Route53 Management Console to transfer the domain.
Another option is to use the aws cli: (documentation)
aws route53domains transfer-domain-to-another-aws-account --region us-east-1 --domain-name <value> --account-id <value>
As for the error you are currently receiving, I suspect that you may need to update boto3.
Solution 3:[3]
For everyone stumbling across the thread who is not from us-east-1 region trying to do this...
There is this issue on GitHub which is still not resolved today: https://github.com/aws/aws-cli/issues/1354
No matter what your main location is you need to explicitly use --region us-east-1 for the aws route53domains commands to work. Else you will be presented with f.e.
Could not connect to the endpoint URL: "https://route53domains.eu-central-1.amazonaws.com/"
Solution 4:[4]
Transfer the domain with the transfer-domain-to-another-aws-account AWS API as shown below
aws route53domains transfer-domain-to-another-aws-account --domain-name <domain name> --account-id <destination AWS account id>
Executing the command to accept that domain in the destination account, remove the --cli-input-json and
use this command.
aws route53domains accept-domain-transfer-from-another-aws-account --domain-name <your-domain> --password "<your password>"
Then run the command below to confirm whether the domain has been transfered
aws route53domains list-domains
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vinod827 |
| Solution 2 | |
| Solution 3 | philmph |
| Solution 4 |
