brunch

매거진 kakao cloud

You can make anything
by writing

C.S.Lewis

by Master Seo Mar 16. 2023

카카오 클라우드 2탄-2. 서버 접속

<1> 베스천 서버 생성

<2> 인스턴스 만들기 참고 이미지

<3> web, was 생성




<1> 베스천 서버 생성


1

베스천 키페어 만들기

computing > virtual machine > key pair

키페어 만들기

web-keypair



2

인스턴스 만들기


bastion

설정하기 > 내이미지 탭 > edu-bastion

a1-2-std


3

키페어는 앞에서 만든 키페어 사용


4

mgmt subnet


5

sg-mgmt 보안그룹 사용

보안그룹은 네트워크에 있다. 나중에 수정시 참고.


in

본인 ip 22 허용

본인 ip  80 허용

본인 ip  81 허용

본인 ip 10001-10099 허용


out

all


본인  ip확인 사이트

https://findip.kr/



6

공인ip 할당 매칭


7

puttygen으로 ppk파일 생성


8

putty로 접속

centos

ubuntu


9

웹서비스 올려 접속 확인 테스트

#!/bin/bash

yum -y install httpd

systemctl enable httpd

systemctl start httpd

echo '<html><h1>Hello From Your Web Server!</h1></html>' > /var/www/html/index.html



10



<2> 인스턴스 만들기 참고 이미지


1

인스턴스 이름 bastion 

이미지  centos로 선택


2

키페어 지정

네트워크 지정 - vpc , public subnet 으로 지정



3

보안 그룹 지정

내 pc에 대해  ssh(22) 허용

웹 서비스 테스트 하려면 내 pc에 대해 80 허용.


4

서버 생성후 공인 IP 지정

VM 의 오른쪽 :  가면 공인IP를 할당 할수 있다.

기존 공인IP를 사용하거나 새로 공인IP를 할당 받아 사용가능하다.


// 서버 생성시는 따로 공인IP를 할당하는 부분은 없다. 







<3> web, was 생성


1

web 2대 생성 

was 2대  생성 


Centos 나 ubuntu 20.04 생성


book-kakao-web

book-kakao-was



2

book-kakao-web

centos

web subnet


sg-web

베스천에서만 22로 접속 

web 서브넷의 로드 밸런서만 접속 가능 80 , 172.16.131.0/24


3

book-kakao-web-1

book-kakao-web-2



4

book-kakao-was

was subnet


sg-was 생성

베스천에서만 22로 접속 

was subnet에 배치되는 로드밸런서 요청만 허용 8080



5

참고

main

172.16.0.0/20


edu-subnet-mgmt

172.16.130.0/24


edu-subnet-web

172.16.131.0/24


edu-subnet-was

172.16.132.0/24


edu-subnet-db

172.16.133.0/24



5

베스천에서  web, was로 로그인


[root@host-172-16-130-251 ~]# vi web-keypair.pem

[root@host-172-16-130-251 ~]# chmod 400 web-keypair.pem

[root@host-172-16-130-251 ~]# ssh centos@172.16.132.213 -i web-keypair.pem

The authenticity of host '172.16.132.213 (172.16.132.213)' can't be established.

ECDSA key fingerprint is SHA256:HW

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added '172.16.132.213' (ECDSA) to the list of known hosts.

Activate the web console with: systemctl enable --now cockpit.socket


[centos@host-172-16-132-213 ~]$ sudo su -

[root@host-172-16-132-213 ~]#



6

#!/bin/bash

yum -y install httpd

systemctl enable httpd

systemctl start httpd

echo '<html><h1>Hello From Your Web Server!</h1></html>' > /var/www/html/index.html



7

bastion에서 curl로 확인

[root@host-172-16-130-251 ~]# curl 172.16.131.67

<html><h1>Hello From Your Web Server!</h1></html>



8

주의

web과 was의 끝번 ip가 같은 IP로 생성됨.

작업시 주의 요망~



다음

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


감사합니다.


  

매거진의 이전글 카카오 클라우드 2탄-1. 도서관 애플리케이션 메인
작품 선택
키워드 선택 0 / 3 0
댓글여부
afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari