AWS

AWS : 3 Tier [๊ตฌ์„ฑ๋„ ๋ฐ ์„ค์ • ์„ค๋ช…]

NENGIN 2024. 11. 27. 23:09

 

์ด์ „ ๊ธ€์—์„œ ์ด์–ด์ง‘๋‹ˆ๋‹ค

 

AWS : 3 Tier [DB ์ƒ์„ฑ]

์ด์ „ ๊ธ€์—์„œ ์ด์–ด์ง‘๋‹ˆ๋‹ค AWS : 3 Tier [WAS & NLB ์ƒ์„ฑ]์ด์ „ ๊ธ€์—์„œ ์ด์–ด์ง‘๋‹ˆ๋‹ค AWS : 3 Tier [WEB & ALB ์ƒ์„ฑ]์ด์ „ ๊ธ€์—์„œ ์ด์–ด์ง‘๋‹ˆ๋‹ค AWS : 3 Tier [์ดˆ๊ธฐ ์„ค์ • ๋ฐ ์ž‘์—…]์ฐธ์กฐ๋งํฌ 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๋Š” AWS ๊ณต๋ถ€ - 3 Tie

nenjin.tistory.com

 

 

 

VPC ๊ตฌ์„ฑ

์ด 8๊ฐœ์˜ ์„œ๋ธŒ๋„ท ์ค‘ Public 2๊ฐœ/ Privat 6๊ฐœ์œผ๋กœ ๊ตฌ์„ฑ๋˜์—ˆ๋‹ค

2๊ฐœ์˜ ๊ฐ€์šฉ์˜์—ญ(A,C)์œผ๋กœ ๋‚˜๋ˆ ์„œ ๊ตฌ์„ฑํ•˜์˜€๋‹ค

(์ด์œ : 1๊ฐœ์˜ ๊ฐ€์šฉ์˜์—ญ์œผ๋กœ ๊ตฌ์„ฑํ•˜๋ฉด ์žฅ์• ๊ฐ€ ์ƒ๊ฒผ์„๋•Œ ๋Œ€์ฒดํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€์šฉ์˜์—ญ์ด ์—†๊ธฐ ๋•Œ๋ฌธ์—) 

 

 

Subent ๊ตฌ์„ฑ

์„œ๋ธŒ๋„ท ๋Œ€์—ญ ๊ณต์ธ IP ํ—ˆ์šฉ ํฌํŠธ ๊ฐ€์šฉ์˜์—ญ
public nat 10.0.118.0/28 ํƒ„๋ ฅ์  IP   A
public bastion 10.0.118.16/28 ํƒ„๋ ฅ์  IP 22 C
private web1 10.0.118.32/28   80, 22 A
private web2 10.0.118.48/28   80, 22 C
private was1 10.0.118.64/28   8080, 22 A
private was2 10.0.118.80/28   8080, 22 C
private db1 10.0.118.96/28   3306, 22 A
private db2 10.0.118.112/28     C

๊ฐ ์„œ๋ธŒ๋„ท์˜ ๋„คํŠธ์›Œํฌ ๋Œ€์—ญ, ํ—ˆ์šฉ ํฌํŠธ, ๊ฐ€์šฉ์˜์—ญ์„ ์œ„์™€ ๊ฐ™์ด ์„ค์ •ํ–ˆ๋‹ค

 

 

Gateway ๊ตฌ์„ฑ

NAT Gateway : Private Subnet์˜ ์ธ์Šคํ„ด์Šค๊ฐ€ ์™ธ๋ถ€์™€ ํ†ต์‹ ํ•˜๊ธฐ ์œ„ํ•œ Gateway๋กœ Public Subnet์— ์œ„์น˜ํ•œ๋‹ค

NAT Route Table : Private Subnet์—์„œ ์™ธ๋ถ€์˜ ์ฃผ์†Œ๋กœ ํ–ฅํ•  ๋•Œ, NAT ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ๊ฑฐ์ณ๊ฐ€๊ธฐ ์œ„ํ•œ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”์ด๋‹ค

 

Internet Gateway : Bastion Host์™€ Nat Gateway๊ฐ€ ์™ธ๋ถ€๋ง๊ณผ ํ†ต์‹ ํ•˜๊ธฐ ์œ„ํ•œ ๊ฒŒ์ดํŠธ์›จ์ด์ด๋‹ค

