<a id="cli-aws-route53-list-hosted-zones"></a>

# list-hosted-zones

## Description

Retrieves a list of the public and private hosted zones that are associated with the current Amazon Web Services account. The response includes a `HostedZones` child element for each hosted zone.

Amazon Route 53 returns a maximum of 100 items in each response. If you have a lot of hosted zones, you can use the `maxitems` parameter to list them in groups of up to 100.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZones)

`list-hosted-zones` is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the `--no-paginate` argument.
When using `--output text` and the `--query` argument on a paginated response, the `--query` argument must extract data from the results of the following query expressions: `HostedZones`

## Synopsis

```
  list-hosted-zones
[--max-items <value>]
[--delegation-set-id <value>]
[--hosted-zone-type <value>]
[--starting-token <value>]
[--page-size <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]
```

## Options

`--max-items` (string)

> The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a `NextToken` is provided in the command’s output. To resume pagination, provide the `NextToken` value in the `starting-token` argument of a subsequent command. **Do not** use the `NextToken` response element directly outside of the AWS CLI.

> For usage examples, see [Pagination](https://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the *AWS Command Line Interface User Guide* .

`--delegation-set-id` (string)

> If you’re using reusable delegation sets and you want to list all of the hosted zones that are associated with a reusable delegation set, specify the ID of that reusable delegation set.

> Constraints:

> * max: `32`

`--hosted-zone-type` (string)

> (Optional) Specifies if the hosted zone is private.

> Possible values:

> * `PrivateHostedZone`

`--starting-token` (string)

> A token to specify where to start paginating. This is the `NextToken` from a previously truncated response.

> For usage examples, see [Pagination](https://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the *AWS Command Line Interface User Guide* .

`--page-size` (string)

> The size of each page to get in the AWS service call. This does not affect the number of items returned in the command’s output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.

> For usage examples, see [Pagination](https://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the *AWS Command Line Interface User Guide* .

`--cli-input-json` | `--cli-input-yaml` (string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by `--generate-cli-skeleton`. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with `--cli-input-yaml`.

`--generate-cli-skeleton` (string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value `input`, prints a sample input JSON that can be used as an argument for `--cli-input-json`. Similarly, if provided `yaml-input` it will print a sample input YAML that can be used with `--cli-input-yaml`. If provided with the value `output`, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.

## Global Options

`--debug` (boolean)

Turn on debug logging.

`--endpoint-url` (string)

Override command’s default URL with the given URL.

`--no-verify-ssl` (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

`--no-paginate` (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

`--output` (string)

The formatting style for command output.

* json
* text
* table
* yaml
* yaml-stream
* off

`--query` (string)

A JMESPath query to use in filtering the response data.

`--profile` (string)

Use a specific profile from your credential file.

`--region` (string)

The region to use. Overrides config/env settings.

`--version` (string)

Display the version of this tool.

`--color` (string)

Turn on/off color output.

* on
* off
* auto

`--no-sign-request` (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

`--ca-bundle` (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

`--cli-read-timeout` (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

`--cli-connect-timeout` (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

`--cli-binary-format` (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob `fileb://` will always be treated as binary and use the file contents directly regardless of the `cli-binary-format` setting. When using `file://` the file contents will need to properly formatted for the configured `cli-binary-format`.

* base64
* raw-in-base64-out

`--no-cli-pager` (boolean)

Disable cli pager for output.

`--cli-auto-prompt` (boolean)

Automatically prompt for CLI input parameters.

`--no-cli-auto-prompt` (boolean)

Disable automatically prompt for CLI input parameters.

`--cli-error-format` (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

* legacy
* json
* yaml
* text
* table
* enhanced

`--help` (boolean)

Display help for the command/subcommand.

## Examples

#### NOTE
To use the following examples, you must have the AWS CLI installed and configured. See the [Getting started guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) in the *AWS CLI User Guide* for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See [Using quotation marks with strings](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html) in the *AWS CLI User Guide* .

**To list the hosted zones associated with the current AWS account**

The following `list-hosted-zones` example lists summary information about the first 100 hosted zones that are associated with the current AWS account.

```bash
aws route53 list-hosted-zones
```

Output:

```json
{
    "HostedZones": [
        {
            "Id": "/hostedzone/Z1R8UBAEXAMPLE",
            "Name": "example.com.",
            "CallerReference": "2014-04-01-18:47",
            "Config": {
                "Comment": "command-line version",
                "PrivateZone": false
            },
            "ResourceRecordSetCount": 2
        }
    ]
}
```

If you have more than 100 hosted zones, or if you want to list them in groups smaller than 100, include the `--max-items` parameter. For example, to list hosted zones one at a time, use the following command.

```bash
aws route53 list-hosted-zones \
    --max-items 1
```

To view information about the next hosted zone, take the value of `NextToken` from the response to the previous command, and include it in the `--starting-token` parameter, as shown in the following example.

```bash
aws route53 list-hosted-zones \
    --max-items 1 \
    --starting-token Z3M3LMPEXAMPLE
```

For more information, see [Listing public hosted zones](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ListInfoOnHostedZone.html) in the *Amazon Route 53 Developer Guide*.

## Output

HostedZones -> (list)

> A complex type that contains general information about the hosted zone.

> (structure)

> > A complex type that contains general information about the hosted zone.

> > Id -> (string) [required]

> > > The ID that Amazon Route 53 assigned to the hosted zone when you created it.

> > > Constraints:

> > > * max: `32`

> > Name -> (string) [required]

> > > The name of the domain. For public hosted zones, this is the name that you have registered with your DNS registrar.

> > > For information about how to specify characters other than `a-z` , `0-9` , and `-` (hyphen) and how to specify internationalized domain names, see [CreateHostedZone](https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHostedZone.html) .

> > > Constraints:

> > > * max: `1024`

> > CallerReference -> (string) [required]

> > > The value that you specified for `CallerReference` when you created the hosted zone.

> > > Constraints:

> > > * min: `1`
> > > * max: `128`

> > Config -> (structure)

> > > A complex type that includes the `Comment` and `PrivateZone` elements. If you omitted the `HostedZoneConfig` and `Comment` elements from the request, the `Config` and `Comment` elements don’t appear in the response.

> > > Comment -> (string)

> > > > Any comments that you want to include about the hosted zone.

> > > > Constraints:

> > > > * max: `256`

> > > PrivateZone -> (boolean)

> > > > A value that indicates whether this is a private hosted zone.

> > > HostedZoneTier -> (string)

> > > > The tier of the hosted zone. The tier controls which features you get and which optional features you can turn on. Valid values are the following:

> > > > > > STANDARD

> > > > > `STANDARD` is the default tier for new hosted zones.

> > > > > > ADVANCED

> > > > > `ADVANCED` is a tier that includes Change History and offers more optional features.

> > > > If you don’t specify a tier when you create a hosted zone, Route 53 uses `STANDARD` . Route 53 always returns this value. For pricing information, see Amazon Route 53 pricing on the [AWS website](https://aws.amazon.com/route53/pricing/) .

> > > > Possible values:

> > > > * `STANDARD`
> > > > * `ADVANCED`

> > ResourceRecordSetCount -> (long)

> > > The number of resource record sets in the hosted zone.

> > LinkedService -> (structure)

> > > If the hosted zone was created by another service, the service that created the hosted zone. When a hosted zone is created by another service, you can’t edit or delete it using Route 53.

> > > ServicePrincipal -> (string)

> > > > If the health check or hosted zone was created by another service, the service that created the resource. When a resource is created by another service, you can’t edit or delete it using Amazon Route 53.

> > > > Constraints:

> > > > * max: `128`

> > > Description -> (string)

> > > > If the health check or hosted zone was created by another service, an optional description that can be provided by the other service. When a resource is created by another service, you can’t edit or delete it using Amazon Route 53.

> > > > Constraints:

> > > > * max: `256`

> > Features -> (structure)

> > > The features configuration for the hosted zone, including accelerated recovery settings and status information.

> > > AcceleratedRecoveryStatus -> (string)

> > > > The current status of accelerated recovery for the hosted zone.

> > > > Possible values:

> > > > * `ENABLING`
> > > > * `ENABLE_FAILED`
> > > > * `ENABLING_HOSTED_ZONE_LOCKED`
> > > > * `ENABLED`
> > > > * `DISABLING`
> > > > * `DISABLE_FAILED`
> > > > * `DISABLED`
> > > > * `DISABLING_HOSTED_ZONE_LOCKED`

> > > PublicDNSFallbackStatus -> (string)

> > > > The current status of public DNS fallback for the hosted zone. Valid values:

> > > > * `ENABLED` : Public DNS fallback is enabled.
> > > > * `DISABLED` : Public DNS fallback is disabled.
> > > > * `ENABLING` : A request to enable public DNS fallback is still propagating.
> > > > * `DISABLING` : A request to disable public DNS fallback is still propagating.

> > > > Possible values:

> > > > * `ENABLED`
> > > > * `DISABLED`
> > > > * `ENABLING`
> > > > * `DISABLING`

> > > ChangeHistory -> (structure)

> > > > The status of Change History for the hosted zone, and the earliest time from which you can read its change history.

> > > > Status -> (string)

> > > > > Indicates whether Change History is turned on for the hosted zone. Valid values are the following:

> > > > > * `ENABLED` : Change History is turned on for the hosted zone.
> > > > > * `DISABLED` : Change History is turned off for the hosted zone.

> > > > > Route 53 turns Change History on or off when the hosted zone moves to or from a tier that includes it.

> > > > > Possible values:

> > > > > * `ENABLED`
> > > > > * `DISABLED`

> > > > RetentionStartsAt -> (timestamp)

> > > > > The earliest date and time from which you can read the change history of the hosted zone. Route 53 returns this value only when `Status` is `ENABLED` .

> > > FailureReasons -> (structure)

> > > > Information about any failures that occurred when attempting to enable or configure features for the hosted zone.

> > > > AcceleratedRecovery -> (string)

> > > > > The reason why accelerated recovery failed to be enabled or disabled for the hosted zone, if applicable.

> > > ChangeGuardrails -> (list)

> > > > The name and status of each Change Guardrail for the hosted zone. For the guardrail names and statuses, see `ChangeGuardrail` .

> > > > Constraints:

> > > > * min: `1`

> > > > (structure)

> > > > > A Change Guardrail and its status. A Change Guardrail checks each change to the records in a hosted zone, and rejects the change if the check fails.

> > > > > When you submit a `ChangeResourceRecordSets` request, Route 53 checks each change against every guardrail that is turned on. If a check fails, Route 53 rejects the whole request and returns an error that identifies the guardrail. If every check passes, Route 53 applies the changes.

> > > > > For example, suppose that `ALIAS_TARGET_CHECK` is turned on, and an alias record points to `www.example.com` . If you try to delete `www.example.com` , Route 53 rejects the request. To delete the record, first delete or change the alias record.

> > > > > Name -> (string) [required]

> > > > > > The name of the guardrail. Valid values are the following:

> > > > > > > NS_FORMAT_CHECK

> > > > > > This guardrail rejects an NS record whose value looks like a Route 53 name server but isn’t one.

> > > > > > > NS_DELEGATION_AUTHORITY_CHECK

> > > > > > This guardrail rejects an NS record that delegates a subdomain to Route 53 name servers that don’t host it.

> > > > > > This guardrail applies only to public hosted zones.

> > > > > > > NS_OCCLUSION_CHECK

> > > > > > This guardrail rejects a change that leaves records under a delegated subdomain, where resolvers never use them.

> > > > > > > ALIAS_TARGET_CHECK

> > > > > > This guardrail rejects deleting a record that an alias record in the same hosted zone points to.

> > > > > > > ACTIVE_RECORD_CHECK

> > > > > > This guardrail rejects deleting a record that still receives DNS queries, if no other record with the same name and type remains to answer them.

> > > > > > > ACTIVE_DELEGATION_CHECK

> > > > > > This guardrail rejects deleting the NS record for a subdomain while resolvers are still referred to it.

> > > > > > The tier of the hosted zone determines which guardrails it includes and which ones you can turn on.

> > > > > > Possible values:

> > > > > > * `NS_FORMAT_CHECK`
> > > > > > * `NS_DELEGATION_AUTHORITY_CHECK`
> > > > > > * `NS_OCCLUSION_CHECK`
> > > > > > * `ALIAS_TARGET_CHECK`
> > > > > > * `ACTIVE_RECORD_CHECK`
> > > > > > * `ACTIVE_DELEGATION_CHECK`

> > > > > Status -> (string) [required]

> > > > > > The status of the guardrail. Valid values are the following:

> > > > > > > > ENABLED

> > > > > > > `ENABLED` means that the guardrail is turned on.

> > > > > > > > DISABLED

> > > > > > > `DISABLED` means that the guardrail is turned off.

> > > > > > Possible values:

> > > > > > * `ENABLED`
> > > > > > * `DISABLED`

Marker -> (string)

> For the second and subsequent calls to `ListHostedZones` , `Marker` is the value that you specified for the `marker` parameter in the request that produced the current response.

> Constraints:

> * max: `64`

IsTruncated -> (boolean)

> A flag indicating whether there are more hosted zones to be listed. If the response was truncated, you can get more hosted zones by submitting another `ListHostedZones` request and specifying the value of `NextMarker` in the `marker` parameter.

NextMarker -> (string)

> If `IsTruncated` is `true` , the value of `NextMarker` identifies the first hosted zone in the next group of hosted zones. Submit another `ListHostedZones` request, and specify the value of `NextMarker` from the response in the `marker` parameter.

> This element is present only if `IsTruncated` is `true` .

> Constraints:

> * max: `64`

MaxItems -> (string)

> The value that you specified for the `maxitems` parameter in the call to `ListHostedZones` that produced the current response.
