-
Notifications
You must be signed in to change notification settings - Fork 47
spctl user guide
* 본 가이드는 CB-Spider의 CLI 도구 spctl를 이용한 멀티클라우드 제어에 대한 예시를 제공하고 있습니다.
* 본 가이드는 AWS VM 생성 및 제어 중심으로 가이드하고 있습니다.
* 그 외 CSP 및 자원에 대한 활용은 다음 User Guide 및 CLI 규격 문서 등을 참고하여 유사한 방법으로 적용 가능합니다.
-
-
CB-Spider CLI User Guide ············· (현재 문서)
-
- 연동 대상 CSP의 Credential 발급 가이드 참고하여 Credential 정보 준비
-
- 사용자 기능 및 활용 가이드 참고
-
- CB-Spider 설치 및 실행 가이드 참고하여 CB-Spider 서버 실행
-
- CLI 설치 가이드 참고하여 CLI 설치 및 확인 시험
이하 Terminal-2에서 실행
- CLI 활용 예시
-
Register Cloud Driver Info
./spctl driver register -d \ '{ "DriverName":"aws-driver01", "ProviderName":"AWS", "DriverLibFileName":"aws-driver-v1.0.so" }'
※ 등록된 이름
aws-driver01
을 이용한 재등록은 기존 정보를 업데이트 한다. -
List Cloud Driver Info
./spctl driver list
output
{ "driver": [ { "DriverLibFileName": "aws-driver-v1.0.so", "DriverName": "aws-driver01", "ProviderName": "AWS" }, { "DriverLibFileName": "azure-driver-v1.0.so", "DriverName": "azure-driver-v1.0", "ProviderName": "AZURE" }, { "DriverLibFileName": "gcp-driver-v1.0.so", "DriverName": "gcp-driver-v1.0", "ProviderName": "GCP" },
-
Get Cloud Driver Info
./spctl driver get --DriverName aws-driver01
output
{ "DriverLibFileName": "aws-driver-v1.0.so", "DriverName": "aws-driver01", "ProviderName": "AWS" }
-
Delete Cloud Driver Info
./spctl driver unregister --DriverName aws-driver01
output
{ "Result": "true" }
-
- CLI 활용 예시
-
Register Cloud Credential Info
./spctl credential register -d \ '{ "CredentialName": "aws-credential-01", "ProviderName": "AWS", "KeyValueInfoList": [ { "Key": "ClientId", "Value": "$ACCESS_KEY" }, { "Key": "ClientSecret", "Value": "$SECRET_KEY" } ] }'
※
$ACCESS_KEY
와$SECRET_KEY
는 본인 cloud의 credential 정보를 입력 -
List Cloud Credential Info
./spctl credential list
output
{ "credential": [ { "CredentialName": "aws-credential-01", "KeyValueInfoList": [ { "Key": "ClientId", "Value": "Hidden for security." }, { "Key": "ClientSecret", "Value": "Hidden for security." } ], "ProviderName": "AWS" }, ...
-
Get Cloud Credential Info
./spctl credential get --CredentialName aws-credential-01
output
{ "CredentialName": "aws-credential-01", "KeyValueInfoList": [ { "Key": "ClientId", "Value": "Hidden for security." }, { "Key": "ClientSecret", "Value": "Hidden for security." } ], "ProviderName": "AWS" }
-
Delete Cloud Credential Info
./spctl credential unregister --CredentialName aws-credential-01
output
{ "Result": "true" }
-
- CLI 활용 예시
-
Register Cloud Region/Zone Info
./spctl region register -d \ '{ "RegionName": "aws-us-east-2", "ProviderName": "AWS", "KeyValueInfoList": [ { "Key": "Region", "Value": "us-east-2" }, { "Key": "Zone", "Value": "us-east-2a" } ] }'
-
List Cloud Region/Zone Info
./spctl region list
output
{ "region": [ { "AvailableZoneList": null, "KeyValueInfoList": [ { "Key": "Region", "Value": "ap-northeast-2" }, { "Key": "Zone", "Value": "ap-northeast-2a" }, { "Key": "ZoneStatus", "Value": "Available" } ], "ProviderName": "AWS", "RegionName": "aws_ap-northeast-2_ap-northeast-2a" }, ...
-
Get Cloud Region/Zone Info
./spctl region get --RegionName aws-us-east-2
output
{ "AvailableZoneList": null, "KeyValueInfoList": [ { "Key": "Region", "Value": "us-east-2" }, { "Key": "Zone", "Value": "us-east-2a" } ], "ProviderName": "AWS", "RegionName": "aws-us-east-2" }
-
Delete Cloud Region/Zone Info
./spctl region unregister --RegionName aws-us-east-2
output
{ "Result": "true" }
-
- CLI 활용 예시
-
Create Cloud Connection Configuration Info
./spctl connection create -d \ '{ "ConfigName": "aws-us-east-2-connection-01", "ProviderName": "AWS", "DriverName": "aws-driver01", "CredentialName": "aws-credential-01", "RegionName": "aws-us-east-2" }'
-
List Cloud Connection Configuration Info
./spctl connection list
output
{ "connectionconfig": [ { "ConfigName": "aws-us-east-2-connection-01", "CredentialName": "aws-credential-01", "DriverName": "aws-driver01", "ProviderName": "AWS", "RegionName": "aws-us-east-2" }, ...
-
Get Cloud Connection Configuration Info
./spctl connection get --ConfigName aws-us-east-2-connection-01
output
{ "ConfigName": "aws-us-east-2-connection-01", "CredentialName": "aws-credential-01", "DriverName": "aws-driver01", "ProviderName": "AWS", "RegionName": "aws-us-east-2" }
-
Delete Cloud Connection Configuration Info
./spctl connection delete --ConfigName aws-us-east-2-connection-01
output
{ "Result": "true" }
-
- CLI 활용 예시
-
List Cloud VM Image Info
./spctl image list -c aws-us-east-2-connection-01
output
{ "image": [ { "GuestOS": "windows", "IId": { "NameId": "ami-0d2ede3190020808f", "SystemId": "ami-0d2ede3190020808f" }, "KeyValueList": [ { "Key": "CreationDate", "Value": "2024-02-14T08:45:45.000Z" }, { "Key": "Architecture", "Value": "x86_64" }, ...
-
- CLI 활용 예시
-
List Cloud VM Spec Info
./spctl vmspec list -c aws-us-east-2-connection-01
output
{ "vmspec": [ { "Mem": "262144", "Name": "m7i.16xlarge", "Region": "us-east-2", "VCpu": { "Clock": "3.2", "Count": "64" }, "KeyValueList": [ { "Key": "VCpuInfo", "Value": "map[DefaultCores:32 DefaultThreadsPerCore:2 DefaultVCpus:64 ValidCores:[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 0 21 22 23 24 25 26 27 28 29 30 31 32] ValidThreadsPerCore:[1 2]]" }, { "Key": "DedicatedHostsSupported", "Value": "true" }, ... ] }, ...
-
- CLI 활용 예시 (※ 참고: 자원별 생성시 필요한 json 입력 확인 방법)
-
Create Cloud VPC/Subnet Info
./spctl vpc create -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "vpc-1", "IPv4_CIDR": "192.168.0.0/16", "SubnetInfoList": [ { "Name": "subnet-1", "IPv4_CIDR": "192.168.1.0/24" } ] } }'
-
List Cloud VPC/Subnet Info
./spctl vpc list -c aws-us-east-2-connection-01
output
{ "vpc": [ { "IId": { "NameId": "vpc-1", "SystemId": "vpc-0046395337083e599" }, "IPv4_CIDR": "192.168.0.0/16", "SubnetInfoList": [ { "IId": { "NameId": "subnet-1", "SystemId": "subnet-01d6535b5c5e4f8e8" }, "IPv4_CIDR": "192.168.1.0/24", "KeyValueList": [ { "Key": "VpcId", "Value": "vpc-0046395337083e599" }, ... ], "TagList": [ { "Key": "Name", "Value": "subnet-1-crm230rp70itoiaonq0g" } ], "Zone": "us-east-2a" } ], "TagList": [ { "Key": "Name", "Value": "vpc-1-crm230rp70itoiaonq00" } ] } ] }
-
Get Cloud VPC/Subnet Info
./spctl vpc get -n vpc-1 -c aws-us-east-2-connection-01
output
{ "IId": { "NameId": "vpc-1", "SystemId": "vpc-01ef75ec235085cd8" }, "IPv4_CIDR": "192.168.0.0/16", "SubnetInfoList": [ { "IId": { "NameId": "subnet-1", "SystemId": "subnet-061d9826ad52d3fb8" }, "IPv4_CIDR": "192.168.1.0/24", "KeyValueList": [ { "Key": "VpcId", "Value": "vpc-01ef75ec235085cd8" }, ... ], "TagList": [ { "Key": "Name", "Value": "subnet-1-crm257rp70itoiaonq1g" } ], "Zone": "us-east-2a" } ], "TagList": [ { "Key": "Name", "Value": "vpc-1-crm257rp70itoiaonq10" } ] }
-
Delete Cloud VPC/Subnet Info
./spctl vpc delete -n vpc-1 -d '{ "ConnectionName": "aws-us-east-2-connection-01" }'
output
{ "Result": "true" }
-
참고사항
- CSP별로 Region 당 생성할 수 있는 VPC 갯수의 제한이 존재
-
- CLI 활용 예시
-
Create Cloud SecurityGroup Info
./spctl securitygroup create -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "sg-01", "VPCName": "vpc-1", "SecurityRules": [ { "FromPort": "1", "ToPort": "65535", "IPProtocol": "tcp", "Direction": "inbound", "CIDR": "0.0.0.0/0" } ] } }'
-
List Cloud SecurityGroup Info
./spctl securitygroup list -c aws-us-east-2-connection-01
output
{ "securitygroup": [ { "IId": { "NameId": "sg-01", "SystemId": "sg-04cfb8cd2e946378d" }, "KeyValueList": [ { "Key": "GroupName", "Value": "sg01-crm27arp70itoiaonq20" }, { "Key": "VpcID", "Value": "vpc-01ef75ec235085cd8" }, { "Key": "OwnerID", "Value": "635484366616" }, { "Key": "Description", "Value": "sg01-crm27arp70itoiaonq20" } ], "SecurityRules": [ { "CIDR": "0.0.0.0/0", "Direction": "inbound", "FromPort": "1", "IPProtocol": "TCP", "ToPort": "65535" }, { "CIDR": "0.0.0.0/0", ...
-
Get Cloud SecurityGroup Info
./spctl securitygroup get -n sg-01 -c aws-us-east-2-connection-01
output
{ "IId": { "NameId": "sg-01", "SystemId": "sg-0e4afa53da260cef2" }, "KeyValueList": [ { "Key": "GroupName", "Value": "sg01-crm28qbp70itoiaonq2g" }, ... ], "SecurityRules": [ { "CIDR": "0.0.0.0/0", "Direction": "inbound", "FromPort": "1", "IPProtocol": "TCP", "ToPort": "65535" }, { "CIDR": "0.0.0.0/0", "Direction": "outbound", "FromPort": "-1", "IPProtocol": "ALL", "ToPort": "-1" } ], "TagList": [ { "Key": "Name", "Value": "sg01-crm28qbp70itoiaonq2g" } ], "VpcIID": { "NameId": "vpc-1", "SystemId": "vpc-01ef75ec235085cd8" } }
-
Delete Cloud SecurityGroup Info
./spctl securitygroup delete -n sg-01 -d '{ "ConnectionName": "aws-us-east-2-connection-01" }'
output
{ "Result": "true" }
-
- CLI 활용 예시
-
Create Cloud VM KeyPair Info
./spctl keypair create -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "keypair-1" } }'
-
List Cloud VM KeyPair Info
./spctl keypair list -c aws-us-east-2-connection-01
output
{ "keypair": [ { "Fingerprint": "f1:97:a7:fe:a8:40:32:98:33:1d:2d:8f:3b:cc:e3:79:96:3b:ee:c9", "IId": { "NameId": "keypair-1", "SystemId": "keypair-1-crm2f6bp70itoiaonq3g" }, "PrivateKey": "Hidden for security.", "PublicKey": "Hidden for security.", "TagList": [ { "Key": "Name", "Value": "keypair-1-crm2f6bp70itoiaonq3g" } ] } ] }
-
Get Cloud VM KeyPair Info
./spctl keypair get -n keypair-1 -c aws-us-east-2-connection-01
output
{ "Fingerprint": "f1:97:a7:fe:a8:40:32:98:33:1d:2d:8f:3b:cc:e3:79:96:3b:ee:c9", "IId": { "NameId": "keypair-1", "SystemId": "keypair-1-crm2f6bp70itoiaonq3g" }, "PrivateKey": "Hidden for security.", "PublicKey": "Hidden for security.", "TagList": [ { "Key": "Name", "Value": "keypair-1-crm2f6bp70itoiaonq3g" } ] }
-
Delete VM KeyPair Info
./spctl keypair delete -n keypair-1 -d '{ "ConnectionName": "aws-us-east-2-connection-01" }'
output
{ "Result": "true" }
-
- CLI 활용 예시
-
Create VM
Rook Disk Type 및 Size 설정 예시(설정 가이드 참고)
./spctl vm start -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "vm-1", "ImageName": "ami-0bbe28eb2173f6167", "VPCName": "vpc-1", "SubnetName": "subnet-1", "SecurityGroupNames": [ "sg-01" ], "VMSpecName": "t2.micro", "KeyPairName": "keypair-1" } }'
./spctl vm start -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "vm-1", "ImageName": "ami-0bbe28eb2173f6167", "VPCName": "vpc-1", "SubnetName": "subnet-1", "SecurityGroupNames": [ "sg-01" ], "VMSpecName": "t2.micro", "KeyPairName": "keypair-1", "RootDiskType": "gp3", "RootDiskSize": "24" } }'
-
Create VM
- CLI 활용 예시
-
List VM Info(All VM List)
./spctl vm list -c aws-us-east-2-connection-01
output
{ "vm": [ { "AccessPoint": "", "IId": { "NameId": "vm-1", "SystemId": "i-0f3fb48149865e5e8" }, "ImageIId": { "NameId": "ami-0bbe28eb2173f6167", "SystemId": "ami-0bbe28eb2173f6167" }, "ImageType": "PublicImage", "KeyPairIId": { "NameId": "keypair-1", "SystemId": "keypair-1-crm2k9rp70itoiaonq40" }, "KeyValueList": [ { "Key": "State", "Value": "running" }, ... ], "NetworkInterface": "eni-attach-0883a840e2f3878a0", "Platform": "LINUX/UNIX", "PrivateDNS": "ip-192-168-1-54.us-east-2.compute.internal", "PrivateIP": "192.168.1.54", "PublicIP": "18.227.52.207", "Region": { "Region": "us-east-2", "Zone": "us-east-2a" }, "RootDeviceName": "/dev/sda1", "RootDiskSize": "24", "RootDiskType": "gp3", "SSHAccessPoint": "18.227.52.207:22", "SecurityGroupIIds": [ { "NameId": "sg-01", "SystemId": "sg-0e4afa53da260cef2" } ], "StartTime": "2024-09-19T14:01:36Z", "SubnetIID": { "NameId": "subnet-1", "SystemId": "subnet-061d9826ad52d3fb8" }, "TagList": [ { "Key": "Name", "Value": "vm-1-crm2tfjp70itoiaonq50" } ], "VMBlockDisk": "/dev/sda1", "VMSpecName": "t2.micro", "VMUserId": "cb-user", "VpcIID": { "NameId": "vpc-1", "SystemId": "vpc-01ef75ec235085cd8" } } ] }
-
Get VM Info(Specific VM)
./spctl vm get -n vm-1 -c aws-us-east-2-connection-01
output
{ "AccessPoint": "", "IId": { "NameId": "vm-1", "SystemId": "i-0f3fb48149865e5e8" }, "ImageIId": { "NameId": "ami-0bbe28eb2173f6167", "SystemId": "ami-0bbe28eb2173f6167" }, "ImageType": "PublicImage", "KeyPairIId": { "NameId": "keypair-1", "SystemId": "keypair-1-crm2k9rp70itoiaonq40" }, "KeyValueList": [ { "Key": "State", "Value": "running" }, ... ], "NetworkInterface": "eni-attach-0883a840e2f3878a0", "Platform": "LINUX/UNIX", "PrivateDNS": "ip-192-168-1-54.us-east-2.compute.internal", "PrivateIP": "192.168.1.54", "PublicIP": "18.227.52.207", "Region": { "Region": "us-east-2", "Zone": "us-east-2a" }, "RootDeviceName": "/dev/sda1", "RootDiskSize": "24", "RootDiskType": "gp3", "SSHAccessPoint": "18.227.52.207:22", "SecurityGroupIIds": [ { "NameId": "sg-01", "SystemId": "sg-0e4afa53da260cef2" } ], "StartTime": "2024-09-19T14:01:36Z", "SubnetIID": { "NameId": "subnet-1", "SystemId": "subnet-061d9826ad52d3fb8" }, "TagList": [ { "Key": "Name", "Value": "vm-1-crm2tfjp70itoiaonq50" } ], "VMBlockDisk": "/dev/sda1", "VMSpecName": "t2.micro", "VMUserId": "cb-user", "VpcIID": { "NameId": "vpc-1", "SystemId": "vpc-01ef75ec235085cd8" } }
-
- CLI 활용 예시
-
List VM Status Info(All VM Status)
./spctl vm-status list -c aws-us-east-2-connection-01
output
{ "vmstatus": [ { "IId": { "NameId": "vm-1", "SystemId": "i-0f3fb48149865e5e8" }, "VmStatus": "Running" } ] }
-
Get VM Status Info(Specific VM Status)
./spctl vm-status get -n vm-1 -c aws-us-east-2-connection-01
output
{ "Status": "Running" }
-
- CLI 활용 예시
-
Terminate VM
./spctl vm terminate -n vm-1 -d '{ "ConnectionName": "aws-us-east-2-connection-01" }'
output
{ "Status": "Terminated" }
-
-
Install & Start Guide
-
Features & Usage
-
- AdminWeb Tool Guide
- CLI Tool Guide
- REST API Guide
-
Design
-
Developer Guide
-
Cloud Driver Developer Guide
- Cloud Driver Developer Guide-WIP
- VM SSH Key Development Guide-WIP
- VM User Development Guide
- What is the CSP SDK API Version of drivers
- Region Zone Info and Driver API
- Price Info and Driver API
- (StartVM TerminateVM) API Call Counts and Waiting
- StartVM and TerminateVM Main Flow of drivers
- VM Root Disk Configuration Guide
- Security Group Rules and Driver API
- Network Load Balancer and Driver API
- VM Snapshot, MyImage and Disk Overview
- Kubernetes and Driver API(PMKS, K8S)
- Tag and Cloud Driver API
- AnyCall API Extension Guide
-
Test Reports
- v0.2.8-for-espresso-release
- v0.3.0-espresso-release
- Azure:Terminating VM
- cb-user@VM: ssh login, sudo run
- v0.3.14 test for SG Source
- v0.4.0-cafemocha-release
- Test via REST API Gateway
- Test Reports of v0.4.11 (IID2 initial Version)
- Test Reports of v0.4.12 (Register & Unregister existing Resources)
- Test Reports for v0.6.0 Release
- How to ...
- How to provision GPU VMs
- How to Resolve the 'Failed to Connect to Database' Error
- How to test CB Spider with Mock Driver
- How to install CB Spider on WSL2 under 공유기/사설망
- How to install CB Spider on macOS
- How to run CB Spider Container on macOS
- How to install OpenStack on a VM for CB Spider Testing
- How to get Azure available Regions
- How to profile memory usage in Golang
- Deprecated:How to install protoc and plugins
- [For Cloud-Migrator]