Use GetDomainSuggestions with an Amazon SDK or CLI - Amazon Route 53
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 GetDomainSuggestions with an Amazon SDK or CLI

The following code examples show how to use GetDomainSuggestions.

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
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

/// <summary> /// Get a list of suggestions for a given domain. /// </summary> /// <param name="domain">The domain to check for suggestions.</param> /// <param name="onlyAvailable">If true, only returns available domains.</param> /// <param name="suggestionCount">The number of suggestions to return. Defaults to the max of 50.</param> /// <returns>A collection of domain suggestions.</returns> public async Task<List<DomainSuggestion>> GetDomainSuggestions(string domain, bool onlyAvailable, int suggestionCount = 50) { var result = await _amazonRoute53Domains.GetDomainSuggestionsAsync( new GetDomainSuggestionsRequest { DomainName = domain, OnlyAvailable = onlyAvailable, SuggestionCount = suggestionCount } ); return result.SuggestionsList; }
CLI
Amazon CLI

To get a list of suggested domain names

The following get-domain-suggestions command displays a list of suggested domain names based on the domain name example.com. The response includes only domain names that are available. 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 get-domain-suggestions \ --region us-east-1 \ --domain-name example.com \ --suggestion-count 10 \ --only-available

Output:

{ "SuggestionsList": [ { "DomainName": "egzaampal.com", "Availability": "AVAILABLE" }, { "DomainName": "examplelaw.com", "Availability": "AVAILABLE" }, { "DomainName": "examplehouse.net", "Availability": "AVAILABLE" }, { "DomainName": "homeexample.net", "Availability": "AVAILABLE" }, { "DomainName": "examplelist.com", "Availability": "AVAILABLE" }, { "DomainName": "examplenews.net", "Availability": "AVAILABLE" }, { "DomainName": "officeexample.com", "Availability": "AVAILABLE" }, { "DomainName": "exampleworld.com", "Availability": "AVAILABLE" }, { "DomainName": "exampleart.com", "Availability": "AVAILABLE" } ] }
Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

public static void listDomainSuggestions(Route53DomainsClient route53DomainsClient, String domainSuggestion) { try { GetDomainSuggestionsRequest suggestionsRequest = GetDomainSuggestionsRequest.builder() .domainName(domainSuggestion) .suggestionCount(5) .onlyAvailable(true) .build(); GetDomainSuggestionsResponse response = route53DomainsClient.getDomainSuggestions(suggestionsRequest); List<DomainSuggestion> suggestions = response.suggestionsList(); for (DomainSuggestion suggestion : suggestions) { System.out.println("Suggestion Name: " + suggestion.domainName()); System.out.println("Availability: " + suggestion.availability()); System.out.println(" "); } } catch (Route53Exception e) { System.err.println(e.getMessage()); System.exit(1); } }
Kotlin
SDK for Kotlin
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

suspend fun listDomainSuggestions(domainSuggestion: String?) { val suggestionsRequest = GetDomainSuggestionsRequest { domainName = domainSuggestion suggestionCount = 5 onlyAvailable = true } Route53DomainsClient { region = "us-east-1" }.use { route53DomainsClient -> val response = route53DomainsClient.getDomainSuggestions(suggestionsRequest) response.suggestionsList?.forEach { suggestion -> println("Suggestion Name: ${suggestion.domainName}") println("Availability: ${suggestion.availability}") println(" ") } } }

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.