-
Notifications
You must be signed in to change notification settings - Fork 48
CLI Examples
* 본 가이드는 CB-Spider CLI 도구 spctl를 이용한 멀티클라우드 제어 장법을 제공한다.
* 본 가이드는 Ubuntu 18.04.5 LTS 또는 Ubuntu 20.04.2 LTS 중심으로 시험 되었다.
-
- 연동 대상 CSP의 Credential 발급 가이드 참고하여 Credential 정보 준비
-
- 사용자 기능 및 활용 가이드 참고
-
- CB-Spider 설치 및 실행 가이드 참고하여 CB-Spider 서버 실행
-
- CLI 설치 가이드 참고하여 CLI 설치 및 확인 시험
이하 Terminal-2에서 실행
- CLI 활용 예시
-
Register Cloud Driver Info
./spctl driver create -i json -d \ '{ "DriverName":"aws-driver01", "ProviderName":"AWS", "DriverLibFileName":"aws-driver-v1.0.so" }'
※ 등록된 이름
aws-driver01
을 이용한 재등록은 기존 정보를 업데이트 한다. -
List Cloud Driver Info
./spctl driver list
output
driver: - DriverName: alibaba-driver01 ProviderName: ALIBABA DriverLibFileName: alibaba-driver-v1.0.so - DriverName: aws-driver01 ProviderName: AWS DriverLibFileName: aws-driver-v1.0.so - DriverName: azure-driver01 ProviderName: AZURE DriverLibFileName: azure-driver-v1.0.so - DriverName: cloudit-driver01 ProviderName: CLOUDIT DriverLibFileName: cloudit-driver-v1.0.so - DriverName: gcp-driver01 ProviderName: GCP DriverLibFileName: gcp-driver-v1.0.so - DriverName: openstack-driver01 ProviderName: OPENSTACK DriverLibFileName: openstack-driver-v1.0.so - DriverName: mock-driver01 ProviderName: MOCK DriverLibFileName: mock-driver-v1.0.so
-
Get Cloud Driver Info
./spctl driver get -n azure-driver01
output
DriverName: azure-driver01 ProviderName: AZURE DriverLibFileName: azure-driver-v1.0.so
-
Delete Cloud Driver Info
./spctl driver delete -n azure-driver01
output
Result: true
-
- CLI 활용 예시
-
Register Cloud Credential Info
./spctl credential create -i json -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 ProviderName: AWS KeyValueInfoList: - Key: ClientId Value: "~~~" - Key: ClientSecret Value: "~~~" - CredentialName: aws-credential-02 ProviderName: AWS KeyValueInfoList: - Key: ClientID Value: "~~~" - Key: ClientSecret Value: "~~~" ...
-
Get Cloud Credential Info
./spctl credential get -n aws-credential-01
output
CredentialName: aws-credential-01 ProviderName: AWS KeyValueInfoList: - Key: ClientId Value: "~~~" - Key: ClientSecret Value: "~~~"
-
Delete Cloud Credential Info
./spctl credential delete -n aws-credential-01
output
Result: true
-
- CLI 활용 예시
-
Register Cloud Region/Zone Info
./spctl region create -i json -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: - RegionName: aws-us-east-2 ProviderName: AWS KeyValueInfoList: - Key: Region Value: us-east-2 - Key: Zone Value: us-east-2a - RegionName: aws-us-west-2 ProviderName: AWS KeyValueInfoList: - Key: Region Value: us-west-2 - Key: Zone Value: us-west-2a ...
-
Get Cloud Region/Zone Info
./spctl region get -n aws-us-east-2
output
RegionName: aws-us-east-2 ProviderName: AWS KeyValueInfoList: - Key: Region Value: us-east-2 - Key: Zone Value: us-east-2a
-
Delete Cloud Region/Zone Info
./spctl region delete -n aws-us-east-2
output
Result: true
-
- CLI 활용 예시
-
Register Cloud Connection Configuration Info
./spctl connection create -i json -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 ProviderName: AWS DriverName: aws-driver01 CredentialName: aws-credential-01 RegionName: aws-us-east-2 - ConfigName: aws-us-west-2-connection-01 ProviderName: AWS DriverName: aws-driver02 CredentialName: aws-credential-01 RegionName: aws-us-west-2 ...
-
Get Cloud Connection Configuration Info
./spctl connection get -n aws-us-east-2-connection-01
output
ConfigName: aws-us-east-2-connection-01 ProviderName: AWS DriverName: aws-driver01 CredentialName: aws-credential-01 RegionName: aws-us-east-2
-
Delete Cloud Connection Configuration Info
./spctl connection delete -n aws-us-east-2-connection-01
output
Result: true
-
- CLI 활용 예시
-
List Cloud VM Image Info
./spctl image list --cname aws-us-east-2-connection-01
output
CSP의 사용할 수 있는 vm image 리스트를 보여준다.
-
- CLI 활용 예시
-
List Cloud VM Spec Info
./spctl vmspec list --cname aws-us-east-2-connection-01
output
현재 본인이 생성할 수 있는 vm spec 리스트를 보여준다.
-
- CLI 활용 예시
-
Register Cloud VPC/Subnet Info
./spctl vpc create -i json -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 --cname aws-us-east-2-connection-01
output
vpc: - IId: NameId: vpc-1 SystemId: vpc-0d45612952feg1a1s IPv4_CIDR: 192.168.0.0/16 SubnetInfoList: - IId: NameId: subnet-1 SystemId: subnet-0b1516s3cbb114377b IPv4_CIDR: 192.168.1.0/24 KeyValueList: - Key: VpcId Value: vpc-0d45612952feg1a1s - Key: MapPublicIpOnLaunch Value: "false" - Key: AvailableIpAddressCount Value: "251" - Key: AvailabilityZone Value: us-east-2a - Key: Status Value: available KeyValueList: null ...
-
Get Cloud VPC/Subnet Info
./spctl vpc get --cname aws-us-east-2-connection-01 -n vpc-1
output
IId: NameId: vpc-1 SystemId: vpc-0d45612952feg1a1s IPv4_CIDR: 192.168.0.0/16 SubnetInfoList: - IId: NameId: subnet-1 SystemId: subnet-0b1516s3cbb114377b IPv4_CIDR: 192.168.1.0/24 KeyValueList: - Key: VpcId Value: vpc-0d45612952feg1a1s - Key: MapPublicIpOnLaunch Value: "false" - Key: AvailableIpAddressCount Value: "251" - Key: AvailabilityZone Value: us-east-2a - Key: Status Value: available KeyValueList: null
-
Delete Cloud VPC/Subnet Info
./spctl vpc delete --cname aws-us-east-2-connection-01 -n vpc-1
output
Result: true
-
Listall VPC/Subnet
./spctl vpc listall --cname aws-us-east-2-connection-01
output
MappedList: - NameId: "" SystemId: "" OnlySpiderList: "" OnlyCSPList: - NameId: "" SystemId: ""
-
WIP
- deletecsp VPC/Subnet
- add-subnet VPC/Subnet
- remove-subnet VPC/Subnet
- removecsp-subnet VPC/Subnet
-
-
CLI 활용 예시
-
Register Cloud SecurityGroup Info
./spctl security create -i json -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 security list --cname aws-us-east-2-connection-01
output
securitygroup: - IId: NameId: sg-01 SystemId: sg-09ef2af40e29fa27d VpcIID: NameId: vpc-1 SystemId: vpc-0d45612952feg1a1s Direction: "" SecurityRules: - FromPort: "1" ToPort: "65535" IPProtocol: tcp Direction: inbound CIDR: 0.0.0.0/0 - FromPort: "" ToPort: "" IPProtocol: "-1" Direction: outbound CIDR: 0.0.0.0/0 KeyValueList: - Key: GroupName Value: vpc-1-deli-sg-01 - Key: VpcID Value: vpc-0d45612952feg1a1s - Key: OwnerID Value: "" - Key: Description Value: vpc-1-deli-sg-01 ...
-
Get Cloud SecurityGroup Info
./spctl security get --cname aws-us-east-2-connection-01 -n sg-01
output
IId: NameId: sg-01 SystemId: sg-08ef2ad40e29sk27e VpcIID: NameId: vpc-1 SystemId: vpc-0d45612952feg1a1s Direction: "" SecurityRules: - FromPort: "1" ToPort: "65535" IPProtocol: tcp Direction: inbound CIDR: 0.0.0.0/0 - FromPort: "" ToPort: "" IPProtocol: "-1" Direction: outbound CIDR: 0.0.0.0/0 KeyValueList: - Key: GroupName Value: vpc-1-deli-sg-01 - Key: VpcID Value: vpc-0d45612952feg1a1s - Key: OwnerID Value: "" - Key: Description Value: vpc-1-deli-sg-01
-
Delete Cloud SecurityGroup Info
./spctl security delete --cname aws-us-east-2-connection-01 -n sg-01
output
Result: true
-
Listall SecurityGroup
./spctl security listall --cname aws-us-east-2-connection-01
output
MappedList: - NameId: "" SystemId: "" OnlySpiderList: "" OnlyCSPList: - NameId: "" SystemId: ""
-
-
WIP
- deletecsp SecurityGroup
- CLI 활용 예시
-
Register Cloud VM KeyPair Info
./spctl keypair create -i json -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "keypair-1" } }'
-
List Cloud VM KeyPair Info
./spctl keypair list --cname aws-us-east-2-connection-01
output
keypair: - IId: NameId: keypair-1 SystemId: keypair-1 Fingerprint: ~~~ PublicKey: ssh-rsa ~~~ PrivateKey: -----BEGIN RSA PRIVATE KEY----- ~~~ -----END RSA PRIVATE KEY----- VMUserID: "" KeyValueList: null ...
-
Get Cloud VM KeyPair Info
./spctl keypair get --cname aws-us-east-2-connection-01 -n keypair-1
output
IId: NameId: keypair-1 SystemId: keypair-1 Fingerprint: ~~~ PublicKey: ssh-rsa ~~~ PrivateKey: -----BEGIN RSA PRIVATE KEY----- ~~~ -----END RSA PRIVATE KEY----- VMUserID: "" KeyValueList: null
-
Delete VM KeyPair Info
./spctl keypair delete --cname aws-us-east-2-connection-01 -n keypair-1
output
Result: true
-
Delete CSP VM KeyPair Info
./spctl keypair deletecsp --cname aws-us-east-2-connection-01 --id keypair-1
output
Result: true
-
- CLI 활용 예시
-
Create VM
./spctl vm start -i json -d \ '{ "ConnectionName": "aws-us-east-2-connection-01", "ReqInfo": { "Name": "vm-01", "ImageName": "ami-0bbe28eb2173f6167", "VPCName": "vpc-1", "SubnetName": "subnet-1", "SecurityGroupNames": [ "sg-01" ], "VMSpecName": "t2.micro", "KeyPairName": "keypair-1" } }'
-
Create VM
- CLI 활용 예시
-
List VM Status Info(All VM Status)
./spctl vm liststatus --cname aws-us-east-2-connection-01
-
Get VM Status Info(Specific VM Status)
./spctl vm getstatus --cname aws-us-east-2-connection-01 --name vm-01
-
- CLI 활용 예시
-
List VM Info(All VM List)
./spctl vm list --cname aws-us-east-2-connection-01
-
Get VM Info(Specific VM)
./spctl vm get --cname aws-us-east-2-connection-01 --name vm-01
-
- CLI 활용 예시
-
Terminate VM
./spctl vm terminate --cname aws-us-east-2-connection-01 -n vm-01
output
Status: Terminating
-
-
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]