

# 使用AWS CLI的 Route 53 域注册示例
<a name="cli_route-53-domains_code_examples"></a>

以下代码示例演示如何通过将AWS Command Line Interface与 Route 53 域注册结合使用，来执行操作和实现常见场景。

*操作是大型程序的代码摘录*，必须在上下文中运行。您可以通过操作了解如何调用单个服务函数，还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接，您可以从中找到有关如何在上下文中设置和运行代码的说明。

**Topics**
+ [操作](#actions)

## 操作
<a name="actions"></a>

### `check-domain-availability`
<a name="route-53-domains_CheckDomainAvailability_cli_topic"></a>

以下代码示例演示了如何使用 `check-domain-availability`。

**AWS CLI**  
**确定是否可以在 Route 53 上注册域名**  
以下 `check-domain-availability` 命令返回有关域名 `example.com` 是否可以使用 Route 53 进行注册的信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains check-domain-availability \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "Availability": "UNAVAILABLE"
}
```
Route 53 支持大量顶级域（TLD），例如 `.com` 和 `.jp`，但我们并不支持所有可用的 TLD。如果您查看某个域是否可用，而 Route 53 不支持该顶级域，`check-domain-availability` 会返回以下消息。  

```
An error occurred (UnsupportedTLD) when calling the CheckDomainAvailability operation: <top-level domain> tld is not supported.
```
有关可在将域注册到 Route 53 时使用的 TLD 的列表，请参阅《Amazon Route 53 开发人员指南》**中的[可向 Amazon Route 53 注册的域](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/registrar-tld-list.html)。有关使用 Amazon Route 53 注册域的更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[注册新域](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CheckDomainAvailability](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/check-domain-availability.html)。

### `check-domain-transferability`
<a name="route-53-domains_CheckDomainTransferability_cli_topic"></a>

以下代码示例演示了如何使用 `check-domain-transferability`。

**AWS CLI**  
**确定域是否可以传输到 Route 53**  
以下 `check-domain-transferability` 命令返回有关是否可以将域名 `example.com` 传输到 Route 53 的信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains check-domain-transferability \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "Transferability": {
        "Transferable": "UNTRANSFERABLE"
    }
}
```
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[将域注册转移到 Amazon Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-to-route-53.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [CheckDomainTransferability](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/check-domain-transferability.html)。

### `delete-tags-for-domain`
<a name="route-53-domains_DeleteTagsForDomain_cli_topic"></a>

以下代码示例演示了如何使用 `delete-tags-for-domain`。

**AWS CLI**  
**删除域的标签**  
以下 `delete-tags-for-domain` 命令从指定域中删除三个标签。请注意，您只能指定标签键，不能指定标签值。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains delete-tags-for-domain \
    --region us-east-1 \
    --domain-name example.com \
    --tags-to-delete accounting-key hr-key engineering-key
```
此命令不生成任何输出。  
要确认标签已删除，则可以运行 [list-tags-for-domain](https://docs.aws.amazon.com/cli/latest/reference/route53domains/list-tags-for-domain.html)。有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[为 Amazon Route 53 资源添加标签](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/tagging-resources.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DeleteTagsForDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/delete-tags-for-domain.html)。

### `disable-domain-auto-renew`
<a name="route-53-domains_DisableDomainAutoRenew_cli_topic"></a>

以下代码示例演示了如何使用 `disable-domain-auto-renew`。

**AWS CLI**  
**禁用域的自动续订**  
以下 `disable-domain-auto-renew` 命令将 Route 53 配置为在域名注册到期之前不**自动续订域 `example.com`。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains disable-domain-auto-renew \
    --region us-east-1 \
    --domain-name example.com
```
此命令不生成任何输出。  
要确认设置已更改，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。如果禁用了自动续订，则 `AutoRenew` 的值为 `False`。有关自动续订的更多信息，请参阅《Amazon Route 53 开发者指南》**中的“续订域名注册”<https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-renew.html。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》中的 [DisableDomainAutoRenew](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/disable-domain-auto-renew.html)。**

### `disable-domain-transfer-lock`
<a name="route-53-domains_DisableDomainTransferLock_cli_topic"></a>

以下代码示例演示了如何使用 `disable-domain-transfer-lock`。

**AWS CLI**  
**禁用域名的转移锁定**  
以下 `disable-domain-transfer-lock` 命令可移除域 `example.com` 的转移锁定，以便可以将域转移到其他注册商。此命令将更改 `clientTransferProhibited` 状态。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains disable-domain-transfer-lock \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "OperationId": "3f28e0ac-126a-4113-9048-cc930example"
}
```
要确认转移锁定已更改，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。禁用转移锁定时，`StatusList` 的值不**包括 `clientTransferProhibited`。  
有关转移过程的更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[将域从 Amazon Route 53 转移到另一注册商](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-from-route-53.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [DisableDomainTransferLock](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/disable-domain-transfer-lock.html)。

### `enable-domain-auto-renew`
<a name="route-53-domains_EnableDomainAutoRenew_cli_topic"></a>

以下代码示例演示了如何使用 `enable-domain-auto-renew`。

**AWS CLI**  
**启用域的自动续订**  
以下 `enable-domain-auto-renew` 命令将 Route 53 配置为在域注册到期之前自动续订域 `example.com`。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains enable-domain-auto-renew \
    --region us-east-1 \
    --domain-name example.com
```
此命令不生成任何输出。要确认设置已更改，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。如果启用了自动续订，`AutoRenew` 的值为 `True`。  
有关自动续订的更多信息，请参阅《Amazon Route 53 开发者指南》**中的“续订域名注册”<https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-renew.html。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [EnableDomainAutoRenew](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/enable-domain-auto-renew.html)。

