Quota Info Guide - cloud-barista/cb-spider GitHub Wiki
Quota Info Guide
1. CB-Spider Quota Info Overview
- Users can retrieve quota information (limit, usage, available) per service type provided by each CSP.
- Quota retrieval is a two-step process:
- Call
ListQuotaServiceTypeto get the list of available service types. - Call
GetQuotaInfowith a specific service type to retrieve detailed quota information.
- Call
- CB-Spider passes through the CSP's original quota items as-is. Values not exposed by the CSP are returned as
NA. - Supported CSPs: AWS, Azure, GCP, Alibaba
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CB-Spider Quota Info โ
โ โ
โ ConnectionName (CSP + Region) โ
โ โ โ
โ โโโ ListQuotaServiceType() โ
โ โ โโโ ServiceType list โ
โ โ e.g. ec2, eks, Compute โ
โ โ compute.googleapis.com, ecs โ
โ โ โ
โ โโโ GetQuotaInfo(ServiceType) โ
โ โโโ Quotas โ
โ โโโ QuotaName โ
โ โโโ Limit โ
โ โโโ Used โ
โ โโโ Available โ
โ โโโ Unit โ
โ โโโ Description โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2. Prerequisites
2.1 Common
- The target CSP Connection must be registered and working correctly.
2.2 GCP
- The Cloud Quotas API must be enabled in the GCP Project.
- How to enable:
- GCP Console: https://console.cloud.google.com/apis/library/cloudquotas.googleapis.com?project=spider
- gcloud CLI:
gcloud services enable cloudquotas.googleapis.com --project=123456789012
3. CB-Spider Quota API Specification
- Users can retrieve quota information in JSON format via the CB-Spider REST API.
3.1 Quota API Endpoints
# List available service types for quota
GET /spider/quotaservicetype - List Quota Service Types
# Get quota details for a specific service type
GET /spider/quotainfo - Get Quota Info
3.2 Request Parameters
ListQuotaServiceType
| Parameter | Description | Example |
|---|---|---|
| ConnectionName | Name of the target Connection to query quota information | aws-seoul-config, gcp-seoul-config |
GetQuotaInfo
| Parameter | Description | Example |
|---|---|---|
| ConnectionName | Name of the target Connection to query quota information | aws-seoul-config |
| ServiceType | Service type name obtained from ListQuotaServiceType |
ec2, compute.googleapis.com, ecs |
3.3 Response Schema
Quota Information (QuotaInfo)
| Field | Description | Example |
|---|---|---|
| CSP | Cloud provider name | AWS, AZURE, GCP, ALIBABA |
| Region | Region/location the quotas apply to | ap-northeast-2, koreacentral, asia-northeast3, cn-beijing |
| Quotas | List of quota details under the service type | See Quota below |
Quota Detail (Quota)
| Field | Description | Example |
|---|---|---|
| QuotaName | Quota item name | Running On-Demand Standard (A, C, D, H, I, M, R, T, Z) instances, CPUs |
| Limit | Maximum allowed value | 500, 24, 801 |
| Used | Currently consumed amount | 12, 8, 26 |
| Available | Remaining capacity (Limit - Used) |
488, 16, 775 |
| Unit | Unit of measurement | count, vCPU, Count, NA |
| Description | Additional quota information | AWS QuotaArn, etc. |
Note
- If the CSP does not expose
Used,Available,Unit, etc., those values are returned asNA.- Quota item names and descriptions are passed through from the CSP as-is.
4. CB-Spider Quota API Examples
4.1 List Service Types
curl -u "$SPIDER_USERNAME:$SPIDER_PASSWORD" -sX 'GET' 'http://localhost:1024/spider/quotaservicetype?ConnectionName=aws-seoul-config' | jq
Response example:
{
"ServiceTypes": [
"ec2",
"vpc",
"ebs",
...
]
}
4.2 Get Quota Info for a Service Type
curl -u "$SPIDER_USERNAME:$SPIDER_PASSWORD" -sX 'GET' 'http://localhost:1024/spider/quotainfo?ConnectionName=aws-seoul-config&ServiceType=ec2' | jq
Response example:
{
"CSP": "AWS",
"Region": "ap-northeast-2",
"Quotas": [
{
"QuotaName": "Attachments per transit gateway",
"Limit": "5000",
"Used": "NA",
"Available": "NA",
"Unit": "None",
"Description": "QuotaArn=arn:aws:servicequotas:ap-northeast-2:635484366616:ec2/L-E0233F82"
},
{
"QuotaName": "Running Dedicated z1d Hosts",
"Limit": "2",
"Used": "NA",
"Available": "NA",
"Unit": "None",
"Description": "QuotaArn=arn:aws:servicequotas:ap-northeast-2:635484366616:ec2/L-F035E935"
}
]
}
5. Test Results
- Test tool: test/quota-info-test/quota-info-test.sh
- Test scope: Service type listing and per-service-type Quota Info retrieval
5.1 AWS: Pass
============================================================
Test Result Summary
============================================================
Connection : aws-seoul-config
Service Types : 218
Success : 218
Failure : 0
============================================================
5.2 Azure: Pass
============================================================
Test Result Summary
============================================================
Connection : azure-koreacentral-config
Service Types : 14
Success : 14
Failure : 0
============================================================
5.3 GCP: Pass
============================================================
Test Result Summary
============================================================
Connection : gcp-seoul-config
Service Types : 46
Success : 46
Failure : 0
============================================================
5.4 Alibaba: Pass
- During testing, the following 4 service types returned errors because they are not supported in the current region.
- This is an expected exception (see Caveats section for details).
rosopenapiexplorersascloudsso
============================================================
Test Result Summary
============================================================
Connection : alibaba-beijing-config
Service Types : 66
Success : 62
Failure : 4
============================================================
6. Caveats and Constraints
6.1 Service Type Format Differs per CSP
- AWS:
ec2,vpc,ebs,eks, etc. - Azure:
Compute,ContainerService, etc. - GCP:
compute.googleapis.com,container.googleapis.com, etc. - Alibaba:
ecs,csk, etc.
6.2 Alibaba Region-Specific Service Availability
- The Alibaba service type list may include entries not supported in the current region.
- There is no single API to retrieve only the service types available in the current region.
- Filtering supported service types would require many individual
GetQuotaAPI calls.
- Therefore, a
GetQuotaInforequest for certain service types may return the following error:ErrorCode: QUOTA.DIMENSION.VALUE.UNSUPPORT
6.3 Alibaba China Account Returns Quota Info in Chinese
- When using an Alibaba China account, the
QuotaNameandDescriptionfields returned by the Quota API are provided in Chinese. - This is presumed to be a CSP policy that cannot be overridden via API language options.
{
"QuotaName": "ๅๆฌกๅฏ่ดญไนฐ็ๅ
ๅนดๅ
ๆๅฎไพ็ๆๅคงๆฐ้",
"Limit": "300",
"Used": "0",
"Available": "300",
"Unit": "NA",
"Description": "ๅๆฌกๅฏ่ดญไนฐ็ๅ
ๅนดๅ
ๆecs็ๆๅคงๆฐ้"
}
7. API Response Codes
| HTTP Status | Description |
|---|---|
| 200 OK | Request successful |
| 400 Bad Request | Invalid request (missing required parameter, invalid service type, etc.) |
| 404 Not Found | Target resource not found |
| 500 Internal Server Error | Internal server error or CSP API error |
8. References
CSP Console โ Where to Check Quotas