

# 使用跨账户的私有自定义域名
<a name="apigateway-private-custom-domains-other-accounts"></a>

此部分介绍如何使用跨账户的私有自定义域名。您可以向其他 Amazon Web Services 账户提供私有自定义域名，并使用其他 Amazon Web Services 账户调用私有自定义域名。

您可以使用 Amazon Resource Access Manager 或 API Gateway，与其他 Amazon Web Services 账户共享您的私有自定义域名。Amazon Resource Access Manager（Amazon RAM）可帮助您跨 Amazon Web Services 账户以及在组织或组织单位（OU）内部安全地共享资源。有关更多信息，请参阅[什么是 Amazon Resource Access Manager](https://docs.amazonaws.cn/ram/latest/userguide/what-is.html)。

有关如何使用 Amazon RAM 与其他 Amazon Web Services 账户共享私有自定义域名的说明，请参阅 [API 提供方：使用 Amazon RAM 共享您的私有自定义域名](apigateway-private-custom-domains-provider-share.md)。

有关如何使用 API Gateway 与其他 Amazon Web Services 账户共享私有自定义域名的说明，请参阅 [API 提供方：使用 API Gateway Amazon CLI 共享您的私有自定义域名](apigateway-private-custom-domains-provider-share-cli.md)。

有关如何在其他 Amazon Web Services 账户中使用私有自定义域名的说明，请参阅 [API 使用方：将您的 VPC 端点关联到与您共享的私有自定义域名](apigateway-private-custom-domains-consumer-create.md)。

## 使用跨账户的私有自定义域名的最佳实践
<a name="apigateway-private-custom-domains-other-accounts-best-practices"></a>

对于使用跨账户的私有自定义域名，建议的最佳实践如下：
+ 使用 Amazon RAM 共享您的私有自定义域名。当您使用 Amazon RAM 时，您可以减少运营开销，而且无需为 Amazon API Gateway 管理服务创建 `managementPolicy`。
+ 在列出您的私有自定义域名或域名访问关联时，请使用 `resource-owner` 参数。仅在列出由您或其他 Amazon Web Services 账户拥有的资源时，才使用 `resource-owner` 参数。

  以下示例演示如何获取您拥有的所有域名访问关联：

  ```
  aws apigateway get-domain-name-access-associations --resource-owner SELF
  ```

  使用 `--resource-owner OTHER_ACCOUNTS` 列出其他账户与您的私有自定义域名建立的所有域名访问关联。