将 ListHostedZonesByName 与 CLI 配合使用 - AWS SDK 代码示例

文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

ListHostedZonesByName 与 CLI 配合使用

以下代码示例演示如何使用 ListHostedZonesByName

CLI
AWS CLI

以下命令最多列出 100 个按域名排序的托管区:

aws route53 list-hosted-zones-by-name

输出:

{ "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" }

以下命令列出按名称排序的托管区,开头为 www.example.com

aws route53 list-hosted-zones-by-name --dns-name www.example.com

输出:

{ "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" }
PowerShell
用于 PowerShell

示例 1:按照域名以 ASCII 顺序返回所有公有和私有托管区。

Get-R53HostedZonesByName

示例 2:按照域名以 ASCII 顺序返回公有和私有托管区,开头为指定的 DNS 名称。

Get-R53HostedZonesByName -DnsName example2.com
  • 有关 API 的详细信息,请参阅 AWS Tools for PowerShell Cmdlet 参考ListHostedZonesByName中的。