Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Use ListDomains with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ListDomains with an AWS SDK or CLI

The following code examples show how to use ListDomains.

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
AWS SDK for .NET
Note

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

/// <summary> /// List the domains for the account. /// </summary> /// <returns>A collection of domain summary records.</returns> public async Task<List<DomainSummary>> ListDomains() { var results = new List<DomainSummary>(); var paginateDomains = _amazonRoute53Domains.Paginators.ListDomains( new ListDomainsRequest()); // Get the entire list using the paginator. await foreach (var domain in paginateDomains.Domains) { results.Add(domain); } return results; }
  • For API details, see ListDomains in AWS SDK for .NET API Reference.

CLI
AWS CLI

To list the domains that are registered with the current AWS account

The following list-domains command lists summary information about the domains that are registered with the current AWS account.

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 list-domains --region us-east-1

Output:

{ "Domains": [ { "DomainName": "example.com", "AutoRenew": true, "TransferLock": true, "Expiry": 1602712345.0 }, { "DomainName": "example.net", "AutoRenew": true, "TransferLock": true, "Expiry": 1602723456.0 }, { "DomainName": "example.org", "AutoRenew": true, "TransferLock": true, "Expiry": 1602734567.0 } ] }
  • For API details, see ListDomains in AWS CLI Command Reference.

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 AWS Code Examples Repository.

public static void listDomains(Route53DomainsClient route53DomainsClient) { try { ListDomainsIterable listRes = route53DomainsClient.listDomainsPaginator(); listRes.stream() .flatMap(r -> r.domains().stream()) .forEach(content -> System.out.println("The domain name is " + content.domainName())); } catch (Route53Exception e) { System.err.println(e.getMessage()); System.exit(1); } }
  • For API details, see ListDomains in AWS SDK for Java 2.x API Reference.

Kotlin
SDK for Kotlin
Note

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

suspend fun listDomains() { Route53DomainsClient { region = "us-east-1" }.use { route53DomainsClient -> route53DomainsClient .listDomainsPaginated(ListDomainsRequest {}) .transform { it.domains?.forEach { obj -> emit(obj) } } .collect { content -> println("The domain name is ${content.domainName}") } } }
  • For API details, see ListDomains in AWS SDK for Kotlin API reference.

AWS SDK for .NET
Note

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

/// <summary> /// List the domains for the account. /// </summary> /// <returns>A collection of domain summary records.</returns> public async Task<List<DomainSummary>> ListDomains() { var results = new List<DomainSummary>(); var paginateDomains = _amazonRoute53Domains.Paginators.ListDomains( new ListDomainsRequest()); // Get the entire list using the paginator. await foreach (var domain in paginateDomains.Domains) { results.Add(domain); } return results; }
  • For API details, see ListDomains in AWS SDK for .NET API Reference.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.