Internet Route Table : Public Subnet์—์„œ ์™ธ๋ถ€์˜ ์ฃผ์†Œ๋กœ ํ–ฅํ•  ๋•Œ, ์ธํ„ฐ๋„ท ๊ฒŒ์ดํŠธ์›จ์ด๋ฅผ ๊ฑฐ์ณ๊ฐ€๊ธฐ ์œ„ํ•œ ๋ผ์šฐํŒ… ํ…Œ์ด๋ธ”

 

 

 EC2 ๊ตฌ์„ฑ

Server Spec OS Volume Public IP Application Version
Bastion t2.micro Amazon Linux 8 GB O X X
WEB01 t2.small Amazon Linux 20 GB X Apache 2.4.X
WEB02 t2.small Amazon Linux 20 GB X Apache 2.4.X
WAS01 t2.small Amazon Linux 30 GB X Tomcat 9.0.97
WAS02 t2.small Amazon Linux 30 GB X Tomcat 9.0.97
DB t2.medium Amazon Linux 30 GB X MySQL 8.X

์ธ์Šคํ„ด์Šค ์‚ฌ์–‘ํ‘œ์— ๋งž๋„๋ก ์ด 6๊ฐœ์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ–ˆ๋‹ค

 

 

๋ณด์•ˆ๊ทธ๋ฃน

default๋ฅผ ์ œ์™ธํ•œ ์ด 6๊ฐœ์˜ ๋ณด์•ˆ๊ทธ๋ฃน์„ ์ƒ์„ฑํ–ˆ๋‹ค

WEB, WAS, DB ์„œ๋ฒ„๋ฅผ ์œ„ํ•œ ๋ณด์•ˆ๊ทธ๋ฃน๊ณผ ALB, NLB๋ฅผ ์œ„ํ•œ ๋ณด์•ˆ๊ทธ๋ฃน์ด ์žˆ๋‹ค

 

 

Bastion ๋ณด์•ˆ๊ทธ๋ฃน

SSH ์ ‘์†์— ๋Œ€ํ•œ ์ „์ฒด์ ์ธ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ ํ๋ฆ„์ด๋‹ค

๋ชจ๋“  ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ ์ž‘์—…์€ Bastion host๋ฅผ ํ†ตํ•œ SSH ์šฐํšŒ ์ ‘๊ทผ์„ ํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

๋Œ€์นญ ํ‚ค๋ฅผ ์ด์šฉํ•œ ์„œ๋ฒ„ ์ธ์ฆ๊ณผ ๋น„๋Œ€์นญ ํ‚ค๋ฅผ ์ด์šฉํ•œ ์‚ฌ์šฉ์ž ์ธ์ฆ์„ ํ•œ๋‹ค

Bastion ๋ณด์•ˆ๊ทธ๋ฃน์˜ ์ธ๋ฐ”์šด๋“œ์™€ ์•„์›ƒ๋ฐ”์šด๋“œ ๊ทœ์น™์ด๋‹ค

์ธ๋ฐ”์šด๋“œ๋Š” ๋‚˜์˜ pc์— ๋Œ€ํ•ด์„œ๋งŒ SSH์„ ํ—ˆ์šฉํ–ˆ๋‹ค

์•„์›ƒ๋ฐ”์šด๋“œ๋Š” WEB, WAS, DB ์„œ๋ฒ„๋กœ SSH์— ๋Œ€ํ•ด ํŠธ๋ž˜ํ”ฝ์ด ๋‚˜๊ฐ€๋Š” ๊ฒƒ์„ ํ—ˆ์šฉํ–ˆ๋‹ค

 

 

ALB ๋ณด์•ˆ๊ทธ๋ฃน

์™ธ๋ถ€์—์„œ HTTP ํŠธ๋ž˜ํ”ฝ์ด ๋“ค์–ด์˜ค๋ฉด, WEB ์„œ๋ฒ„์˜ 80๋ฒˆ ํฌํŠธ๋กœ HTTP ํŠธ๋ž˜ํ”ฝ์„ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์„ ๊ตฌ์ƒํ–ˆ๋‹ค

๋ชจ๋“  ip์˜ HTTP ํ”„๋กœํ† ์ฝœ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ–ˆ๋‹ค

