service-quota-check
Use this skill during any incident investigation, capacity planning, or
yuriypr · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add aws/tools-for-devops-agent --skill service-quota-check技能说明
name: service-quota-check description: Use this skill during any incident investigation, capacity planning, or operational troubleshooting when the issue may be caused by hitting AWS service limits. Activate when you observe throttling errors (ThrottlingException, TooManyRequestsException, LimitExceededException), resource creation failures, capacity-related alarms, or when a recommendation involves provisioning new AWS resources. metadata: author: yuriypr version: "1.0.0" aws-devops-agent-skills.agent-types: "Chat tasks, Incident RCA" aws-devops-agent-skills.aws-services: "AWS Service Quotas, Amazon CloudWatch" aws-devops-agent-skills.technical-domains: "Operations, Capacity Planning"
Service Quota Check
Use this skill to check AWS service quota utilization during investigations and before provisioning new resources. It determines whether a quota is nearing its limit (85%+ utilization) and takes action: requesting a quota increase via the Service Quotas API when possible, or recommending a support case when programmatic increases are not supported.
When to Use This Skill
- An error message indicates throttling or limit exceeded (e.g.,
ThrottlingException,TooManyRequestsException,LimitExceededException,ResourceLimitExceeded). - A resource creation or scaling operation fails with capacity errors.
- An investigation recommendation involves provisioning additional AWS resources (e.g., adding EC2 instances, creating VPCs, adding NAT Gateways, launching RDS instances).
- Capacity planning or pre-launch readiness checks.
- Proactive monitoring of quota utilization across services.
Prerequisites
- The agent must have permissions to call Service Quotas APIs:
servicequotas:ListServicesservicequotas:ListServiceQuotasservicequotas:GetServiceQuotaservicequotas:RequestServiceQuotaIncreaseservicequotas:ListRequestedServiceQuotaChangeHistoryservicequotas:CreateSupportCase
- For utilization data via CloudWatch, the agent needs:
cloudwatch:GetMetricDatacloudwatch:GetMetricStatistics
- Service Quotas is a regional service. Quotas must be checked in the region where resources are deployed.
Step 1: Identify the Service and Quota Context
Determine which service and quota to check based on the investigation context:
- From error messages — extract the service name and specific limit mentioned.
- From recommendations — if the recommendation is to provision resources, identify the service (e.g., EC2, VPC, RDS, Lambda, ELB) and the resource type.
- From alarms — if a CloudWatch alarm indicates capacity pressure, identify the underlying service.
Common service codes
| AWS Service | Service Code |
|---|---|
| Amazon EC2 | ec2 |
| Amazon VPC | vpc |
| Elastic Load Balancing | elasticloadbalancing |
| Amazon RDS | rds |
| AWS Lambda | lambda |
| Amazon ECS | ecs |
| Amazon EKS | eks |
| Amazon S3 | s3 |
| Amazon DynamoDB | dynamodb |
| AWS Fargate | fargate |
| Amazon CloudWatch | monitoring |
| AWS CloudFormation | cloudformation |
| Amazon SQS | sqs |
| Amazon SNS | sns |
| Amazon ElastiCache | elasticache |
| Amazon OpenSearch Service | es |
| Auto Scaling | autoscaling |
If you do not know the service code, use:
aws service-quotas list-services \
--query "Services[?contains(ServiceName, '<keyword>')]" \
--region <region>
Step 2: Retrieve Quota Value and Utilization
Get the applied quota value
aws service-quotas get-service-quota \
--service-code <service-code> \
--quota-code <quota-code> \
--region <region>
The response includes:
Value— the current quota limit (applied value, or default if no increase was granted)Adjustable— whether the quota can be increasedUsageMetric— CloudWatch metric to check current utilization (if available)
If you do not know the quota code
List all quotas for the service:
aws service-quotas list-service-quotas \
--service-code <service-code> \
--region <region>
Filter by quota name keyword:
aws service-quotas list-service-quotas \
--service-code <service-code> \
--region <region> \
--query "Quotas[?contains(QuotaName, '<keyword>')]"
Get current utilization via CloudWatch
If the UsageMetric field is present in the quota response, query CloudWatch for actual usage:
aws cloudwatch get-metric-statistics \
--namespace "<MetricNamespace>" \
--metric-name "<MetricName>" \
--dimensions <MetricDimensions> \
--start-time "<15-minutes-ago-ISO8601>" \
--end-time "<now-ISO8601>" \
--period 300 \
--statistics <MetricStatisticRecommendation> \
--region <region>
The UsageMetric object from the quota response provides all the parameters:
MetricNamespace— typicallyAWS/UsageMetricName— typicallyResourceCountMetricDimensions— service-specific dimensions (e.g.,Class,Resource,Service,Type)MetricStatisticRecommendation— eitherMaximumorSum
Alternative: count resources directly
If no UsageMetric is available, count resources using the service's Describe/List APIs:
| Service | Command to count resources |
|---|---|
| EC2 instances | aws ec2 describe-instances --query "Reservations[].Instances[] | length(@)" |
| VPCs | aws ec2 describe-vpcs --query "Vpcs | length(@)" |
| NAT Gateways | aws ec2 describe-nat-gateways --filter Name=state,Values=available --query "NatGateways | length(@)" |
| EIPs | aws ec2 describe-addresses --query "Addresses | length(@)" |
| RDS instances | aws rds describe-db-instances --query "DBInstances | length(@)" |
| Lambda functions | aws lambda list-functions --query "Functions | length(@)" |
| ECS services | aws ecs list-services --cluster <cluster> --query "serviceArns | length(@)" |
| ALBs | `aws elbv2 describe-load-balancers --que |