1
CLI로 VPC 만들기
ncloud vpc createVpc --regionCode KR --vpcName devops-edu --ipv4CidrBlock 10.0.0.0/16
[root@Server-EC2 cli_linux]# ncloud vpc createVpc --regionCode KR --vpcName devops-edu --ipv4CidrBlock 10.0.0.0/16
{"createVpcResponse": {
"requestId": "78327ef0-5da7-4df9-a2fd-f8916306db73",
"returnCode": "0",
"returnMessage": "success",
"totalRows": 1,
"vpcList": [
{
"vpcNo": "19567",
"vpcName": "devops-edu",
"ipv4CidrBlock": "10.0.0.0/16",
"vpcStatus": {
"code": "INIT",
"codeName": "init"
},
"regionCode": "KR",
"createDate": "2022-04-20T18:10:24+0900"
}
]
}}
[root@Server-EC2 cli_linux]#
VPC를 만들면 라우팅 테이블도 같이 만들어진다.
2
VPC 확인?
ncloud vpc getVpcList --vpcName devops-edu
3
서브넷은 파워 쉘로 작업 해보자~
[root@Server-EC2 cli_linux]# pwsh
## VPC 정보 불러오기
$vpcList = ((ncloud vpc getVpcList --vpcName devops-edu) | ConvertFrom-Json).getVpcListResponse.vpcList
$eduVpc = $vpcList | Where-Object {$_.vpcName -eq "devops-edu" }
$eduVpcNo = $eduVpc.vpcNo
$eduVpc
$eduVpcNo
PS /root/cli_linux> $vpcList = ((ncloud vpc getVpcList --vpcName devops-edu) | ConvertFrom-Json).getVpcListResponse.vpcList
PS /root/cli_linux> $eduVpc = $vpcList | Where-Object {$_.vpcName -eq "devops-edu" }
PS /root/cli_linux> $eduVpcNo = $eduVpc.vpcNo
PS /root/cli_linux> $eduVpc
vpcNo : 19567
vpcName : devops-edu
ipv4CidrBlock : 10.0.0.0/16
vpcStatus : @{code=RUN; codeName=run}
regionCode : KR
createDate : 4/20/2022 6:10:24 PM
PS /root/cli_linux> $eduVpcNo
19567
4
## ACL 정보 불러오기
$eduNacl = ((ncloud vpc getNetworkAclList --vpcNo $eduVpcNo) | ConvertFrom-Json).getNetworkAclListResponse.networkAclList
$eduNaclNo = $eduNacl[0].networkAclNo
$eduNacl
$eduNaclNo
## ACL 정보 불러오기
PS /root/cli_linux> $eduNacl = ((ncloud vpc getNetworkAclList --vpcNo $eduVpcNo) | ConvertFrom-Json).getNetworkAclListResponse.networkAclList
PS /root/cli_linux> $eduNaclNo = $eduNacl[0].networkAclNo
PS /root/cli_linux> $eduNacl
networkAclNo : 29231
networkAclName : devops-edu-default-network-acl
vpcNo : 19567
networkAclStatus : @{code=RUN; codeName=run}
networkAclDescription : VPC [devops-edu] default Network ACL
createDate : 4/20/2022 6:10:25 PM
isDefault : True
PS /root/cli_linux> $eduNaclNo
29231
5
## 서브넷 만들기
ncloud vpc createSubnet --regionCode KR --zoneCode KR-1 `
--vpcNo $eduVpcNo --subnetName devops-edu-t1 `
--subnet 10.0.10.0/24 --networkAclNo $eduNaclNo `
--subnetTypeCode PUBLIC
ncloud vpc createSubnet --regionCode KR --zoneCode KR-1 `
--vpcNo $eduVpcNo --subnetName devops-edu-t2 `
--subnet 10.0.20.0/24 --networkAclNo $eduNaclNo `
--subnetTypeCode PRIVATE
ncloud vpc createSubnet --regionCode KR --zoneCode KR-1 `
--vpcNo $eduVpcNo --subnetName devops-edu-t3 `
--subnet 10.0.30.0/24 --networkAclNo $eduNaclNo `
--subnetTypeCode PRIVATE
PS /root/cli_linux> ncloud vpc createSubnet --regionCode KR --zoneCode KR-1 `
>> --vpcNo $eduVpcNo --subnetName devops-edu-t2 `
>> --subnet 10.0.20.0/24 --networkAclNo $eduNaclNo `
>> --subnetTypeCode PRIVATE
{"createSubnetResponse": {
"requestId": "7e39b2cd-b86f-4de3-b8be-5e02acafe5ff",
"returnCode": "0",
"returnMessage": "success",
"totalRows": 1,
"subnetList": [
{
"subnetNo": "40766",
"vpcNo": "19567",
"zoneCode": "KR-1",
"subnetName": "devops-edu-t2",
"subnet": "10.0.20.0/24",
"subnetStatus": {
"code": "CREATING",
"codeName": "creating"
},
"createDate": "2022-04-20T19:56:39+0900",
"subnetType": {
"code": "PRIVATE",
"codeName": "Private"
},
"usageType": {
"code": "GEN",
"codeName": "General"
},
"networkAclNo": "29231"
}
]
}}
PS /root/cli_linux> ncloud vpc createSubnet --regionCode KR --zoneCode KR-1 `
>> --vpcNo $eduVpcNo --subnetName devops-edu-t3 `
>> --subnet 10.0.30.0/24 --networkAclNo $eduNaclNo `
>> --subnetTypeCode PRIVATE
{"createSubnetResponse": {
"requestId": "8cfdae59-d724-4fcc-921a-f904c7bd87e7",
"returnCode": "0",
"returnMessage": "success",
"totalRows": 1,
"subnetList": [
{
"subnetNo": "40767",
"vpcNo": "19567",
"zoneCode": "KR-1",
"subnetName": "devops-edu-t3",
"subnet": "10.0.30.0/24",
"subnetStatus": {
"code": "CREATING",
"codeName": "creating"
},
"createDate": "2022-04-20T19:56:42+0900",
"subnetType": {
"code": "PRIVATE",
"codeName": "Private"
},
"usageType": {
"code": "GEN",
"codeName": "General"
},
"networkAclNo": "29231"
}
]
}}
PS /root/cli_linux> exit
6
결과
다음 보기
https://brunch.co.kr/@topasvga/2369