Connection Management Guide - cloud-barista/cb-spider GitHub Wiki
Connection Management Guide
1. CB-Spider Connection Registration Overview
- To control multi-cloud infrastructure, you must first register the connection configuration for the target cloud (CSP).
- Once registered, you can use the Connection Name assigned during registration to connect to and control the target cloud.
- Connection registration follows these four steps:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CB-Spider Connection Registration β
β β
β (1) Register Cloud Driver β
β βββ CSP driver plugin (e.g. aws-driver-v1.0.so) β
β β
β (2) Register Cloud Credential β
β βββ CSP access keys (e.g. AccessKey, SecretKey) β
β β
β (3) Register Cloud Region/Zone β
β βββ Target region & zone (e.g. us-east-2, us-east-2a) β
β β
β (4) Register Cloud Connection β
β βββ Combine Driver + Credential + Region β
β β produces a ConnectionName for all API calls β
β β
β βββββββββββββ βββββββββββββββ ββββββββββββββ β
β β Driver β β Credential β βRegion/Zone β β
β ββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬ββββββ β
β ββββββββββββββββββΌβββββββββββββββββ β
β βΌ β
β βββββββββββββββββββββββ β
β β Connection Config β β
β β (ConnectionName) β β
β βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Note
- Steps (1), (2), and (3) can be registered in any order.
- Step (4) requires all three previous registrations to be completed first.
- For credentials, see How to get CSP Credentials.
- For automated bulk registration, see the Default Connection Helper tool.
2. Prerequisites
- CB-Spider server must be running.
curlandjq(orjson_pp) installed for API verification.- CSP credentials ready (e.g., AWS Access Key, GCP Service Account Key).
3. CB-Spider Connection API Specification
- Users can register and manage connection configurations via the CB-Spider REST API.
3.1 Connection API Endpoints
# Cloud Driver
POST /spider/driver - Register Cloud Driver
GET /spider/driver - List Cloud Drivers
GET /spider/driver/{DriverName} - Get Cloud Driver
DELETE /spider/driver/{DriverName} - Delete Cloud Driver
# Cloud Credential
POST /spider/credential - Register Cloud Credential
GET /spider/credential - List Cloud Credentials
GET /spider/credential/{CredentialName} - Get Cloud Credential
DELETE /spider/credential/{CredentialName} - Delete Cloud Credential
# Cloud Region/Zone
POST /spider/region - Register Cloud Region/Zone
GET /spider/region - List Cloud Regions
GET /spider/region/{RegionName} - Get Cloud Region
DELETE /spider/region/{RegionName} - Delete Cloud Region
# Cloud Connection Config
POST /spider/connectionconfig - Register Cloud Connection
GET /spider/connectionconfig - List Cloud Connections
GET /spider/connectionconfig/{ConfigName} - Get Cloud Connection
DELETE /spider/connectionconfig/{ConfigName} - Delete Cloud Connection
3.2 Request Parameters
Register Cloud Driver
| Parameter | Description | Example |
|---|---|---|
| DriverName | Name of the driver | aws-driver01 |
| ProviderName | Cloud provider name | AWS, GCP, AZURE, ALIBABA |
| DriverLibFileName | Driver library file name | aws-driver-v1.0.so |
Register Cloud Credential
| Parameter | Description | Example |
|---|---|---|
| CredentialName | Name of the credential | aws-credential01 |
| ProviderName | Cloud provider name | AWS |
| KeyValueInfoList | Key-value pairs of credential info | See examples below |
Register Cloud Region/Zone
| Parameter | Description | Example |
|---|---|---|
| RegionName | Name of the region | aws-ohio |
| ProviderName | Cloud provider name | AWS |
| KeyValueInfoList | Key-value pairs of region/zone info | Region: us-east-2, Zone: us-east-2a |
Register Cloud Connection
| Parameter | Description | Example |
|---|---|---|
| ConfigName | Name of the connection config | aws-ohio-config |
| ProviderName | Cloud provider name | AWS |
| DriverName | Registered driver name | aws-driver01 |
| CredentialName | Registered credential name | aws-credential01 |
| RegionName | Registered region name | aws-ohio |
4. CB-Spider Connection API Examples
The following examples demonstrate registering an AWS connection with two regions (Ohio, Oregon).
4.1 Register Cloud Driver
curl -sX POST http://localhost:1024/spider/driver \
-H 'Content-Type: application/json' \
-d '{
"DriverName": "aws-driver01",
"ProviderName": "AWS",
"DriverLibFileName": "aws-driver-v1.0.so"
}' | json_pp
Response example:
{
"DriverLibFileName" : "aws-driver-v1.0.so",
"DriverName" : "aws-driver01",
"ProviderName" : "AWS"
}
4.2 Register Cloud Credential
Replace
XXXXXXXXXXXXXXXXXXXXXXXwith your actual CSP credentials.
curl -sX POST http://localhost:1024/spider/credential \
-H 'Content-Type: application/json' \
-d '{
"CredentialName": "aws-credential01",
"ProviderName": "AWS",
"KeyValueInfoList": [
{"Key": "aws_access_key_id", "Value": "XXXXXXXXXXXXXXXXXXXXXXX"},
{"Key": "aws_secret_access_key", "Value": "XXXXXXXXXXXXXXXXXXXXXXX"}
]
}' | json_pp
Response example:
{
"CredentialName" : "aws-credential01",
"KeyValueInfoList" : [
{
"Key" : "ClientId",
"Value" : "XXXXXXXXXXXXXXXXXXXXXXX"
},
{
"Key" : "ClientSecret",
"Value" : "XXXXXXXXXXXXXXXXXXXXXXX"
}
],
"ProviderName" : "AWS"
}
4.3 Register Cloud Region/Zone
Tip: To find the Region name (value) to register, use the pre-config API in the Region/Zone Info Guide. e.g.,
GET /spider/preconfig/regionzone?DriverName=aws-driver01&CredentialName=aws-credential01
Register multiple regions/zones at once (e.g., AWS Ohio and Oregon):
regions=("aws-ohio:us-east-2:us-east-2a"
"aws-oregon:us-west-2:us-west-2a")
for region in "${regions[@]}"; do
IFS=":" read -r RegionName Region Zone <<< "$region"
curl -sX POST http://localhost:1024/spider/region \
-H 'Content-Type: application/json' \
-d '{
"RegionName": "'$RegionName'",
"ProviderName": "AWS",
"KeyValueInfoList": [
{"Key": "Region", "Value": "'$Region'"},
{"Key": "Zone", "Value": "'$Zone'"}
]
}' | json_pp
done
Response example:
{
"AvailableZoneList" : null,
"KeyValueInfoList" : [
{
"Key" : "Region",
"Value" : "us-east-2"
},
{
"Key" : "Zone",
"Value" : "us-east-2a"
}
],
"ProviderName" : "AWS",
"RegionName" : "aws-ohio"
}
4.4 Register Cloud Connection
Combine the registered driver, credential, and region into connection configs:
configs=("aws-ohio-config:aws-ohio"
"aws-oregon-config:aws-oregon")
for config in "${configs[@]}"; do
IFS=":" read -r ConfigName RegionName <<< "$config"
curl -sX POST http://localhost:1024/spider/connectionconfig \
-H 'Content-Type: application/json' \
-d '{
"ConfigName": "'$ConfigName'",
"ProviderName": "AWS",
"DriverName": "aws-driver01",
"CredentialName": "aws-credential01",
"RegionName": "'$RegionName'"
}' | json_pp
done
Response example:
{
"ConfigName" : "aws-ohio-config",
"CredentialName" : "aws-credential01",
"DriverName" : "aws-driver01",
"ProviderName" : "AWS",
"RegionName" : "aws-ohio"
}
{
"ConfigName" : "aws-oregon-config",
"CredentialName" : "aws-credential01",
"DriverName" : "aws-driver01",
"ProviderName" : "AWS",
"RegionName" : "aws-oregon"
}
5. Credential Key Names per CSP
You can look up the required credential key names for each CSP:
# Example: Check AWS credential key names
curl -sX GET http://localhost:1024/spider/cloudos/metainfo/AWS \
-H 'Content-Type: application/json' | json_pp
| CSP | Type | Key Names |
|---|---|---|
| AWS | Spider Type | ClientId, ClientSecret |
| AWS | CSP Type | aws_access_key_id, aws_secret_access_key |
| GCP | Spider Type | ClientEmail, ProjectID, PrivateKey |
| Azure | Spider Type | ClientId, ClientSecret, TenantId, SubscriptionId |
| Alibaba | Spider Type | ClientId, ClientSecret |
Note
- Both Spider Type and CSP Type credential keys are supported.
- For complete key names for all CSPs, use the MetaInfo API:
GET /spider/cloudos/metainfo/{CSPName}- For how to obtain credentials from each CSP, see How to get CSP Credentials.
6. Verify Registered Connections
After registration, verify the connections:
# List all registered connections
curl -sX GET http://localhost:1024/spider/connectionconfig | json_pp
# Get a specific connection
curl -sX GET http://localhost:1024/spider/connectionconfig/aws-ohio-config | json_pp
7. API Response Codes
| HTTP Status | Description |
|---|---|
| 200 OK | Request successful |
| 400 Bad Request | Invalid request (missing required parameter, etc.) |
| 404 Not Found | Target resource not found |
| 500 Internal Server Error | Internal server error |