

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

# 關聯 Amazon VPC 和您使用不同 AWS 帳戶建立的私有託管區域
<a name="hosted-zone-private-associate-vpcs-different-accounts"></a>

如果您想要將與一個 AWS 帳戶建立的 VPC 與另一個帳戶建立的私有託管區域建立關聯，請執行下列程序：

**將 Amazon VPC 與您使用不同 AWS 帳戶建立的私有託管區域建立關聯**

1. 使用建立託管區域的帳戶，透過以下其中一個方法授權 VPC 與私有託管區域的關聯：
   + **AWS CLI** – 請參閱 *AWS CLI 命令參考*中的 [create-vpc-association-authorization](https://docs.aws.amazon.com/cli/latest/reference/route53/create-vpc-association-authorization.html)
   + ** AWS SDK** 或 **AWS Tools for Windows PowerShell** – 請參閱 文件頁面上適用的[AWS文件](https://docs.aws.amazon.com/) 
   + **Amazon Route 53 API** – 請參閱 *Amazon Route 53 API 參考*中的 [CreateVPCAssociationAuthorization](https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateVPCAssociationAuthorization.html)

   注意下列事項：
   + 如果要將使用不同帳戶建立的多個 VPC 與私有託管區域關聯，必須為每個 VPC 提交一個授權請求。
   + 當您授權關聯，您必須指定託管區域 ID，因此私有託管區域必須已存在。
   + 您無法使用 Route 53 主控台來授權 VPC 與私有託管區域的關聯或建立關聯。

1. 使用建立 VPC 的帳戶，將 VPC 與託管區域關聯。如同授權關聯，您可以使用 AWS SDK、Tools for Windows PowerShell AWS CLI、 或 Route 53 API。如果使用 API，請使用 [AssociateVPCWithHostedZone](https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html) 動作。

1. *建議* – 刪除建立 VPC 與託管區域關聯的授權。刪除授權不會影響關聯，只是防止未來將 VPC 與託管區域重新關聯。如果要將 VPC 與託管區域重新關聯，您需要重複此程序的步驟 1 和 2。
**重要**  
`ListHostedZonesByVPC` 會傳回指定 VPC 的託管區域，而 `GetHostedZone` API 會傳回與託管區域相關聯的 VPCs。這些 APIs只會考慮由 `AssociateVPCWithHostedZone` API 建立或建立私有託管區域時的託管區域與 VPC 關聯。如果您想要託管區域與 VPC 關聯的完整清單，請同時呼叫 [ListProfileResourceAssociations](https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53profiles_ListProfileResourceAssociations.html)。
**注意**  
如需可建立的授權數量上限，請參閱 [實體的配額](DNSLimitations.md#limits-api-entities)。