初めに
Route53で管理しているドメインをAWS CLIで別AWSアカウントへ移管が出来るようになっていた(以前はサポート経由限定だったはず)ので、AWS CLIで別アカウントに移管しようとしたところ、Could not connect to the endpoint URL: "https://route53domains.ap-northeast-1.amazonaws.com/"
というエラーで詰まったので、その解決方法です。
注意点
- AWS CLIでドメイン移管する場合、AWS CLI v2 2.0.9以上で実施してください(バージョンが低いとtransfer-domain-toanother-aws-accoutオプションが未実装なため)
- 適切な権限が付与してあるIAMユーザーで操作してください(私はAdministrator権限が付与してあるIAMユーザーで操作しました)
- AWS CLIの基本設定(aws cofigure)は済んでいる前提です。
エラー解決方法
--region=us-east-1
を付与しましょう。
コマンド例
$ aws route53domains transfer-domain-to-another-aws-account --domain-name `移管ドメイン` --account-id `移管先AWSアカウントID` --region=us-east-1
エラー時リクエスト/レスポンス
$ aws route53domains transfer-domain-to-another-aws-account --domain-name `移管ドメイン` --account-id `移管先AWSアカウントID`
Could not connect to the endpoint URL: "https://route53domains.ap-northeast-1.amazonaws.com/"
成功時リクエスト/レスポンス
--region=us-east-1
を付与した場合
$ aws route53domains transfer-domain-to-another-aws-account --domain-name `移管ドメイン` --account-id `移管先AWSアカウントID` --region=us-east-1
{
"OperationId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Password": "xxxxxxxxxxxxxxxxxxxx"
}
参考
移管先アカウントでの承認リクエスト/レスポンス
$ aws route53domains accept-domain-transfer-from-another-aws-account --domain-name `移管ドメイン` --password '`移管元で出力されたパスワード`' --region=us-east-1
{
"OperationId": "xxxxxxx"
}
なぜエラーになったのか?
nslookupでroute53domains.ap-northeast-1.amazonaws.com
の名前解決をしようとしたところ、解決できなかったので、ap-northeast-1には上記のエンドポイントが無いと思われます(2020/10/1時点)
ap-northeast-1のエンドポイント名前解決
$ nslookup route53domains.ap-northeast-1.amazonaws.com
*** dns.google が route53domains.ap-northeast-1.amazonaws.com を見つけられません: Non-existent domain
サーバー: dns.google
Address: 8.8.8.8
us-east-1のエンドポイント名前解決
$ nslookup route53domains.us-east-1.amazonaws.com
権限のない回答:
サーバー: speedwifi-next.home
Address: fe80::8abf:e4ff:feb1:5c0e
名前: route53domains.us-east-1.amazonaws.com
Address: 54.239.29.152
参考ドキュメント
AWS公式 ドメイン移管方法
AWS CLI transfer-domain-to-another-aws-account
AWS CLI accept-domain-transfer-from-another-aws-account