Use ListHostedZonesByName with a CLI
The following code examples show how to use ListHostedZonesByName.
- CLI
-
- AWS CLI
-
Example 1: To list hosted zones ordered by domain name
The following
list-hosted-zones-by-nameexample lists up to 100 hosted zones ordered by domain name.aws route53 list-hosted-zones-by-nameOutput:
{ "HostedZones": [ { "ResourceRecordSetCount": 2, "CallerReference": "test20150527-2", "Config": { "Comment": "test2", "PrivateZone": false }, "Id": "/hostedzone/Z119WBBTVP5WFX", "Name": "2.example.com." }, { "ResourceRecordSetCount": 2, "CallerReference": "test20150527-1", "Config": { "Comment": "test", "PrivateZone": false }, "Id": "/hostedzone/Z3P5QSUBK4POTI", "Name": "www.example.com." } ], "IsTruncated": false, "MaxItems": "100" }Example 2: To list hosted zones beginning with a specified domain name
The following
list-hosted-zones-by-nameexample lists hosted zones ordered by name, beginning withwww.example.com.aws route53 list-hosted-zones-by-name \ --dns-namewww.example.comOutput:
{ "HostedZones": [ { "ResourceRecordSetCount": 2, "CallerReference": "mwunderl20150527-1", "Config": { "Comment": "test", "PrivateZone": false }, "Id": "/hostedzone/Z3P5QSUBK4POTI", "Name": "www.example.com." } ], "DNSName": "www.example.com", "IsTruncated": false, "MaxItems": "100" }For more information, see Listing public hosted zones in the Amazon Route 53 Developer Guide.
-
For API details, see ListHostedZonesByName
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: Returns all of your public and private hosted zones in ASCII order by domain name.
Get-R53HostedZonesByNameExample 2: Returns your public and private hosted zones, in ASCII order by domain name, starting at the specified DNS name.
Get-R53HostedZonesByName -DnsName example2.com-
For API details, see ListHostedZonesByName in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: Returns all of your public and private hosted zones in ASCII order by domain name.
Get-R53HostedZonesByNameExample 2: Returns your public and private hosted zones, in ASCII order by domain name, starting at the specified DNS name.
Get-R53HostedZonesByName -DnsName example2.com-
For API details, see ListHostedZonesByName in AWS Tools for PowerShell Cmdlet Reference (V5).
-
For a complete list of AWS SDK developer guides and code examples, see Using Route 53 with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.