如何對使用 AWS CLI 管理服務配額請求的錯誤進行疑難排解?

4 分的閱讀內容
0

當我使用 AWS Command Line Interface (AWS CLI) 管理增加的服務配額時,收到錯誤訊息。

簡短描述

以下是使用 AWS CLI 檢視和管理配額增加請求時可能發生的常見錯誤:

  • list-service-quotas 命令不會列出所有可用的配額。
  • 錯誤: 「調用 RequestServiceQuotaIncrease 操作時發生錯誤 (ResourceAlreadyExistsException): 每個配額只允許增加一次開放服務配額增加請求」。
  • 錯誤: 「調用 ListAWSDefaultServiceQuotas 操作時發生錯誤 (NoSuchResourceException): 請求失敗,因為指定的服務不存在」。

如需有關解決與 Service Quotas 無關之 AWS CLI 錯誤的一般資訊,請參閱為什麼在執行 AWS CLI 命令時收到錯誤?

解決方法

確認您使用的是最新版本的 AWS CLI

如果您使用的是舊版 AWS CLI,則在使用 API 命令時可能會遇到問題。升級至最新的 AWS CLI 版本,然後再次嘗試命令。

錯誤: list-service-quotas 命令不列出所有可用配額

list-service-quotas 命令傳回已套用配額值的配額。若要傳回所有預設值,請使用 list-aws-default-service-quotas 命令。

下列範例使用 list-service-quotas 命令。輸出會列出已套用值的兩個服務。

# aws service-quotas list-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table
------------------------------------------------------------------------------------------------------
| ListServiceQuotas |
+------------+--------------------------------+---------------------------------------------+--------+
| QuotaCode | QuotaName | ServiceName | Value |
+------------+--------------------------------+---------------------------------------------+--------+
| L-A4707A72| Internet gateways per Region | Amazon Virtual Private Cloud (Amazon VPC) | 10.0 |
| L-F678F1CE| VPCs per Region | Amazon Virtual Private Cloud (Amazon VPC) | 10.0 |
+------------+--------------------------------+---------------------------------------------+--------+

下列範例使用 list-service-quota 命令。輸出會列出與服務 (在此範例中為 VPC) 相關聯的所有配額及其預設配額值。

# aws service-quotas list-aws-default-service-quotas --service-code vpc --region eu-west-1 --query "Quotas[*].{ServiceName:ServiceName,QuotaName:QuotaName,QuotaCode:QuotaCode,Value:Value}" --output table
-----------------------------------------------------------------------------------------------------------------------
| ListAWSDefaultServiceQuotas |
+------------+------------------------------------------------+---------------------------------------------+---------+
| QuotaCode | QuotaName | ServiceName | Value |
+------------+------------------------------------------------+---------------------------------------------+---------+
| L-7E9ECCDB| Active VPC peering connections per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 50.0 |
| L-45FE3B85| Egress-only internet gateways per Region | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
| L-1B52E74A| Gateway VPC endpoints per Region | Amazon Virtual Private Cloud (Amazon VPC) | 20.0 |
| L-83CA0A9D| IPv4 CIDR blocks per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
| L-085A6257| IPv6 CIDR blocks per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 1.0 |
| L-0EA8095F| Inbound or outbound rules per security group | Amazon Virtual Private Cloud (Amazon VPC) | 60.0 |
| L-29B6F2EB| Interface VPC endpoints per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 50.0 |
| L-A4707A72| Internet gateways per Region | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
| L-FE5A380F| NAT gateways per Availability Zone | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
| L-B4A6D682| Network ACLs per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 200.0 |
| L-DF5E4CA3| Network interfaces per Region | Amazon Virtual Private Cloud (Amazon VPC) | 5000.0 |
| L-DC9F7029| Outstanding VPC peering connection requests | Amazon Virtual Private Cloud (Amazon VPC) | 25.0 |
| L-2C462E13| Participant accounts per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 100.0 |
| L-589F43AA| Route tables per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 200.0 |
| L-93826ACB| Routes per route table | Amazon Virtual Private Cloud (Amazon VPC) | 50.0 |
| L-2AEEBF1A| Rules per network ACL | Amazon Virtual Private Cloud (Amazon VPC) | 20.0 |
| L-2AFB9258| Security groups per network interface | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
| L-407747CB| Subnets per VPC | Amazon Virtual Private Cloud (Amazon VPC) | 200.0 |
| L-44499CD2| Subnets that can be shared with an account | Amazon Virtual Private Cloud (Amazon VPC) | 100.0 |
| L-8312C5BB| VPC peering connection request expiry hours | Amazon Virtual Private Cloud (Amazon VPC) | 168.0 |
| L-E79EC296| VPC security groups per Region | Amazon Virtual Private Cloud (Amazon VPC) | 2500.0 |
| L-F678F1CE| VPCs per Region | Amazon Virtual Private Cloud (Amazon VPC) | 5.0 |
+------------+------------------------------------------------+---------------------------------------------+---------+

錯誤: 「調用 RequestServiceQuotaIncrease 操作時發生錯誤 (ResourceAlreadyExistsException): 每個配額只允許增加一次開放服務配額增加請求。」

每個配額只允許增加一次開放服務配額增加請求。如果您在前一個請求完成之前提交另一個請求,則會收到 ResourceAlreadyExistsException 錯誤。

在提交另一個配額增加請求之前,請確認先前的配額增加請求已完成。

錯誤: 「調用 ListAWSDefaultServiceQuotas 操作時發生錯誤 (NoSuchResourceException): 請求失敗,因為指定的服務不存在。」

發生此錯誤的原因可能如下:

  • 客戶嘗試存取未與服務配額整合的項目。
  • 服務代碼區分大小寫。例如,不能以 EC2 形式輸入服務代碼 ec2 的值。以下範例將 --service-code 值正確顯示為 ec2
# aws service-quotas get-service-quota --service-code ec2 --quota-code L-0263D0A3 --region eu-west-1

相關資訊

如何使用 AWS CLI 命令要求、檢視和管理增加服務配額的申請?

什麼是 Service Quotas?

Service Quotas 介紹: 從單一位置集中檢視和管理 AWS 服務的配額

Service Quotas API 參考

AWS CLI 命令參考 - service-quotas

AWS 官方
AWS 官方已更新 1 年前