brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Apr 20. 2022

141. 테라폼-네이버 클라우드CLI 로VPC 9/11

인프라를 코드로 관리하자.


<1> 콘솔로 VPC만들기, 명령서버 1대 만들기

<2> 파워쉘 설치

<3> 비주얼 스튜디오 코드 설치 

<4> Naver Cloud CLI 설치

<5> 테라폼 설치



<1> 콘솔로 VPC만들기, 명령서버 1대 만들기


https://www.ncloud.com/


1

VPC

command-naver-dev-vpc

10.0.0.0/21


KR-1


Subnet 생성

command-naver-dev-pub1

10.0.0.0/24

일반



참고

command-na-dev-vpc

command-na-dev-pub1






2

로키 리눅스나 우분트 리눅스 명령서버 1대 만들기




<2> 파워쉘 설치


1

리눅스 서버 로그인

로키 리눅스 가능

centos 가능



2

# Register the Microsoft RedHat repository

curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo



3

# Install PowerShell

sudo yum install -y powershell



4

# Start PowerShell

pwsh





[root@Server-EC2 ~]# pwsh

PowerShell 7.2.2

Copyright (c) Microsoft Corporation.



https://aka.ms/powershell

Type 'help' to get help.


PS /root> exit





<3> 비주얼 스튜디오 코드 설치 


https://code.visualstudio.com/docs/setup/setup-overview




<4> Naver Cloud CLI 설치


1

wget -O ncloud-cli.zip https://www.ncloud.com/api/support/download/files/26

unzip ncloud-cli.zip

cd cli_linux

chmod 740 ncloud

chmod 740 ./jre8/bin/java



vi ~/.bashrc

# .bashrc

# User specific aliases and functions

alias rm='rm -i'

alias cp='cp -i'

alias mv='mv -i'

# Source global definitions

if [ -f /etc/bashrc ]; then

        . /etc/bashrc

fi

export PATH=$PATH:/root/cli_linux



2

cd cli_linux/



vi ncloud


#!/bin/bash

DIR=$(dirname $(realpath $0))

$DIR/jre8/bin/java -jar $DIR/lib/ncloud-api-cli-1.1.6-SNAPSHOT-jar-with-dependencies.jar "$@"


source .bashrc


ncloud





2

ncloud 환경 설정 하기

access-key , secret-key를 알아야 한다.

my page > 인증키 관리에서 확인 할수 있다.


[root@Server-EC2 ~]# ncloud configure

set [DEFAULT]'s configuration.

Ncloud Access Key ID []: EQCygJㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌ

Ncloud Secret Access Key []: 3z0xYㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌㅌ

Ncloud API URL (default:https://ncloud.apigw.ntruss.com) []:


3

확인


[root@Server-EC2 ~]# ncloud server getRegionList

{"getRegionListResponse": {

  "requestId": "a7c0441c-b5c9-406b-9546-6499ce3c88f5",

  "returnCode": "0",

  "returnMessage": "success",

  "totalRows": 6,

  "regionList": [

    {

      "regionNo": "1",

      "regionCode": "KR",

      "regionName": "Korea"

    },

    {

      "regionNo": "3",

      "regionCode": "HK",

      "regionName": "HongKong"

    },

    {

      "regionNo": "7",

      "regionCode": "SGN",

      "regionName": "Singapore(New)"

    },

    {

      "regionNo": "8",

      "regionCode": "JPN",

      "regionName": "Japan(New)"

    },

    {

      "regionNo": "9",

      "regionCode": "USWN",

      "regionName": "US-West(New)"

    },

    {

      "regionNo": "10",

      "regionCode": "DEN",

      "regionName": "Germany(New)"

    }

  ]

}}




<5> 테라폼 설치


sudo yum install -y yum-utils


sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo


sudo yum -y install terraform


terraform






다음 공부

https://brunch.co.kr/@topasvga/2368




https://brunch.co.kr/@topasvga/2370



https://brunch.co.kr/@topasvga/2420



감사합니다.

매거진의 이전글 1. 테라폼-네이버 클라우드 VPC생성-2024-05
작품 선택
키워드 선택 0 / 3 0
댓글여부
afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari