View a markdown version of this page

将 CreateHostedZone 与 CLI 配合使用 - Amazon Route 53

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

将 CreateHostedZone 与 CLI 配合使用

以下代码示例显示了如何使用 CreateHostedZone。

CLI
AWS CLI

创建托管区

以下 create-hosted-zone 示例添加了一个名为的托管区域 example.com 使用来电者引用 2014-04-01-18:47。可选注释包含空格,因此必须用引号括起来。

aws route53 create-hosted-zone \ --name example.com \ --caller-reference 2014-04-01-18:47 \ --hosted-zone-config Comment="command-line version"

输出:

{ "Location": "https://route53.amazonaws.com/2013-04-01/hostedzone/Z1D633PJEXAMPLE", "HostedZone": { "Id": "/hostedzone/Z1D633PJEXAMPLE", "Name": "example.com.", "CallerReference": "2014-04-01-18:47", "Config": { "Comment": "command-line version", "PrivateZone": false }, "ResourceRecordSetCount": 2 }, "ChangeInfo": { "Id": "/change/C1PA6795EXAMPLE", "Status": "PENDING", "SubmittedAt": "2014-04-01T18:47:10.123Z" }, "DelegationSet": { "NameServers": [ "ns-2048.awsdns-64.com", "ns-2049.awsdns-65.net", "ns-2050.awsdns-66.org", "ns-2051.awsdns-67.co.uk" ] } }

有关更多信息,请参阅《Amazon Route 53 开发人员指南》中的创建公共托管区。

  • 有关 API 的详细信息,请参阅 CreateHostedZone 在 AWS CLI 命令参考。

PowerShell
用途的工具 PowerShell V4

示例 1:创建名为“example.com”的新托管区,并与可重复使用的委托集相关联。请注意,您必须提供一个值 CallerReference 参数,以便在必要时需要重试的请求,而不会冒两次执行操作的风险。由于托管区域是在 VPC 中创建的,因此它会自动变为私有区域,因此您不应设置-HostedZoneConfig_PrivateZone 参数。

$params = @{ Name="example.com" CallerReference="myUniqueIdentifier" HostedZoneConfig_Comment="This is my first hosted zone" DelegationSetId="NZ8X2CISAMPLE" VPC_VPCId="vpc-1a2b3c4d" VPC_VPCRegion="us-east-1" } New-R53HostedZone @params
  • 有关 API 的详细信息,请参阅 CreateHostedZone 在 AWS Tools for PowerShell Cmdlet 参考手册 (V4)。

用途的工具 PowerShell V5

示例 1:创建名为“example.com”的新托管区,并与可重复使用的委托集相关联。请注意,您必须提供一个值 CallerReference 参数,以便在必要时需要重试的请求,而不会冒两次执行操作的风险。由于托管区域是在 VPC 中创建的,因此它会自动变为私有区域,因此您不应设置-HostedZoneConfig_PrivateZone 参数。

$params = @{ Name="example.com" CallerReference="myUniqueIdentifier" HostedZoneConfig_Comment="This is my first hosted zone" DelegationSetId="NZ8X2CISAMPLE" VPC_VPCId="vpc-1a2b3c4d" VPC_VPCRegion="us-east-1" } New-R53HostedZone @params
  • 有关 API 的详细信息,请参阅 CreateHostedZone 在 AWS Tools for PowerShell Cmdlet 参考手册 (V5)。

如需查看完整清单 AWS SDK 开发者指南和代码示例,请参阅 将 Route 53 与 AWS SDK。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。