本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Service Quotas 示例 AWS CLI
以下代码示例向您展示了如何使用 with Service Quotas 来执行操作和实现常见场景。 AWS Command Line Interface
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。
每个示例都包含一个指向完整源代码的链接,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例显示了如何使用get-aws-default-service-quota
。
- AWS CLI
-
描述默认服务配额
以下
get-aws-default-service-quota
示例显示了指定配额的详细信息。aws service-quotas get-aws-default-service-quota \ --service-code
ec2
\ --quota-codeL-1216C47A
输出:
{ "Quota": { "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaArn": "arn:aws:servicequotas:us-east-2::ec2/L-1216C47A", "QuotaCode": "L-1216C47A", "QuotaName": "Running On-Demand Standard (A, C, D, H, I, M, R, T, Z) instances", "Value": 5.0, "Unit": "None", "Adjustable": true, "GlobalQuota": false, "UsageMetric": { "MetricNamespace": "AWS/Usage", "MetricName": "ResourceCount", "MetricDimensions": { "Class": "Standard/OnDemand", "Resource": "vCPU", "Service": "EC2", "Type": "Resource" }, "MetricStatisticRecommendation": "Maximum" } } }
-
有关API详细信息,请参阅 “GetAwsDefaultServiceQuota AWS CLI
命令参考”。
-
以下代码示例显示了如何使用get-requested-service-quota-change
。
- AWS CLI
-
描述增加服务配额的请求
以下
get-requested-service-quota-change
示例描述了指定的增加配额的请求。aws service-quotas get-requested-service-quota-change \ --request-id
d187537d15254312a9609aa51bbf7624u7W49tPO
输出:
{ "RequestedQuota": { "Id": "d187537d15254312a9609aa51bbf7624u7W49tPO", "CaseId": "6780195351", "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaCode": "L-20F13EBD", "QuotaName": "Running Dedicated c5n Hosts", "DesiredValue": 2.0, "Status": "CASE_OPENED", "Created": 1580446904.067, "LastUpdated": 1580446953.265, "Requester": "{\"accountId\":\"123456789012\",\"callerArn\":\"arn:aws:iam::123456789012:root\"}", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:ec2/L-20F13EBD", "GlobalQuota": false, "Unit": "None" } }
-
有关API详细信息,请参阅 “GetRequestedServiceQuotaChange AWS CLI
命令参考”。
-
以下代码示例显示了如何使用get-service-quota
。
- AWS CLI
-
描述服务配额
以下
get-service-quota
示例显示有关指定配额的详细信息。aws service-quotas get-service-quota \ --service-code
ec2
\ --quota-codeL-1216C47A
输出:
{ "Quota": { "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:ec2/L-1216C47A", "QuotaCode": "L-1216C47A", "QuotaName": "Running On-Demand Standard (A, C, D, H, I, M, R, T, Z) instances", "Value": 1920.0, "Unit": "None", "Adjustable": true, "GlobalQuota": false, "UsageMetric": { "MetricNamespace": "AWS/Usage", "MetricName": "ResourceCount", "MetricDimensions": { "Class": "Standard/OnDemand", "Resource": "vCPU", "Service": "EC2", "Type": "Resource" }, "MetricStatisticRecommendation": "Maximum" } } }
-
有关API详细信息,请参阅 “GetServiceQuota AWS CLI
命令参考”。
-
以下代码示例显示了如何使用list-aws-default-service-quotas
。
- AWS CLI
-
列出服务的默认配额
以下
list-aws-default-service-quotas
示例列出了指定服务配额的默认值。aws service-quotas list-aws-default-service-quotas \ --service-code
xray
输出:
{ "Quotas": [ { "ServiceCode": "xray", "ServiceName": "AWS X-Ray", "QuotaArn": "arn:aws:servicequotas:us-west-2::xray/L-C6B6F05D", "QuotaCode": "L-C6B6F05D", "QuotaName": "Indexed annotations per trace", "Value": 50.0, "Unit": "None", "Adjustable": false, "GlobalQuota": false }, { "ServiceCode": "xray", "ServiceName": "AWS X-Ray", "QuotaArn": "arn:aws:servicequotas:us-west-2::xray/L-D781C0FD", "QuotaCode": "L-D781C0FD", "QuotaName": "Segment document size", "Value": 64.0, "Unit": "Kilobytes", "Adjustable": false, "GlobalQuota": false }, { "ServiceCode": "xray", "ServiceName": "AWS X-Ray", "QuotaArn": "arn:aws:servicequotas:us-west-2::xray/L-998BFF16", "QuotaCode": "L-998BFF16", "QuotaName": "Trace and service graph retention in days", "Value": 30.0, "Unit": "None", "Adjustable": false, "GlobalQuota": false } ] }
-
有关API详细信息,请参阅 “ListAwsDefaultServiceQuotas AWS CLI
命令参考”。
-
以下代码示例显示了如何使用list-requested-service-quota-change-history-by-quota
。
- AWS CLI
-
列出您的配额增加请求
以下
list-requested-service-quota-change-history-by-quota
示例列出了针对指定配额的配额增加请求。aws service-quotas list-requested-service-quota-change-history-by-quota \ --service-code
ec2
\ --quota-codeL-20F13EBD
输出:
{ "RequestedQuotas": [ { "Id": "d187537d15254312a9609aa51bbf7624u7W49tPO", "CaseId": "6780195351", "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaCode": "L-20F13EBD", "QuotaName": "Running Dedicated c5n Hosts", "DesiredValue": 2.0, "Status": "CASE_OPENED", "Created": 1580446904.067, "LastUpdated": 1580446953.265, "Requester": "{\"accountId\":\"123456789012\",\"callerArn\":\"arn:aws:iam::123456789012:root\"}", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:ec2/L-20F13EBD", "GlobalQuota": false, "Unit": "None" } ] }
-
有关API详细信息,请参阅 “ListRequestedServiceQuotaChangeHistoryByQuota AWS CLI
命令参考”。
-
以下代码示例显示了如何使用list-requested-service-quota-change-history
。
- AWS CLI
-
列出您的配额增加请求
以下
list-requested-service-quota-change-history
示例列出了指定服务的配额增加请求。aws service-quotas list-requested-service-quota-change-history \ --service-code
ec2
输出:
{ "RequestedQuotas": [ { "Id": "d187537d15254312a9609aa51bbf7624u7W49tPO", "CaseId": "6780195351", "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaCode": "L-20F13EBD", "QuotaName": "Running Dedicated c5n Hosts", "DesiredValue": 2.0, "Status": "CASE_OPENED", "Created": 1580446904.067, "LastUpdated": 1580446953.265, "Requester": "{\"accountId\":\"123456789012\",\"callerArn\":\"arn:aws:iam::123456789012:root\"}", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:ec2/L-20F13EBD", "GlobalQuota": false, "Unit": "None" } ] }
-
有关API详细信息,请参阅 “ListRequestedServiceQuotaChangeHistory AWS CLI
命令参考”。
-
以下代码示例显示了如何使用list-service-quotas
。
- AWS CLI
-
列出服务的配额
以下
list-service-quotas
示例显示了有关配额的详细信息 AWS CloudFormation。aws service-quotas list-service-quotas \ --service-code
cloudformation
输出:
{ "Quotas": [ { "ServiceCode": "cloudformation", "ServiceName": "AWS CloudFormation", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:cloudformation/L-87D14FB7", "QuotaCode": "L-87D14FB7", "QuotaName": "Output count in CloudFormation template", "Value": 60.0, "Unit": "None", "Adjustable": false, "GlobalQuota": false }, { "ServiceCode": "cloudformation", "ServiceName": "AWS CloudFormation", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:cloudformation/L-0485CB21", "QuotaCode": "L-0485CB21", "QuotaName": "Stack count", "Value": 200.0, "Unit": "None", "Adjustable": true, "GlobalQuota": false } ] }
-
有关API详细信息,请参阅 “ListServiceQuotas AWS CLI
命令参考”。
-
以下代码示例显示了如何使用list-services
。
- AWS CLI
-
列出可用服务
以下命令列出了 Service Quotas 中可用的服务。
aws service-quotas list-services
输出:
{ "Services": [ { "ServiceCode": "AWSCloudMap", "ServiceName": "AWS Cloud Map" }, { "ServiceCode": "access-analyzer", "ServiceName": "Access Analyzer" }, { "ServiceCode": "acm", "ServiceName": "AWS Certificate Manager (ACM)" }, ...truncated... { "ServiceCode": "xray", "ServiceName": "AWS X-Ray" } ] }
您可以添加
--query
参数以筛选显示的内容,以显示您感兴趣的信息。以下示例仅显示服务代码。aws service-quotas list-services \ --query
Services[*].ServiceCode
输出:
[ "AWSCloudMap", "access-analyzer", "acm", "acm-pca", "amplify", "apigateway", "application-autoscaling", ...truncated... "xray" ]
-
有关API详细信息,请参阅 “ListServices AWS CLI
命令参考”。
-
以下代码示例显示了如何使用request-service-quota-increase
。
- AWS CLI
-
申请增加服务配额
以下
request-service-quota-increase
示例请求增加指定的服务配额。aws service-quotas request-service-quota-increase \ --service-code
ec2
\ --quota-codeL-20F13EBD
\ --desired-value2
输出:
{ "RequestedQuota": { "Id": "d187537d15254312a9609aa51bbf7624u7W49tPO", "ServiceCode": "ec2", "ServiceName": "Amazon Elastic Compute Cloud (Amazon EC2)", "QuotaCode": "L-20F13EBD", "QuotaName": "Running Dedicated c5n Hosts", "DesiredValue": 2.0, "Status": "PENDING", "Created": 1580446904.067, "Requester": "{\"accountId\":\"123456789012\",\"callerArn\":\"arn:aws:iam::123456789012:root\"}", "QuotaArn": "arn:aws:servicequotas:us-east-2:123456789012:ec2/L-20F13EBD", "GlobalQuota": false, "Unit": "None" } }
-
有关API详细信息,请参阅 “RequestServiceQuotaIncrease AWS CLI
命令参考”。
-