์•„์›ƒ๋ฐ”์šด๋“œ๋Š” WEB ๋ณด์•ˆ๊ทธ๋ฃน์„ ์ง€์ •ํ•˜์—ฌ WEB ์„œ๋ฒ„๋ฅผ ํ–ฅํ•ด ํŠธ๋ž˜ํ”ฝ์ด ๋‚˜๊ฐˆ ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

 

 

WEB ๋ณด์•ˆ๊ทธ๋ฃน

ALB๋กœ ๋ถ€ํ„ฐ ์ „๋‹ฌ ๋ฐ›์€ ํŠธ๋ž˜ํ”ฝ์„ NLB 8080๋ฒˆ ํฌํŠธ๋กœ ํŠธ๋ž˜ํ”ฝ์„ ์ „๋‹ฌํ•˜๋„๋ก ๊ตฌ์ƒํ–ˆ๋‹ค

ALB์˜ HTTP ํ”„๋กœํ† ์ฝœ ์ ‘๊ทผ์„ ํ—ˆ์šฉํ•˜๊ณ  Bastion host์˜ SSH ์ ‘๊ทผ์„ ํ—ˆ์šฉํ–ˆ๋‹ค

์•„์›ƒ๋ฐ”์šด๋“œ๋Š” NLB ๋ณด์•ˆ๊ทธ๋ฃน์„ ์ง€์ •ํ•˜์—ฌ 8080ํฌํŠธ๋กœ ํŠธ๋ž˜ํ”ฝ์ด ๋‚˜๊ฐ€๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

 

 

NLB ๋ณด์•ˆ๊ทธ๋ฃน

WEB ์„œ๋ฒ„์˜ 8080๋ฒˆ ํฌํŠธ๋กœ ํŠธ๋ž˜ํ”ฝ์ด ๋“ค์–ด์˜ค๋ฉด, WAS ์„œ๋ฒ„๋กœ ํŠธ๋ž˜ํ”ฝ์„ ์ „๋‹ฌํ•˜๋Š” ๊ฒƒ์„ ๊ตฌ์ƒํ–ˆ๋‹ค

WEB ์„œ๋ฒ„์˜ 8080๋ฒˆ ํฌํŠธ ํŠธ๋ž˜ํ”ฝ์„ ํ—ˆ์šฉํ–ˆ๋‹ค

WAS ์„œ๋ฒ„๋ฅผ ํ–ฅํ•ด 8080๋ฒˆ์œผ๋กœ ํŠธ๋ž˜ํ”ฝ์ด ๋‚˜๊ฐ€๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

 

 

WAS ๋ณด์•ˆ๊ทธ๋ฃน

NLB๋กœ๋ถ€ํ„ฐ ์ „๋‹ฌ ๋ฐ›์€ ํŠธ๋ž˜ํ”ฝ์„ ์ฒ˜๋ฆฌํ•˜๊ณ , DB๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์™€์•ผ ํ•œ๋‹ค

NLB ๋ณด์•ˆ๊ทธ๋ฃน์˜ 8080๋ฒˆ ํฌํŠธ๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์„ ํ—ˆ์šฉํ•˜๊ณ 

DB ๋ณด์•ˆ๊ทธ๋ฃน์„ ์ง€์ •ํ•˜์—ฌ 3306๋ฒˆ ํฌํŠธ์˜ ํŠธ๋ž˜ํ”ฝ์ด ๋‚˜๊ฐ€๋„๋ก ์„ค์ •ํ•œ๋‹ค

 

 

DB ๋ณด์•ˆ๊ทธ๋ฃน

DB ๋ณด์•ˆ๊ทธ๋ฃน์€ ์ธ๋ฐ”์šด๋“œ๋งŒ ์„ค์ •ํ•˜๊ณ  ์•„์›ƒ๋ฐ”์šด๋“œ์˜ ๊ทœ์น™์€ ๋ชจ๋‘ ์‚ญ์ œํ–ˆ๋‹ค

WAS ์„œ๋ฒ„์˜ 3306 ํฌํŠธ๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์„ ํ—ˆ์šฉํ•˜๊ณ 

Bastion host์˜ SSH ์ ‘๊ทผ์„ ํ—ˆ์šฉํ–ˆ๋‹ค

 

 

ALB

