Terminal
Terminal/Skill
Checks whether an AWS service limit is causing throttling or failures, and requests a quota increase when needed.
By Amazon Web Services
Works with
npx skills add aws/tools-for-devops-agent --skill service-quota-checkUse 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.
ThrottlingException,
TooManyRequestsException, LimitExceededException, ResourceLimitExceeded).servicequotas:ListServicesservicequotas:ListServiceQuotasservicequotas:GetServiceQuotaservicequotas:RequestServiceQuotaIncreaseservicequotas:ListRequestedServiceQuotaChangeHistoryservicequotas:CreateSupportCasecloudwatch:GetMetricDatacloudwatch:GetMetricStatisticsDetermine which service and quota to check based on the investigation context:
| 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>
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)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>')]"
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 — typically AWS/UsageMetricName — typically ResourceCountMetricDimensions — service-specific dimensions (e.g., Class, Resource, Service, Type)MetricStatisticRecommendation — either Maximum or SumIf 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 --query "LoadBalancers | length(@)" |
utilization_pct = (current_usage / quota_value) × 100
| Utilization | Risk Level | Action |
|---|---|---|
| < 70% | Low | No action needed. Report current state. |
| 70% – 84% | Medium | Flag as approaching limit. Monitor closely. |
| 85% – 94% | High | Recommend quota increase. Proceed to Step 4. |
| 95% – 100% | Critical | Urgent quota increase required. Proceed to Step 4. |
| = 100% | Exhausted | Quota is blocking operations. Immediate action required. |
Always show the user a summary table:
┌─────────────────────────────────────────────────────────────────────┐
│ Service Quota Check │
├─────────────────────────┬───────────┬─────────┬─────────┬───────────┤
│ Quota Name │ Limit │ Used │ % Used │ Status │
├─────────────────────────┼───────────┼─────────┼─────────┼───────────┤
│ Running On-Demand (std) │ 1920 vCPU │ 1740 │ 90.6% │ ⚠️ HIGH │
│ VPCs per Region │ 5 │ 5 │ 100% │ 🚫 FULL │
│ NAT Gateways per AZ │ 5 │ 3 │ 60% │ ✅ OK │
└─────────────────────────┴───────────┴─────────┴─────────┴───────────┘
When utilization is at 85% or higher, proceed based on whether the quota is adjustable.
Is utilization >= 85%?
├── NO → Report findings, no action needed
└── YES → Check "Adjustable" field
├── Adjustable = true → Proceed to quota increase request
│ ├── Ask user to confirm the increase
│ ├── User confirms → Submit request via API (Step 4a)
│ └── User declines → Report findings only
└── Adjustable = false → Recommend support case (Step 4b)
Before requesting, determine the desired new value. Use this formula:
desired_value = current_quota × 1.5 (50% increase over current limit)
If the quota is already exhausted (100% utilization), recommend:
desired_value = current_quota × 2.0 (double the current limit)
Present the recommendation to the user:
"The quota [QuotaName] is at [X]% utilization ([current_usage]/[quota_value]). I recommend increasing it to [desired_value]. Shall I submit the quota increase request?"
If the user confirms, submit the request:
aws service-quotas request-service-quota-increase \
--service-code <service-code> \
--quota-code <quota-code> \
--desired-value <desired-value> \
--region <region>
After submitting, check the response:
Status: PENDING — request submitted successfully. Inform the user that AWS will
review the request (typically processed within minutes for auto-approved quotas,
or up to a few days for manual review).Status: CASE_OPENED — a support case was automatically created.Report the request ID and status:
"Quota increase request submitted successfully.
- Request ID: [Id]
- Status: [Status]
- Desired value: [DesiredValue]
You can check the status with:
aws service-quotas get-requested-service-quota-change --request-id <Id>"
If the quota cannot be increased via the API (Adjustable: false), inform the user:
"The quota [QuotaName] cannot be increased programmatically via the Service Quotas API. To request an increase, you need to open an AWS Support case.
Would you like me to:
- Open a support case via the Service Quotas API (requires an existing pending quota increase request)
- Provide instructions to open a support case manually via the AWS Console"
If there is an existing pending request, use:
aws service-quotas create-support-case \
--request-id <request-id> \
--region <region>
Otherwise, provide manual instructions:
"To request this quota increase:
- Go to the AWS Support Center: https://console.aws.amazon.com/support/
- Create a new case → Service limit increase
- Select service: [ServiceName]
- Select quota: [QuotaName]
- Specify the new desired value: [desired_value]
- Provide business justification for the increase"
Before submitting a new request, check if there is already a pending increase request:
aws service-quotas list-requested-service-quota-change-history-by-quota \
--service-code <service-code> \
--quota-code <quota-code> \
--region <region> \
--query "RequestedQuotas[?Status=='PENDING']"
If a pending request exists:
After a quota increase is approved, verify the new limit:
aws service-quotas get-service-quota \
--service-code <service-code> \
--quota-code <quota-code> \
--region <region>
Confirm the Value field reflects the new limit.
When a recommendation involves provisioning multiple resource types, or for proactive capacity planning, check all relevant quotas for the service:
aws service-quotas list-service-quotas \
--service-code <service-code> \
--region <region>
For each quota that has a UsageMetric, calculate utilization. Report any quotas
at 70%+ utilization as part of a comprehensive capacity report.
See references/common-quota-codes.md for a table of frequently checked quota codes by service.
| Error | Cause | Resolution |
|---|---|---|
NoSuchResourceException | Quota code does not exist for the service | Use list-service-quotas to find the correct code |
TooManyRequestsException | Service Quotas API is throttling | Wait and retry with exponential backoff |
ResourceAlreadyExistsException | A pending request already exists | Check existing requests (Step 5) |
QuotaExceededException | The desired value exceeds the maximum allowed | Reduce the desired value or open a support case |
AccessDeniedException | Missing IAM permissions | Check that the agent has servicequotas:* permissions |
DependencyAccessDeniedException | Missing permissions on the target service | Verify IAM policies for the target service |
GlobalQuota: true).get-service-quota returns the applied value (which may differ
from the default if a previous increase was granted). Use get-aws-default-service-quota
to see the original default.--context-id with the resource ARN for these.