Skip to content

CLI Tool Install Guide

ByoungSeob Kim edited this page Feb 23, 2026 · 22 revisions

CB-Spider CLI spctl Install Guide


* 본 가이드는 CB-Spider CLI 도구 spctl의 설치 방법을 제공합니다.
* 본 가이드는 Ubuntu 24.04 중심으로 시험 되었습니다.

1. 서버 가동

인증 설정: 서버 가동 전 setup.env에서 SPIDER_USERNAMESPIDER_PASSWORD를 반드시 설정해야 합니다.
미설정 시 서버가 시작되지 않습니다. 운영 환경에서는 기본 비밀번호를 반드시 변경하세요.

2. CLI 빌드

cd $CBSPIDER_ROOT/cli; make;

3. CLI 실행

cd $CBSPIDER_ROOT/cli; ./spctl;

4. 인증 설정

CLI에서 API를 호출하려면 인증 정보가 필요합니다. 두 가지 방법으로 제공할 수 있습니다.

  • 방법 1: 환경변수 설정 (권장)

    export SPIDER_USERNAME=admin
    export SPIDER_PASSWORD=your-password
  • 방법 2: 명령어 플래그 사용

    ./spctl -u admin -p your-password connection list

    플래그(-u, -p)가 환경변수보다 우선합니다.

5. CLI 활용

  • spctl 설치 위치로 이동
    cd $CBSPIDER_ROOT/cli;
    
  • version 확인(-v, --version)
    ./spctl -v
    
    Version:    v0.12.5-29
    Commit SHA: cc8e6709
    Build Time: Sun Feb 15 22:25:02 KST 2026
    
  • help 출력(-h, --help 또는 무옵션 가능)
    ./spctl
    
  • 서브명령어 help 출력
    ./spctl vpc -h
    
  • 서버점검
    ./spctl check-readyz health
    
    {
      "message": "CB-Spider is ready"
    }
    
  • 연동 가능한 CSP 목록 출력
    ./spctl -u admin -p your-password cloudos list
    
    {
      "cloudos": [
        "AWS",
        "AZURE",
        "GCP",
        "ALIBABA",
        "TENCENT",
        "IBM",
        "OPENSTACK",
        "NCP",
        "NHN",
        "KT",
        "KTCLASSIC",
        "MOCK"
      ]
    }
    
  • 등록한 클라우드 연결 설정 목록 출력
    ./spctl -u admin -p your-password connection list
    
    {
      "connectionconfig": [
        {
          "ConfigName": "aws-ap-northeast-2_ap-northeast-2a-credential-gyd",
          "CredentialName": "aws-credential-gyd",
          "DriverName": "aws-driver-v1.0",
          "ProviderName": "AWS",
          "RegionName": "aws_ap-northeast-2_ap-northeast-2a"
        },
        {
          "ConfigName": "gcp-asia-south2_asia-south2-a-credential-dbt",
          "CredentialName": "gcp-credential-dbt",
          "DriverName": "gcp-driver-v1.0",
          "ProviderName": "GCP",
          "RegionName": "gcp_asia-south2_asia-south2-a"
        },
        ...
    

※ 참고: 자원별 생성시 필요한 json 입력 확인 방법

  • 예시: VPC 생성
./spctl vpc create
Usage:
  spctl vpc create [flags]

Flags:
  -d, --data string   JSON Body/Form parameter: VPCCreateRequest
  -h, --help          help for create

Global Flags:
  -p, --password string   API password (default: $SPIDER_PASSWORD)
  -s, --server string     Spider server URL (default "localhost:1024")
  -u, --username string   API username (default: $SPIDER_USERNAME)

Examples:
    Example JSON for VPCCreateRequest with all fields:
    '{
        "ConnectionName": "aws-connection",
        "IDTransformMode": "ON",
        "ReqInfo": {
          "IPv4_CIDR": "10.0.0.0/16",
          "Name": "vpc-01",
          "SubnetInfoList": [
            {
              "IPv4_CIDR": "10.0.8.0/22",
              "Name": "subnet-01",
              "TagList": [
                {
                  "Key": "key1",
                  "Value": "value1"
                }
              ],
              "Zone": "us-east-1b"
            }
          ],
          "TagList": [
            {
              "Key": "key1",
              "Value": "value1"
            }
          ]
        }
      }'

    Example JSON for VPCCreateRequest with required fields only:
    '{
        "ConnectionName": "aws-connection",
        "ReqInfo": {
          "IPv4_CIDR": "10.0.0.0/16",
          "Name": "vpc-01",
          "SubnetInfoList": [
            {
              "IPv4_CIDR": "10.0.8.0/22",
              "Name": "subnet-01"
            }
          ]
        }
      }'
  • VPC 생성 명령에 활용
$ spctl -u admin -p your-password vpc create -d '{
        "ConnectionName": "aws-connection",
        "ReqInfo": {
          "IPv4_CIDR": "10.0.0.0/16",
          "Name": "vpc-01",
          "SubnetInfoList": [
            {
              "IPv4_CIDR": "10.0.8.0/22",
              "Name": "subnet-01"
            }
          ]
        }
      }'

Table of contents



Clone this wiki locally