- HOME
- CLI 개요
- Compute
- Server (VPC)
- Server 개요
- Server
- Login Key
- Placement Group
- getServerInstanceList
- getServerInstanceDetail
- createServerInstances
- startServerInstances
- stopServerInstances
- rebootServerInstances
- terminateServerInstances
- changeServerInstanceSpec
- getRootPassword
- getRootPasswordServerInstanceList
- setProtectServerTermination
- interruptServerInstance
- Server Image
- removeServerImageSharingPermission
- addServerImageSharingPermission
- getServerImageDetail
- getServerImageList
- createServerImageFromSnapshot
- createServerImage
- deleteServerImage
- getMemberServerImageInstanceList
- getMemberServerImageInstanceDetail
- createMemberServerImageInstance
- deleteMemberServerImageInstances
- setMemberServerImageSharingPermission
- addMemberServerImageSharingPermission
- removeMemberServerImageSharingPermission
- Storage
- Snapshot
- Public IP
- Init Script
- Network Interface
- getNetworkInterfaceList
- getNetworkInterfaceDetail
- createNetworkInterface
- deleteNetworkInterface
- attachNetworkInterface
- detachNetworkInterface
- addNetworkInterfaceAccessControlGroup
- removeNetworkInterfaceAccessControlGroup
- assignSecondaryIps
- unassignSecondaryIps
- enableFlowLog
- disableFlowLog
- getFlowLogConfigurationList
- ACG
- Common
- Server
- Server 개요
- getServerImageProductList
- getServerProductList
- getRaidList
- getServerInstanceList
- createServerInstances
- recreateServerInstance
- terminateServerInstances
- changeServerInstanceSpec
- rebootServerInstances
- startServerInstances
- stopServerInstances
- getInitScriptList
- getRootPassword
- getRootPasswordServerInstanceList
- getMemberServerImageList
- createMemberServerImage
- deleteMemberServerImages
- getBlockStorageInstanceList
- createBlockStorageInstance
- deleteBlockStorageInstances
- attachBlockStorageInstance
- detachBlockStorageInstances
- changeBlockStorageVolumeSize
- getBlockStorageSnapshotInstanceList
- createBlockStorageSnapshotInstance
- deleteBlockStorageSnapshotInstances
- getPublicIpInstanceList
- getPublicIpTargetServerInstanceList
- createPublicIpInstance
- associatePublicIpWithServerInstance
- disassociatePublicIpFromServerInstance
- deletePublicIpInstances
- replaceServerInstanceAssociatedWithPublicIp
- getPortForwardingRuleList
- addPortForwardingRules
- deletePortForwardingRules
- getRegionList
- getZoneList
- getLoginKeyList
- createLoginKey
- importLoginKey
- deleteLoginKey
- createNasVolumeInstance
- deleteNasVolumeInstance
- getNasVolumeInstanceList
- changeNasVolumeSize
- getNasVolumeInstanceRatingList
- setNasVolumeAccessControl
- addNasVolumeAccessControl
- removeNasVolumeAccessControl
- getNasVolumeAccessControlRuleList
- getAccessControlGroupList
- getAccessControlGroupServerInstanceList
- getAccessControlRuleList
- createInstanceTags
- deleteInstanceTags
- getInstanceTagList
- getPortForwardingConfigurationList
- setMemberServerImageSharingPermission
- addMemberServerImageSharingPermission
- removeMemberServerImageSharingPermission
- setNasVolumeReturnProtection
- getNasVolumeSnapshotConfigurationHistoryList
- changeNasVolumeSnapshotConfiguration
- getNasVolumeSnapshotList
- createNasVolumeSnapshot
- deleteNasVolumeSnapshot
- restoreNasVolumeWithSnapshot
- setProtectServerTermination
- interruptServerInstance
- Auto Scaling (VPC)
- Auto Scaling 개요
- Launch Configuration
- Auto Scaling Group
- getAutoScalingGroupList
- getAutoScalingGroupDetail
- createAutoScalingGroup
- updateAutoScalingGroup
- deleteAutoScalingGroup
- setDesiredCapacity
- getScheduledActionList
- putScheduledUpdateGroupAction
- deleteScheduledUpdateGroupAction
- getScalingProcessTypeList
- suspendProcesses
- resumeProcesses
- getAutoScalingActivityLogList
- getAutoScalingPolicyList
- getAdjustmentTypeList
- putScalingPolicy
- deleteScalingPolicy
- executePolicy
- Auto Scaling
- Auto Scaling 개요
- getLaunchConfigurationList
- createLaunchConfiguration
- deleteAutoScalingLaunchConfiguration
- getAutoScalingGroupList
- createAutoScalingGroup
- updateAutoScalingGroup
- deleteAutoScalingGroup
- setDesiredCapacity
- terminateServerInstanceInAutoScalingGroup
- setServerInstanceHealth
- getScheduledActionList
- putScheduledUpdateGroupAction
- deleteScheduledAction
- suspendProcesses
- resumeProcesses
- getScalingProcessTypeList
- getAutoScalingActivityLogList
- getAutoScalingConfigurationLogList
- getAutoScalingPolicyList
- putScalingPolicy
- deletePolicy
- executePolicy
- getAdjustmentTypeList
- Server (VPC)
- Storage
- Networking
- VPC
- VPC 개요
- VPC Management
- Subnet Management
- Network ACL
- getNetworkAclList
- getNetworkAclDetail
- createNetworkAcl
- deleteNetworkAcl
- setSubnetNetworkAcl
- getNetworkAclRuleList
- addNetworkAclInboundRule
- addNetworkAclOutboundRule
- removeNetworkAclInboundRule
- removeNetworkAclOutboundRule
- setNetworkAclDescription
- getNetworkAclDenyAllowGroupList
- getNetworkAclDenyAllowGroupDetail
- createNetworkAclDenyAllowGroup
- deleteNetworkAclDenyAllowGroup
- setNetworkAclDenyAllowGroupIpList
- setNetworkAclDenyAllowGroupDescription
- NAT Gateway
- VPC Peering
- Route Table
- Load Balancer (VPC)
- Load Balancer 개요
- Load Balancer
- addLoadBalancerListenerCertificate
- getLoadBalancerInstanceList
- getLoadBalancerInstanceDetail
- createLoadBalancerInstance
- deleteLoadBalancerInstances
- changeLoadBalancerInstanceConfiguration
- setLoadBalancerInstanceSubnet
- setLoadBalancerDescription
- getLoadBalancerListenerList
- createLoadBalancerListener
- deleteLoadBalancerListeners
- changeLoadBalancerListenerConfiguration
- getLoadBalancerRuleList
- removeLoadBalancerListenerCertificate
- getLoadBalancerListenerCertificateList
- Target Group
- Load Balancer
- Load Balancer 개요
- getLoadBalancerInstanceList
- createLoadBalancerInstance
- getLoadBalancerTargetServerInstanceList
- changeLoadBalancerInstanceConfiguration
- getLoadBalancedServerInstanceList
- changeLoadBalancedServerInstances
- deleteLoadBalancerInstances
- getLoadBalancerSslCertificateList
- addLoadBalancerSslCertificate
- deleteLoadBalancerSslCertificate
- VPC
- Database
- Cloud DB for PostgreSQL (VPC)
- Cloud DB for PostgreSQL (on VPC) 개요
- addCloudPostgresqlDatabaseList
- addCloudPostgresqlUserList
- changeCloudPostgresqlUserList
- createCloudPostgresqlInstance
- createCloudPostgresqlReadReplicaInstance
- deleteCloudPostgresqlDatabaseList
- deleteCloudPostgresqlInstance
- deleteCloudPostgresqlReadReplicaInstance
- deleteCloudPostgresqlUserList
- exportBackupToObjectStorage
- exportDbServerLogToObjectStorage
- getCloudPostgresqlBackupDetailList
- getCloudPostgresqlBackupList
- getCloudPostgresqlBucketList
- getCloudPostgresqlDatabaseList
- getCloudPostgresqlImageProductList
- getCloudPostgresqlInstanceDetail
- getCloudPostgresqlInstanceList
- getCloudPostgresqlProductList
- getCloudPostgresqlTargetSubnetList
- getCloudPostgresqlTargetVpcList
- getCloudPostgresqlUserList
- getDbServerLogList
- rebootCloudPostgresqlServerInstance
- Cloud DB for MySQL (VPC)
- Cloud DB for MySQL (VPC) 개요
- addCloudMysqlDatabaseList
- addCloudMysqlUserList
- changeCloudMysqlServerSpec
- changeCloudMysqlUserList
- createCloudMysqlInstance
- createCloudMysqlRecoveryInstance
- createCloudMysqlSlaveInstance
- deleteCloudMysqlDatabaseList
- deleteCloudMysqlInstance
- deleteCloudMysqlServerInstance
- deleteCloudMysqlUserList
- exportBackupToObjectStorage
- exportDbServerLogToObjectStorage
- getCloudMysqlBackupDetailList
- getCloudMysqlBackupList
- getCloudMysqlDatabaseList
- getCloudMysqlEventHistoryList
- getCloudMysqlImageProductList
- getCloudMysqlInstanceDetail
- getCloudMysqlInstanceList
- getCloudMysqlProductList
- getCloudMysqlRecoveryTime
- getCloudMysqlTargetSubnetList
- getCloudMysqlTargetVpcList
- getCloudMysqlUserList
- getDbServerLogList
- rebootCloudMysqlServerInstance
- Cloud DB for Redis (VPC)
- Cloud DB for Redis (VPC) 개요
- createCloudRedisConfigGroup
- createCloudRedisInstance
- deleteCloudRedisConfigGroup
- deleteCloudRedisInstance
- getCloudRedisBackupDetailList
- getCloudRedisBackupList
- getCloudRedisConfigGroupList
- getCloudRedisInstanceDetail
- getCloudRedisImageProductList
- getCloudRedisInstanceList
- getCloudRedisProductList
- rebootCloudRedisServerInstance
- flushAllCloudRedisServerInstance
- getCloudRedisTargetVpcList
- getCloudRedisTargetSubnetList
- createCloudRedisManualBackup
- deleteCloudRedisManualBackup
- getCloudRedisManualBackupList
- getCloudRedisManualBackupDetailList
- getCloudRedisBucketList
- exportBackupToObjectStorage
- getCloudRedisConfigGroupVersionList
- Cloud DB for MSSQL (VPC)
- Cloud DB for MSSQL (VPC) 개요
- createCloudMssqlInstance
- createCloudMssqlSlaveInstance
- deleteCloudMssqlInstance
- deleteCloudMssqlServerInstance
- exportDbServerLogsToObjectStorage
- exportBackupToObjectStorage
- getCloudMssqlLogBackupFileList
- getCloudMssqlBackupDetailList
- getCloudMssqlBackupList
- getCloudMssqlCharacterSetList
- getCloudMssqlConfigGroupList
- getCloudMssqlImageProductList
- getCloudMssqlInstanceDetail
- getCloudMssqlInstanceList
- getCloudMssqlProductList
- getCloudMssqlTargetSubnetList
- getCloudMssqlTargetVpcList
- getCloudMssqlLogFileList
- getCloudMssqlFolderList
- getCloudMssqlBucketList
- rebootCloudMssqlServerInstance
- Cloud DB for MongoDB (VPC)
- Cloud DB for MongoDB (on VPC) 개요
- addCloudMongoDbUserList
- changeCloudMongoDbConfigCount
- changeCloudMongoDbMongosCount
- changeCloudMongoDbSecondaryCount
- changeCloudMongoDbShardCount
- changeCloudMongoDbUserList
- createCloudMongoDbInstance
- deleteCloudMongoDbInstance
- deleteCloudMongoDbUserList
- getCloudMongoDbBucketList
- exportBackupToObjectStorage
- getCloudMongoDbBackupDetailList
- getCloudMongoDbBackupList
- getCloudMongoDbImageProductList
- getCloudMongoDbInstanceDetail
- getCloudMongoDbInstanceList
- getCloudMongoDbProductList
- getCloudMongoDbTargetSubnetList
- getCloudMongoDbTargetVpcList
- getCloudMongoDbUserList
- rebootCloudMongoDbServerInstance
- getDbServerLogList
- exportDbServerLogToObjectStorage
- Cloud DB for PostgreSQL (VPC)
- Big Data & Analytics
- Cloud Hadoop (VPC)
- Cloud Hadoop (VPC) 개요
- backupClusterConfiguration
- changeCloudHadoopNodeCount
- changeCloudHadoopNodeSpec
- createCloudHadoopInstance
- createCloudHadoopNotebookInstance
- deleteCloudHadoopInstance
- deleteCloudHadoopNotebookInstance
- getCloudHadoopAddOnList
- getCloudHadoopBucketList
- getCloudHadoopClusterTypeList
- getCloudHadoopImageProductList
- getCloudHadoopInstanceDetail
- getCloudHadoopInstanceList
- getCloudHadoopLoginKeyList
- getCloudHadoopMysqlInstanceList
- getCloudHadoopMysqlUserList
- getCloudHadoopNotebookBucketList
- getCloudHadoopNotebookComponentList
- getCloudHadoopNotebookImageProductList
- getCloudHadoopNotebookInstanceDetail
- getCloudHadoopNotebookInstanceList
- getCloudHadoopNotebookProductList
- getCloudHadoopObjectList
- getCloudHadoopProductList
- getCloudHadoopTargetSubnetList
- getCloudHadoopTargetVpcList
- saveExternalHiveMetaStore
- testConnectExternalHiveMetaStore
- Cloud Hadoop (VPC)
- Content Delivery
Classic/VPC 환경에서 이용 가능합니다.
Ncloud CLI의 초기 설정 방법부터 간단한 사용 방법 등을 확인합니다.
CLI에 관련된 각 상세 명령어 및 예제를 확인하려면 CLI help
명령어를 실행해 주십시오.
초기 설정
Ncloud CLI를 사용하기 위한 설치와 API 인증키 설정 방법을 설명합니다.
설치
운영체제(Windows, Linux)에 해당하는 CLI 최신 파일을 다운로드해 주십시오.
CLI 최신 파일 다운로드와 파일 구성에 대한 정보는 CLI 다운로드에서 확인해 주십시오.
다운로드한 폴더 경로(cli_window/cli_linux)에서 ncloud
명령어를 실행해 주십시오. 정상 실행 시 다음과 같은 메시지가 출력됩니다.
- Windows
C:\Users\Naver\cli_window>ncloud ncloud <command> [subcommand] help ncloud: error: The command does not exist. For help, input 'help' command.
Plain text - Linux
Naver@AL01221192:/mnt/c/Users/NAVER/Desktop/cli_linux$ ./ncloud ncloud <command> [subcommand] help ncloud: error: The command does not exist. For help, input 'help' command.
Plain text
1.8 이상 버전의 JRE 혹은 JDK가 로컬 환경에 설치되어 있는 경우 다음 파일도 사용이 가능합니다.
C:\Users\Naver>javac -version
javac 1.8.0_80
기존 JRE, JDK 연결
포함된 JRE 파일이 아니라 기존 로컬 환경에 이미 설치되어 있는 JRE, JDK를 이용할 경우 ncloud 스크립트 파일에서 다음과 같이 ./jre8/bin/java
를 java
로 변경합니다. 이는 기존 로컬 환경에 설치된 JRE, JDK를 사용하려는 경우에만 해당합니다.
- 수정 전
#!/bin/bash HOME='./lib' /jre8/bin/java -jar ${HOME}/ncloud-api-cli-1.0.2-SNAPSHOT-jar-with-dependencies.jar $@
Bash - 수정 후
#!/bin/bash HOME='./lib' java -jar ${HOME}/ncloud-api-cli-1.0.2-SNAPSHOT-jar-with-dependencies.jar $@
Bash
API 인증키 설정
CLI를 사용하려면 먼저 API 인증키를 설정해야 합니다.
API 인증키에 대한 자세한 설명은 API 가이드를 참조해 주십시오.
ncloud configure
명령어를 입력하면 Access Key, Secret Key를 입력받을 수 있습니다.
Naver@AL01221192:/mnt/c/Users/Naver/Desktop/cli_linux$ ./ncloud configure
set [DEFAULT]'s configuration.
Ncloud Access Key Id [] :***js9sk$K)DA!#***
Ncloud Secret Access Key [] :***kdofFIik9D$Kdk2***
Ncloud API URL (default:https://ncloud.apigw.ntruss.com) []:
각 API 인증키는 사용자 환경 홈 디렉터리의 .ncloud
폴더에 Configure 파일 형태로 저장됩니다. API 인증키를 제대로 입력한 경우 정상적으로 명령어가 수행됩니다. 만약 입력한 API 인증키가 유효하지 않은 경우 다음과 같은 메시지가 출력됩니다.
Naver@Al01221192:/mnt/c/Users/Naver/Desktop/cli_linux$ ./ncloud server getRegionList
Invalid consumer
인증키값이 유효한 경우 Zone 리스트 출력 실행 시 다음과 같은 결과가 출력됩니다.
Naver@Al01221192:/mnt/c/Users/Naver/Desktop/cli_linux$ ./ncloud server getZoneList --regionNo 1
{
"getZoneListResponse" : {
"requestId" : "5604cb78-67c9-4d91-ae74-085152f23df3",
"returnCode" : 0,
"returnMessage" : "success",
"zoneList" : [
{
"zone" : {
"zoneNo" : 2,
"zoneName" : "KR-1",
"zoneDescription" : "가산 NANG zone"
}
}
]
}
}
Profile 옵션을 통해 설정한 Profile의 인증 정보로 명령을 실행할 수 있습니다.
Naver@AL01221192:/mnt/c/Users/Naver/Desktop/cli_linux$ ./ncloud configure --profile example_profile
set [example_profile]'s configuration.
Ncloud Access Key Id [] :***js9sk$K)DA!#***
Ncloud Secret Access Key [] :***kdofFIik9D$Kdk2***
Ncloud API URL (default:https://ncloud.apigw.ntruss.com) []:
호출 예시는 다음과 같습니다.
Naver@Al01221192:/mnt/c/Users/Naver/Desktop/cli_linux$ ./ncloud server getZoneList --regionNo 1 --profile example_profile
명령어 도움말
Ncloud CLI의 원활한 사용을 위해 도움말을 확인하려면 명령어 끝에 help
를 추가하여 실행해 주십시오. 다음 명령어는 Ncloud CLI에 대한 옵션 및 도움말과 사용 가능한 최상위 명령을 나열합니다.
$ ./ncloud help
다음 명령어는 Ncloud의 상위 명령어에서 사용 가능한 하위 명령어를 나열합니다.
$ ./ncloud server help
$ ./ncloud loadbalancer help
명령어 구조
Ncloud CLI는 명령줄에서 멀티파트 구조를 사용합니다. 이 구조는 Ncloud에 대한 기본 호출로 시작되며 각 명령어마다 수행할 작업에 대한 하위 명령이 있습니다. CLI에서 옵션을 추가할 때 특정 파라미터를 어떤 순서로 지정하든 상관없습니다.
$ ./ncloud <command> <subcommand> [options and parameters]
CLI 파라미터 및 옵션 지정
대부분의 파라미터값은 간단한 문자열이나 숫자입니다. 그 외에도 Map, List 형태의 파라미터를 사용할 수도 있습니다. List는 다음과 같은 명령어로 사용합니다. List 파라미터는 공백( ) 또는 콤마(,), 추가 파라미터 선언 등을 이용해서 사용할 수 있습니다.
$ ./ncloud server getPublicIpInstanceList --publicIpInstanceNoList 573361 571968
$ ./ncloud server getPublicIpInstanceList --publicIpInstanceNoList 573361,571968
$ ./ncloud server getPublicIpInstanceList --publicIpInstanceNoList 573361 --publicIpInstanceNoList 571968
공백 문자가 없는 문자열은 따옴표로 묶거나 묶지 않을 수 있습니다. 그러나 Map 형식의 문자열은 따옴표로 묶어야 합니다. 다음 예시에서와 같이 Linux, Mac OS, Unix 및 Windows PowerShell에서는 작은따옴표(')나 큰따옴표('')가 사용 가능하고, Windows 명령 프롬프트에서는 큰따옴표('')를 사용합니다.
Windows PowerShell, Linux, MacOS, Unix
$ ./ncloud loadbalancer createLoadBalancerInstance --loadBalancerName penguin --loadBalancerRuleList 'protocolTypeCode="HTTP",loadBalancerPort="80",serverPort="80",l7HealthCheckPath="/l7check.html",proxyProtocolUseYn="N"'
Plain textWindows 명령 프롬프트
> ncloud loadbalancer createLoadBalancerInstance --loadBalancerName penguin --loadBalancerRuleList "protocolTypeCode='HTTP',loadBalancerPort='80',serverPort='80',l7HealthCheckPath='/l7check.html',proxyProtocolUseYn='N'"
Plain text
명령 출력 제어
Ncloud CLI는 두 가지 출력 형식을 지원합니다. --output
옵션이 없으면 기본 JSON 포맷으로 출력됩니다.
- JSON(json): 기본
- XML(xml)
XML로 출력하려는 경우 다음과 같이 실행해 주십시오.
$ ncloud server getZoneList --output xml
Timeout 설정
Read Timeout과 Connect Timeout 시간을 설정할 수 있습니다. 초 단위로 설정 가능하며, 기본값은 300초입니다.
$ ncloud server getZoneList --read-timeout 10
$ ncloud server getZoneList --connect-timeout 5
CLI 실행 시나리오
CLI를 이용한 간단한 테스트 시나리오를 작성하면 다음과 같습니다.
VPC
VPC 환경에서의 시나리오는 다음과 같습니다.
- VPC 생성
- Network ACL 조회
- Subnet 생성
- init 스크립트 생성 (아파치를 설치, 구동하고 touch 명령어를 이용하여 index.html 파일 생성)
- 서버 이미지 조회
- ACG 조회
- 서버 생성 (init 스크립트를 설정)
- 공인 IP 주소 생성 및 할당
- ACG 80번 포트 허용
- 결과 확인
VPC 생성 (VPC 번호 ***224)
$ ./ncloud vpc createVpc --ipv4CidrBlock 192.168.0.0/16
Plain text생성한 VPC의 Default Network ACL 조회 (Network ACL 번호 ***960)
$ ./ncloud vpc getNetworkAclList --vpcNo ***224
Plain textSubnet 생성 (Subnet 번호 ***928)
$ ./ncloud vpc createSubnet --zoneCode KR-1 --vpcNo ***224 --subnet 192.168.1.0/24 --networkAclNo ***960 --subnetTypeCode PUBLIC
Plain text서버 생성 시 실행할 init 스크립트 생성 (Init 스크립트 번호 ***751)
$ ./ncloud vserver createInitScript --initScriptContent '#!/bin/sh'$'\n''yum install -y httpd'$'\n''service httpd start'$'\n''echo '\''Hello World'\'' > /var/www/html/index.html'$'\n''chkconfig --level 2345 httpd on'
Plain text서버 이미지 CentOS 6.6(64bit) (상품 코드(productCode) SW.VSVR.OS.LNX64.CNTOS.0606.B050)
$ ./ncloud vserver getServerImageProductList | grep `CentOS 6.6(64bit)' -C 8
Plain text{ "productCode": "SW.VSVR.OS.LNX64.CNTOS.0606.B050", "productName": "centos-6.6-64", "productType": { "code": "LINUX", "codeName": "Linux" }, "productDescription": "CentOS 6.6(64bit)", "infraResourceType": { "code": "SW", "codeName": "Software" }, "cpuCount": 0, "memorySize": 0, "baseBlockStorageSize": 53687091200, "platformType": { "code": "LNX64", "codeName": "Linux 64 Bit" }, "osInformation": "CentOS 6.6 (64-bit)", "dbKindCode": "", "addBlockStorageSize": 0, "generationCode": "" }
Plain text생성한 VPC의 Default ACG 조회 (ACG 번호 ***009)
$ ./ncloud vserver getAccessControlGroupList --vpcNo ***224
서버 이미지 CentOS 6.6(64bit)로 최소 사양의 서버 인스턴스 생성(서버 인스턴스번호 ***182)
$ ./ncloud vserver createServerInstances --vpcNo ***224 --subnetNo ***928 --serverImageProductCode 'SW.VSVR.OS.LNX64.CNTOS.0606.B050' --networkInterfaceList 'networkInterfaceOrder="0", accessControlGroupNoList=["***009"]' --initScriptNo ***751
Plain text서버에 공인 IP 주소 생성 및 할당(***.***.145.185)
$ ./ncloud vserver createPublicIpInstance --serverInstanceNo ***182
Plain text서버의 Network Interface에 적용된 ACG에 80번 포트 허용 규칙 설정
$ ./ncloud vserver addAccessControlGroupInboundRule --vpcNo ***224 --accessControlGroupNo ***009 --accessControlGroupRuleList 'protocolTypeCode="TCP", ipBlock="0.0.0.0/0", portRange="80"'
Plain text브라우저에서 결과 확인
Classic
Classic 환경에서의 시나리오는 다음과 같습니다.
- 서버 이미지 조회
- 서버 생성(init 스크립트를 설정하여 아파치를 설치, 구동하고 touch 명령어를 이용해서 index.html 파일 생성)
- 공인 IP 주소 생성 및 할당
- 서버 생성 확인
서버 이미지 CentOS 6.6(64bit) 상품 코드(productCode) : SPSW0LINUX000044
$ ./ncloud server getServerImageProductList | grep `CentOS 6.6(64bit)' -C 8
Plain text{ "productCode": "SPSW0LINUX000044", "productName": "centos-6.6-64", "productType": { "code": "LINUX", "codeName": "Linux" }, "productDescription": "CentOS 6.6(64bit)", "infraResourceType": { "code": "SW", "codeName": "Software" }, "cpuCount": 0, "memorySize": 0, "baseBlockStorageSize": 53687091200, "platformType": { "code": "LNX64", "codeName": "Linux 64 Bit" }, "osInformation": "CentOS 6.6 (64-bit)", "dbKindCode": "", "addBlockStorageSize": 0 }
Plain text서버 이미지 CentOS 6.6(64bit)로 최소 사양의 서버 인스턴스 생성(서버 인스턴스번호 ***385)
$ ./ncloud server createServerInstances --serverImageProductCode 'SPSW0LINUX000044' --userData 'file:///mnt/c/Users/NAVER/Desktop/cli_linux/userData.sh'
Plain text서버 생성 시 실행할 사용자 파일(userData.sh)
#!/bin/sh yum install -y httpd service httpd start echo 'Hello World' > /var/www/html/index.html chkconfig --level 2345 httpd on
Shell{ "createServerInstancesResponse" : { "requestId" : "df5aebe7-6875-49fb-91fb-2df11f67ffa5", "returnCode" : 0, "returnMessage" : "success", "totalRows" : 1, "serverInstanceList" : [ { "serverInstanceNo" : ***385, ... } ] } }
JSON서버에 공인 IP 주소 생성 및 할당(..145.185)
$ ./ncloud server createPublicIpInstance --serverInstanceNo '***385'
Plain text{ "createPublicIpInstanceResponse" : { "requestId" : "ec5feb0b-9d9c-4539-bef1-81e94fc81dc6", "returnCode" : 0, "returnMessage" : "success", "totalRows" : 1, "publicIpInstanceList" : [ { "publicIpInstanceNo" : ***389, "publicIp" : "***.***.145.185" } ] } }
JSON네이버 클라우드 플랫폼의 콘솔에서 ***.***.145.185 공인 IP 주소에 대한 80번 포트 ACG 허용 설정(Server > ACG)
브라우저에서 결과 확인