### `enable-domain-transfer-lock`
<a name="route-53-domains_EnableDomainTransferLock_cli_topic"></a>

以下代码示例演示了如何使用 `enable-domain-transfer-lock`。

**AWS CLI**  
**在域名上启用转移锁定**  
以下 `enable-domain-transfer-lock` 命令可锁定指定域，以便可以转移到其他注册商。此命令将更改 `clientTransferProhibited` 状态。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains enable-domain-transfer-lock \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "OperationId": "3f28e0ac-126a-4113-9048-cc930example"
}
```
要确认转移锁定已更改，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。启用转移锁定后，`StatusList` 的值包括 `clientTransferProhibited`。  
有关转移过程的更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[将域从 Amazon Route 53 转移到另一注册商](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-from-route-53.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [EnableDomainTransferLock](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/enable-domain-transfer-lock.html)。

### `get-contact-reachability-status`
<a name="route-53-domains_GetContactReachabilityStatus_cli_topic"></a>

以下代码示例演示了如何使用 `get-contact-reachability-status`。

**AWS CLI**  
**确定注册人联系人是否已回复确认电子邮件**  
以下 `get-contact-reachability-status` 命令返回有关指定域的注册人联系人是否已回复确认电子邮件的信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains get-contact-reachability-status \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "domainName": "example.com",
    "status": "DONE"
}
```
有关更多信息，请参阅《Amazon Route 53 开发者指南》**中的[重新发送授权和确认电子邮件](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-click-email-link.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetContactReachabilityStatus](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/get-contact-reachability-status.html)。

### `get-domain-detail`
<a name="route-53-domains_GetDomainDetail_cli_topic"></a>

以下代码示例演示了如何使用 `get-domain-detail`。

**AWS CLI**  
**获取有关指定域的详细信息**  
以下 `get-domain-detail` 命令显示有关指定域的详细信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains get-domain-detail \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "DomainName": "example.com",
    "Nameservers": [
        {
            "Name": "ns-2048.awsdns-64.com",
            "GlueIps": []
        },
        {
            "Name": "ns-2049.awsdns-65.net",
            "GlueIps": []
        },
        {
            "Name": "ns-2050.awsdns-66.org",
            "GlueIps": []
        },
        {
            "Name": "ns-2051.awsdns-67.co.uk",
            "GlueIps": []
        }
    ],
    "AutoRenew": true,
    "AdminContact": {
        "FirstName": "Saanvi",
        "LastName": "Sarkar",
        "ContactType": "COMPANY",
        "OrganizationName": "Example",
        "AddressLine1": "123 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "ssarkar@example.com",
        "ExtraParams": []
    },
    "RegistrantContact": {
        "FirstName": "Alejandro",
        "LastName": "Rosalez",
        "ContactType": "COMPANY",
        "OrganizationName": "Example",
        "AddressLine1": "123 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "arosalez@example.com",
        "ExtraParams": []
    },
    "TechContact": {
        "FirstName": "Wang",
        "LastName": "Xiulan",
        "ContactType": "COMPANY",
        "OrganizationName": "Example",
        "AddressLine1": "123 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "wxiulan@example.com",
        "ExtraParams": []
    },
    "AdminPrivacy": true,
    "RegistrantPrivacy": true,
    "TechPrivacy": true,
    "RegistrarName": "Amazon Registrar, Inc.",
    "WhoIsServer": "whois.registrar.amazon",
    "RegistrarUrl": "http://registrar.amazon.com",
    "AbuseContactEmail": "abuse@registrar.amazon.com",
    "AbuseContactPhone": "+1.2062661000",
    "CreationDate": 1444934889.601,
    "ExpirationDate": 1602787689.0,
    "StatusList": [
        "clientTransferProhibited"
    ]
}
```
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetDomainDetail](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/get-domain-detail.html)。

### `get-domain-suggestions`
<a name="route-53-domains_GetDomainSuggestions_cli_topic"></a>

以下代码示例演示了如何使用 `get-domain-suggestions`。

**AWS CLI**  
**获取建议的域名列表**  
以下 `get-domain-suggestions` 命令根据域名 `example.com` 显示建议域名列表。响应仅包含可用域名。此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains get-domain-suggestions \
    --region us-east-1 \
    --domain-name example.com \
    --suggestion-count 10 \
    --only-available
```
输出：  

```
{
    "SuggestionsList": [
        {
            "DomainName": "egzaampal.com",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "examplelaw.com",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "examplehouse.net",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "homeexample.net",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "examplelist.com",
            "Availability": "AVAILABLE"
       },
        {
            "DomainName": "examplenews.net",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "officeexample.com",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "exampleworld.com",
            "Availability": "AVAILABLE"
        },
        {
            "DomainName": "exampleart.com",
            "Availability": "AVAILABLE"
        }
    ]
}
```
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetDomainSuggestions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/get-domain-suggestions.html)。

### `get-operation-detail`
<a name="route-53-domains_GetOperationDetail_cli_topic"></a>

以下代码示例演示了如何使用 `get-operation-detail`。

**AWS CLI**  
**获取操作的当前状态**  
某些域注册操作是异步运行的，并在完成之前返回响应。这些操作会返回一个操作 ID，您可以使用它来获取当前状态。以下 `get-operation-detail` 命令返回指定操作的状态。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains get-operation-detail \
    --region us-east-1 \
    --operation-id edbd8d63-7fe7-4343-9bc5-54033example
```
输出：  

```
{
    "OperationId": "edbd8d63-7fe7-4343-9bc5-54033example",
    "Status": "SUCCESSFUL",
    "DomainName": "example.com",
    "Type": "DOMAIN_LOCK",
    "SubmittedDate": 1573749367.864
}
```
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [GetOperationDetail](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/get-operation-detail.html)。

### `list-domains`
<a name="route-53-domains_ListDomains_cli_topic"></a>

以下代码示例演示了如何使用 `list-domains`。

**AWS CLI**  
**列出使用当前 AWS 账户注册的域**  
以下 `list-domains` 命令列出了与使用当前 AWS 账户注册的域相关的摘要信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains list-domains
    --region us-east-1
```
输出：  

```
{
    "Domains": [
        {
            "DomainName": "example.com",
            "AutoRenew": true,
            "TransferLock": true,
            "Expiry": 1602712345.0
        },
        {
            "DomainName": "example.net",
            "AutoRenew": true,
            "TransferLock": true,
            "Expiry": 1602723456.0
        },
        {
            "DomainName": "example.org",
            "AutoRenew": true,
            "TransferLock": true,
            "Expiry": 1602734567.0
        }
    ]
}
```
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListDomains](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/list-domains.html)。

### `list-operations`
<a name="route-53-domains_ListOperations_cli_topic"></a>

以下代码示例演示了如何使用 `list-operations`。

**AWS CLI**  
**列出返回操作 ID 的操作的状态**  
某些域注册操作是异步运行的，并在完成之前返回响应。这些操作会返回一个操作 ID，您可以使用它来获取当前状态。以下 `list-operations` 命令列出了有关当前域注册操作的状态等摘要信息。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains list-operations
    --region us-east-1
```
输出：  

```
{
    "Operations": [
        {
            "OperationId": "aab9822f-1da0-4bf3-8a15-fd4e0example",
            "Status": "SUCCESSFUL",
            "Type": "DOMAIN_LOCK",
            "SubmittedDate": 1455321739.986
        },
        {
            "OperationId": "c24379ed-76be-42f8-bdad-9379bexample",
            "Status": "SUCCESSFUL",
            "Type": "UPDATE_NAMESERVER",
            "SubmittedDate": 1468960475.109
        },
        {
            "OperationId": "f47e1297-ef9e-4c2b-ae1e-a5fcbexample",
            "Status": "SUCCESSFUL",
            "Type": "RENEW_DOMAIN",
            "SubmittedDate": 1473561835.943
        },
        {
            "OperationId": "75584f23-b15f-459e-aed7-dc6f5example",
            "Status": "SUCCESSFUL",
            "Type": "UPDATE_DOMAIN_CONTACT",
            "SubmittedDate": 1547501003.41
        }
    ]
}
```
输出包括返回操作 ID 的所有操作，以及您在使用当前 AWS 账户注册的所有域中执行的操作。如果只想获取在指定日期之后提交的操作，可以包含 `submitted-since` 参数并以 Unix 格式和协调世界时（UTC）指定日期。以下命令可获取在协调世界时间 2020 年 1 月 1 日凌晨 12:00 之后提交的所有操作的状态。  

```
aws route53domains list-operations \
    --submitted-since 1577836800
```
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListOperations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/list-operations.html)。

### `list-tags-for-domain`
<a name="route-53-domains_ListTagsForDomain_cli_topic"></a>

以下代码示例演示了如何使用 `list-tags-for-domain`。

**AWS CLI**  
**列出域的标签**  
以下 `list-tags-for-domain` 命令列出当前与指定域关联的标签。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains list-tags-for-domain \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "TagList": [
        {
            "Key": "key1",
            "Value": "value1"
        },
        {
            "Key": "key2",
            "Value": "value2"
        }
    ]
}
```
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[为 Amazon Route 53 资源添加标签](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/tagging-resources.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ListTagsForDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/list-tags-for-domain.html)。

### `register-domain`
<a name="route-53-domains_RegisterDomain_cli_topic"></a>

以下代码示例演示了如何使用 `register-domain`。

**AWS CLI**  
**注册域**  
以下 `register-domain` 命令注册一个域，并从 JSON 格式的文件中检索所有参数值。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains register-domain \
    --region us-east-1 \
    --cli-input-json file://register-domain.json
```
 的内容`register-domain.json`：  

```
{
    "DomainName": "example.com",
    "DurationInYears": 1,
    "AutoRenew": true,
    "AdminContact": {
        "FirstName": "Martha",
        "LastName": "Rivera",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "mrivera@example.com"
    },
    "RegistrantContact": {
        "FirstName": "Li",
        "LastName": "Juan",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "ljuan@example.com"
    },
    "TechContact": {
        "FirstName": "Mateo",
        "LastName": "Jackson",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "mjackson@example.com"
    },
    "PrivacyProtectAdminContact": true,
    "PrivacyProtectRegistrantContact": true,
    "PrivacyProtectTechContact": true
}
```
输出：  

```
{
    "OperationId": "b114c44a-9330-47d1-a6e8-a0b11example"
}
```
要确认操作成功，可以运行 `get-operation-detail`。有关更多信息，请参阅 [get-operation-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-operation-detail.html)。  
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[注册新域](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-register.html)。  
有关哪些顶级域（TLD）需要 `ExtraParams` 值以及何为有效值的信息，请参阅《Amazon Route 53 API Reference》**中的 [ExtraParam](https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_ExtraParam.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [RegisterDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/register-domain.html)。

### `renew-domain`
<a name="route-53-domains_RenewDomain_cli_topic"></a>

以下代码示例演示了如何使用 `renew-domain`。

**AWS CLI**  
**续订域**  
以下 `renew-domain` 命令将续订指定域五年。要获取 `current-expiry-year` 值，请使用 `get-domain-detail` 命令，然后转换 `ExpirationDate` 值的 Unix 格式。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains renew-domain \
    --region us-east-1 \
    --domain-name example.com \
    --duration-in-years 5 \
    --current-expiry-year 2020
```
输出：  

