Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use CheckDomainTransferability
with an Amazon SDK or CLI
The following code examples show how to use CheckDomainTransferability
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- .NET
-
- Amazon SDK for .NET
-
/// <summary>
/// Check the transferability of a domain name.
/// </summary>
/// <param name="domain">The domain to check for transferability.</param>
/// <returns>A transferability result string.</returns>
public async Task<string> CheckDomainTransferability(string domain)
{
var result = await _amazonRoute53Domains.CheckDomainTransferabilityAsync(
new CheckDomainTransferabilityRequest
{
DomainName = domain
}
);
return result.Transferability.Transferable.Value;
}
- CLI
-
- Amazon CLI
-
To determine whether a domain can be transferred to Route 53
The following check-domain-transferability
command returns information about whether you can transfer the domain name example.com
to Route 53.
This command runs only in the us-east-1
Region. If your default region is set to us-east-1
, you can omit the region
parameter.
aws route53domains check-domain-transferability \
--region us-east-1
\
--domain-name example.com
Output:
{
"Transferability": {
"Transferable": "UNTRANSFERABLE"
}
}
For more information, see Transferring Registration for a Domain to Amazon Route 53 in the Amazon Route 53 Developer Guide.
- Java
-
- SDK for Java 2.x
-
public static void checkDomainTransferability(Route53DomainsClient route53DomainsClient, String domainSuggestion) {
try {
CheckDomainTransferabilityRequest transferabilityRequest = CheckDomainTransferabilityRequest.builder()
.domainName(domainSuggestion)
.build();
CheckDomainTransferabilityResponse response = route53DomainsClient
.checkDomainTransferability(transferabilityRequest);
System.out.println("Transferability: " + response.transferability().transferable().toString());
} catch (Route53Exception e) {
System.err.println(e.getMessage());
System.exit(1);
}
}
- Kotlin
-
- SDK for Kotlin
-
suspend fun checkDomainTransferability(domainSuggestion: String?) {
val transferabilityRequest =
CheckDomainTransferabilityRequest {
domainName = domainSuggestion
}
Route53DomainsClient { region = "us-east-1" }.use { route53DomainsClient ->
val response = route53DomainsClient.checkDomainTransferability(transferabilityRequest)
println("Transferability: ${response.transferability?.transferable}")
}
}
For a complete list of Amazon SDK developer guides and code examples, see
Using Route 53 with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.