๊ฐ€์šฉ์—ญ์—ญ์„ public-nat์™€ public-basion์„ ์„ค์ •ํ•˜์—ฌ Public Subnet์— ์œ„์น˜ํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

 

HTTP 80๋ฒˆ ํฌํŠธ๋ฅผ Listen ์ƒํƒœ๋กœ ์„ค์ •ํ•˜๊ณ 

ํ•ด๋‹น ํฌํŠธ๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์€ ๋Œ€์ƒ๊ทธ๋ฃน๊ณผ ์—ฐ๊ฒฐ๋œ WEB ์ธ์Šคํ„ด์Šค๋กœ ์ „๋‹ฌํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

ALB ๋Œ€์ƒ๊ทธ๋ฃน์— ๋“ฑ๋กํ•œ 2๊ฐœ์˜ WEB ์ธ์Šคํ„ด์Šค์ด๋‹ค

 

 

NLB

๊ฐ€์šฉ์—ญ์—ญ์„ public-web1๊ณผ public-web2๋ฅผ ์„ค์ •ํ•˜์—ฌ Private Subnet์— ์œ„์น˜ํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

 

8080๋ฒˆ ํฌํŠธ๋ฅผ Listen ์ƒํƒœ๋กœ ์„ค์ •ํ•˜๊ณ 

ํ•ด๋‹น ํฌํŠธ๋กœ ๋“ค์–ด์˜ค๋Š” ํŠธ๋ž˜ํ”ฝ์€ ๋Œ€์ƒ๊ทธ๋ฃน๊ณผ ์—ฐ๊ฒฐ๋œ WAS ์ธ์Šคํ„ด์Šค๋กœ ์ „๋‹ฌํ•˜๋„๋ก ์„ค์ •ํ–ˆ๋‹ค

NLB ๋Œ€์ƒ๊ทธ๋ฃน์— ๋“ฑ๋กํ•œ 2๊ฐœ์˜ WAS ์ธ์Šคํ„ด์Šค์ด๋‹ค

 

 

๊ตฌ์„ฑ๋„ ํ๋ฆ„

์›น ์ ‘์†์— ๋Œ€ํ•œ ์ „์ฒด์ ์ธ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ ํ๋ฆ„์€ ์œ„์™€ ๊ฐ™๋‹ค

 

ํ๋ฆ„์ˆœ์„œ

  1. Client๊ฐ€ ALB DNS ์ฃผ์†Œ์— ์ ‘์†
  2. IGW๋ฅผ ํ†ตํ•ด ALB์— ํŠธ๋ž˜ํ”ฝ ์ „๋‹ฌ
  3. ALB์—์„œ๋Š” ๋Œ€์ƒ๊ทธ๋ฃน์„ ์ง€์ •ํ•œ APACHE ์„œ๋ฒ„์— ํŠธ๋ž˜ํ”ฝ ์ „๋‹ฌ
  4. APACHE ์„œ๋ฒ„์—์„œ Reverse Proxy๋ฅผ ํ†ตํ•ด NLB์— ํŠธ๋ž˜ํ”ฝ ์ „๋‹ฌ
  5. NLB์—์„œ๋Š” TOMCAT์— ํŠธ๋ž˜ํ”ฝ ์ „๋‹ฌ
  6. TOMCAT์—์„œ MySql๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์™€์„œ ํŽ˜์ด์ง€ ๊ตฌ์„ฑ
  7. ์š”์ฒญ์ด ๋“ค์–ด์˜จ ์ˆœ์„œ์˜ ์—ญ์ˆœ์œผ๋กœ HTTP ์‘๋‹ต ๋ฉ”์„ธ์ง€๋ฅผ Client์—๊ฒŒ ์ „์†ก

 

 

'AWS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

AWS : 3 Tier [DB ์ƒ์„ฑ]  (1) 2024.11.26
AWS : 3 Tier [WAS & NLB ์ƒ์„ฑ]  (0) 2024.11.23
AWS : 3 Tier [WEB & ALB ์ƒ์„ฑ]  (0) 2024.11.23
AWS : 3 Tier [์ดˆ๊ธฐ ์„ค์ • ๋ฐ ์ž‘์—…]  (0) 2024.11.19
AWS : ALB๋ฅผ ์ด์šฉํ•œ LoadBalancer  (0) 2024.11.07