```
{
    "OperationId": "3f28e0ac-126a-4113-9048-cc930example"
}
```
要确认操作成功，可以运行 `get-operation-detail`。有关更多信息，请参阅 [get-operation-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-operation-detail.html)。  
每个顶级域（TLD）（例如.com 或.org）的注册管理机构控制您可以续订域的最大年数。要获取域的最长续订时间，请参阅《Amazon Route 53 开发人员指南**》中[可向 Amazon Route 53 注册的域](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/registrar-tld-list.html)中“注册和续订期”部分。  
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[续订域注册](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-renew.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [RenewDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/renew-domain.html)。

### `resend-contact-reachability-email`
<a name="route-53-domains_ResendContactReachabilityEmail_cli_topic"></a>

以下代码示例演示了如何使用 `resend-contact-reachability-email`。

**AWS CLI**  
**向注册人联系人的电子邮件地址发送确认电子邮件**  
以下 `resend-contact-reachability-email` 命令将确认电子邮件重新发送到 example.com 域的注册商联系人的当前电子邮件地址。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains resend-contact-reachability-email \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "domainName": "example.com",
    "emailAddress": "moliveira@example.com",
    "isAlreadyVerified": true
}
```
如果 `isAlreadyVerified` 值为 `true`，如本例所示，则注册人联系人已经确认可以访问指定的电子邮件地址。  
有关更多信息，请参阅《Amazon Route 53 开发者指南》**中的[重新发送授权和确认电子邮件](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-click-email-link.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ResendContactReachabilityEmail](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/resend-contact-reachability-email.html)。

### `retrieve-domain-auth-code`
<a name="route-53-domains_RetrieveDomainAuthCode_cli_topic"></a>

以下代码示例演示了如何使用 `retrieve-domain-auth-code`。

**AWS CLI**  
**获取域的授权码，以将域转移到其他注册商**  
以下 `retrieve-domain-auth-code` 命令将获取 example.com 域的当前授权码。当您想将域转移给其他域注册商时，可以将此值提供给该注册商。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains retrieve-domain-auth-code \
    --region us-east-1 \
    --domain-name example.com
```
输出：  

```
{
    "AuthCode": ")o!v3dJeXampLe"
}
```
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[将域从 Amazon Route 53 转移到另一注册商](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-from-route-53.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》中的 [RetrieveDomainAuthCode](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/retrieve-domain-auth-code.html)。**

### `transfer-domain`
<a name="route-53-domains_TransferDomain_cli_topic"></a>

以下代码示例演示了如何使用 `transfer-domain`。

**AWS CLI**  
**将域转移到 Amazon Route 53**  
以下 `transfer-domain` 命令使用由 JSON 格式文件 `C:\temp\transfer-domain.json` 提供的参数将域转移到 Route 53。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains transfer-domain \
    --region us-east-1 \
    --cli-input-json file://C:\temp\transfer-domain.json
```
 的内容`transfer-domain.json`：  

```
{
    "DomainName": "example.com",
    "DurationInYears": 1,
    "Nameservers": [
        {
            "Name": "ns-2048.awsdns-64.com"
        },
        {
            "Name": "ns-2049.awsdns-65.net"
        },
        {
            "Name": "ns-2050.awsdns-66.org"
        },
        {
            "Name": "ns-2051.awsdns-67.co.uk"
        }
    ],
    "AuthCode": ")o!v3dJeXampLe",
    "AutoRenew": true,
    "AdminContact": {
        "FirstName": "Martha",
        "LastName": "Rivera",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "mrivera@example.com"
    },
    "RegistrantContact": {
        "FirstName": "Li",
        "LastName": "Juan",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "ljuan@example.com"
    },
    "TechContact": {
        "FirstName": "Mateo",
        "LastName": "Jackson",
        "ContactType": "PERSON",
        "OrganizationName": "Example",
        "AddressLine1": "1 Main Street",
        "City": "Anytown",
        "State": "WA",
        "CountryCode": "US",
        "ZipCode": "98101",
        "PhoneNumber": "+1.8005551212",
        "Email": "mjackson@example.com"
    },
    "PrivacyProtectAdminContact": true,
    "PrivacyProtectRegistrantContact": true,
    "PrivacyProtectTechContact": true
}
```
输出：  

```
{
    "OperationId": "b114c44a-9330-47d1-a6e8-a0b11example"
}
```
要确认操作成功，可以运行 `get-operation-detail`。有关更多信息，请参阅 [get-operation-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-operation-detail.html)。  
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[将域注册转移到 Amazon Route 53](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer-to-route-53.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》中的 [TransferDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/transfer-domain.html)**。

### `update-domain-contact-privacy`
<a name="route-53-domains_UpdateDomainContactPrivacy_cli_topic"></a>

以下代码示例演示了如何使用 `update-domain-contact-privacy`。

**AWS CLI**  
**更新域联系人的隐私设置**  
以下 `update-domain-contact-privacy` 命令关闭了 example.com 域的管理员联系人的隐私保护。此命令仅在 `us-east-1` 区域中运行。  
如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains update-domain-contact-privacy \
    --region us-east-1 \
    --domain-name example.com \
    --no-admin-privacy
```
输出：  

```
{
    "OperationId": "b3a219e9-d801-4244-b533-b7256example"
}
```
要确认操作成功，可以运行 `get-operation-detail`。有关更多信息，请参阅 [get-operation-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-operation-detail.html)。  
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[为域的联系信息启用或禁用隐私保护](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-privacy-protection.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdateDomainContactPrivacy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/update-domain-contact-privacy.html)。

### `update-domain-contact`
<a name="route-53-domains_UpdateDomainContact_cli_topic"></a>

以下代码示例演示了如何使用 `update-domain-contact`。

**AWS CLI**  
**更新域的联系信息**  
以下 `update-domain-contact` 命令更新域的联系人信息，从 JSON 格式的文件 `C:\temp\update-domain-contact.json` 中获取参数。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains update-domain-contact \
    --region us-east-1 \
    --cli-input-json file://C:\temp\update-domain-contact.json
```
 的内容`update-domain-contact.json`：  

```
{
    "AdminContact": {
        "AddressLine1": "101 Main Street",
        "AddressLine2": "Suite 1a",
        "City": "Seattle",
        "ContactType": "COMPANY",
        "CountryCode": "US",
        "Email": "w.xiulan@example.com",
        "FirstName": "Wang",
        "LastName": "Xiulan",
        "OrganizationName": "Example",
        "PhoneNumber": "+1.8005551212",
        "State": "WA",
        "ZipCode": "98101"
    },
    "DomainName": "example.com",
    "RegistrantContact": {
        "AddressLine1": "101 Main Street",
        "AddressLine2": "Suite 1a",
        "City": "Seattle",
        "ContactType": "COMPANY",
        "CountryCode": "US",
        "Email": "w.xiulan@example.com",
        "FirstName": "Wang",
        "LastName": "Xiulan",
        "OrganizationName": "Example",
        "PhoneNumber": "+1.8005551212",
        "State": "WA",
        "ZipCode": "98101"
    },
    "TechContact": {
        "AddressLine1": "101 Main Street",
        "AddressLine2": "Suite 1a",
        "City": "Seattle",
        "ContactType": "COMPANY",
        "CountryCode": "US",
        "Email": "w.xiulan@example.com",
        "FirstName": "Wang",
        "LastName": "Xiulan",
        "OrganizationName": "Example",
        "PhoneNumber": "+1.8005551212",
        "State": "WA",
        "ZipCode": "98101"
    }
}
```
输出：  

```
{
    "OperationId": "b3a219e9-d801-4244-b533-b7256example"
}
```
要确认操作是否成功，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。有关更多信息，请参阅《Amazon Route 53 开发者指南》**中的[更新域的联系人信息](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-update-contacts.html#domain-update-contacts-basic)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdateDomainContact](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/update-domain-contact.html)。

### `update-domain-nameservers`
<a name="route-53-domains_UpdateDomainNameservers_cli_topic"></a>

以下代码示例演示了如何使用 `update-domain-nameservers`。

**AWS CLI**  
**更新域的名称服务器**  
以下 `update-domain-nameservers` 命令更新了域的名称服务器。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains update-domain-nameservers \
    --region us-east-1 \
    --domain-name example.com \
    --nameservers Name=ns-1.awsdns-01.org Name=ns-2.awsdns-02.co.uk Name=ns-3.awsdns-03.net Name=ns-4.awsdns-04.com
```
输出：  

```
{
    "OperationId": "f1691ec4-0e7a-489e-82e0-b19d3example"
}
```
要确认操作是否成功，您可以运行 [get-domain-detail](https://docs.aws.amazon.com/cli/latest/reference/route53domains/get-domain-detail.html)。  
有关更多信息，请参阅《Amazon Route 53 开发人员》**中的[为域添加或更改名称服务器和粘附记录](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-name-servers-glue-records.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdateDomainNameservers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/update-domain-nameservers.html)。

### `update-tags-for-domain`
<a name="route-53-domains_UpdateTagsForDomain_cli_topic"></a>

以下代码示例演示了如何使用 `update-tags-for-domain`。

**AWS CLI**  
**为域名添加或更新标签**  
以下 `update-tags-for-domain` 命令添加或更新 example.com 域的两个键和相应值。要更新键值，只需包含键和新值。一次只能在一个域中添加或更新标签。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains update-tags-for-domain \
    --region us-east-1 \
    --domain-name example.com \
    --tags-to-update "Key=key1,Value=value1" "Key=key2,Value=value2"
```
此命令不生成任何输出。要确认标签是否已添加或更新，您可以运行 [list-tags-for-domain](https://docs.aws.amazon.com/cli/latest/reference/route53domains/list-tags-for-domain.html)。  
有关更多信息，请参阅《Amazon Route 53 开发人员指南》**中的[为 Amazon Route 53 资源添加标签](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/tagging-resources.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [UpdateTagsForDomain](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/update-tags-for-domain.html)。

### `view-billing`
<a name="route-53-domains_ViewBilling_cli_topic"></a>

以下代码示例演示了如何使用 `view-billing`。

**AWS CLI**  
**获取当前 AWS 账户的域注册费用的账单信息**  
以下 `view-billing` 命令返回当前账户自 2018 年 1 月 1 日（Unix 时间为 1514764800）至 2019 年 12 月 31 日午夜（Unix 时间为 1577836800）期间的所有与域相关的账单记录。  
此命令仅在 `us-east-1` 区域中运行。如果您的默认区域设置为 `us-east-1`，则可以省略 `region` 参数。  

```
aws route53domains view-billing \
    --region us-east-1 \
    --start-time 1514764800 \
    --end-time 1577836800
```
输出：  

```
{
    "BillingRecords": [
        {
            "DomainName": "example.com",
            "Operation": "RENEW_DOMAIN",
            "InvoiceId": "149962827",
            "BillDate": 1536618063.181,
            "Price": 12.0
        },
        {
            "DomainName": "example.com",
            "Operation": "RENEW_DOMAIN",
            "InvoiceId": "290913289",
            "BillDate": 1568162630.884,
            "Price": 12.0
        }
    ]
}
```
有关更多信息，请参阅《Amazon Route 53 API Reference》**中的 [ViewBilling](https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_ViewBilling.html)。  
+  有关 API 详细信息，请参阅《AWS CLI 命令参考》**中的 [ViewBilling](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53domains/view-billing.html)。