跳至內容

如何解決建立 Amazon VPC 介面端點時收到的錯誤?

2 分的閱讀內容
0

我想解決建立 Amazon Virtual Private Cloud (Amazon VPC) 介面端點時收到的錯誤。

簡短說明

當您建立 Amazon VPC 介面端點時,可能會因為下列原因收到錯誤:

  • 您超過了端點的 Amazon VPC 服務配額限制。
  • API 正在限流。
  • 私有 DNS 命名空間重疊。
  • 您擁有的 AWS Identity and Access Management (IAM) 權限不足。

解決方法

**注意:**如果您在執行 AWS Command Line Interface (AWS CLI) 命令時收到錯誤訊息,請參閱 Troubleshooting errors for the AWS CLI (對 AWS CLI 進行疑難排解)。此外,請務必使用最新版 AWS CLI 。

**先決條件:**在您的 AWS CloudTrail 事件中找到 CreateVpcEndpoint API 呼叫。

對超過 Amazon VPC 服務配額的介面端點進行疑難排解

**重要事項:**共用子網路中的 VPC 端點總數不能超過擁有者 AWS 帳戶的配額。

在預設情況下,每個 VPC 的介面端點與 Gateway Load Balancer 端點配額為 50 個,此數量包含參與者帳戶所建立的 VPC 端點。如需更多資訊,請參閱 AWS PrivateLink quotas (AWS PrivateLink 配額)。

您超過了端點的 Amazon VPC 服務配額限制

如果您建立的端點數量超過服務配額允許上限,您的 CloudTrail 事件可能會收到下列錯誤:

"errorCode": "Client.VpcEndpointLimitExceeded",

"errorMessage": "Limit of VPC endpoints per VPC exceeded."

若要解決此問題,請申請提高服務配額。

您在共用 Amazon VPC 中透過參與者帳戶建立了 Amazon VPC 端點

**注意:**參與者帳戶無法在共用子網路中建立介面端點。然而,如果參與者帳戶在 VPC 的共用子網路中設定了支援的服務,該服務就會在共用子網路中建立介面端點。

如果您透過參與者 AWS 帳戶建立端點,則會發生下列錯誤:

"errorCode": "Client.UnauthorizedOperation"

"errorMessage": "This operation does not support shared VPCs."

請執行 describe-subnets 命令來驗證子網路擁有權並檢查 SubnetArn:

aws ec2 describe-subnets --subnet-ids example-subnet-id

**注意:**請將 example-subnet-id 替換為您的子網路 ID。

若要解決此錯誤,請透過 Amazon VPC 擁有者帳戶建立端點。如需更多資訊,請參閱 Manage VPC resources (管理 VPC 資源)。

您在共用 Amazon VPC 中透過擁有者帳戶建立 Amazon VPC 端點,但使用了參與者帳戶所擁有的安全群組

如果您透過擁有者帳戶建立端點,但使用的安全群組為參與者帳戶所擁有,則會發生下列錯誤:

"errorCode": "Client.InvalidParameter",

"errorMessage": "You are not authorized to perform CreateNetworkInterface operation.A subnet in this vpc is shared but the provided object is not owned by you"

請執行 describe-security-groups 命令來檢查安全群組的 OwnerId:

aws ec2 describe-security-groups --group-id security-group-id

**注意:**請將 security-group-id 替換為您的安全群組 ID。

若要解決此錯誤,請使用與擁有者帳戶相同的帳戶所擁有的安全群組。

API 正在限流

如果您的 API 呼叫正在限流,CloudTrail 事件中會發生下列錯誤:

"errorCode": "Client.RequestLimitExceeded",

"errorMessage": "Request limit exceeded."

若要解決此錯誤,請採取下列動作:

  • 使用退避機制重試失敗的 API 請求。
  • 處理多個資源。
  • 增加請求之間的睡眠時間間隔,以降低請求速率。
    **注意:**使用遞增或可變的睡眠時間間隔是最佳實務。

如需更多資訊,請參閱 Request throttling for the Amazon Elastic Compute Cloud (Amazon EC2) API (Amazon Elastic Compute Cloud (Amazon EC2) API 的請求限流)。

私有 DNS 命名空間重疊

如果您的私有 DNS 命名空間重疊,CloudTrail 事件中會發生下列錯誤:

"errorCode": "Client.InvalidParameter",

"errorMessage": "private-dns-enabled cannot be set because there is already a conflicting DNS domain for in VPC "

下列問題會導致此錯誤:

  • Amazon VPC 中已存在具有相同服務的私有 DNS 介面端點。
  • 具有相同服務名稱的私有託管區域已與 Amazon VPC 關聯。

若要解決此錯誤,請在建立端點時停用 PrivateDNSEnabled,並使用預設的 Amazon VPC 端點 DNS。對於私有託管區域具有重疊命名空間的 Amazon VPC,請使用預設的 Amazon VPC 端點 DNS 手動建立 ALIAS 記錄。

與 Amazon VPC 關聯的 Amazon Route 53 私有託管區域可以位於不同的帳戶中。若要檢視所有私有託管區域關聯的詳細資訊,請執行 list-hosted-zones-by-vpc 命令:

aws route53 list-hosted-zones-by-vpc --vpc-id example-vpc-ID --vpc-region example-region

**注意:**請將 example-vpc-ID 替換為您的 VPC ID,並將 example-region 替換為您的 AWS 區域。

IAM 權限不足

如果您在建立 Amazon VPC 端點時擁有的 IAM 權限不足,則會收到 "AccessDenied" 錯誤。若要解決此錯誤,請檢視進行 API 呼叫的 IAM 角色權限,然後以必要權限更新 IAM 角色。

相關資訊

Responsibilities and permissions for owners and participants (擁有者和參與者的職責與權限)

Amazon VPC quotas (Amazon VPC 配額)

AWS 官方已更新 1 年前