

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 的 Route 53 網域註冊範例 AWS CLI
<a name="cli_route-53-domains_code_examples"></a>

下列程式碼範例示範如何使用 AWS Command Line Interface 具有 Route 53 網域註冊的 來執行動作和實作常見案例。

*Actions* 是大型程式的程式碼摘錄，必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數，但您可以在其相關情境中查看內容中的動作。

每個範例均包含完整原始碼的連結，您可在連結中找到如何設定和執行內容中程式碼的相關指示。

**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` 命令會傳回有關是否可以使用 Route 53 註冊網域名稱 `example.com` 的資訊。  
此命令僅在 `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 不支援 TLD，則 `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 日 UTC 凌晨 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 參考》**中的 [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` 命令，然後從 Unix 格式轉換 `ExpirationDate` 的值。  
此命令僅在 `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)針對 TLD 的「註冊和續約期間」一節。  
如需詳細資訊，請參閱《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 參考》**中的 [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)。