AWS 文档 SDK 示例
将 CreateHostedZone 与 CLI 配合使用
以下代码示例演示如何使用 CreateHostedZone。
- CLI
-
- AWS CLI
-
创建托管区
以下
create-hosted-zone命令使用调用方参考2014-04-01-18:47添加名为example.com的托管区。可选注释中包含一个空格,因此必须用引号括起来:aws route53 create-hosted-zone --nameexample.com--caller-reference2014-04-01-18:47--hosted-zone-config Comment="command-line version"有关更多信息,请参阅《Amazon Route 53 开发人员指南》中的“使用托管区”。
-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 CreateHostedZone
。
-
- PowerShell
-
- Tools for 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 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 CreateHostedZone。
-
- Tools for 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 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 CreateHostedZone。
-