인프라 아키텍처

---
title: 청년인턴 아키텍처 흐름도 요약
---
flowchart TD;
    subgraph Public Zone
        direction LR;
        DEVELOPER(Developer) ====> INTERNET[Internet] ====> |"SSH, SFTP (22)"| BASTION["Bastion (EC2 Server)"]
        USER(User) ---> INTERNET ----> |"HTTP(80), HTTP(443)"| ELB1[Elastic Load Balancer]

        subgraph AWS-RDS
            MASTER[(Read, Write)]
            SLAVE[(Read only)]
        end
    end
    
    subgraph Private Zone
        WEB ---> ELB2[Elastic Load Balancer] ---> WAS

        subgraph WAS
            direction LR;
            WAS-["WAS (EC2 Server)"] --- WAS-AutoScaling
        end

        subgraph WEB
            direction LR;
            WEB-["WEB (EC2 Server)"] --- WEB-AutoScaling
        end
    end
    
    style INTERNET fill:#f9f,stroke:#333,stroke-width:2px
    style WAS- fill:#FF8000,stroke:#F5D0A9,stroke-width:2px
    style WEB- fill:#FF8000,stroke:#F5D0A9,stroke-width:2px
    style BASTION fill:#FF8000,stroke:#F5D0A9,stroke-width:2px
    style ELB1 fill:#FA5882,stroke:#F2F2F2,stroke-width:2px
    style ELB2 fill:#FA5882,stroke:#F2F2F2,stroke-width:2px
---
title: 개발자 접근 아키텍처 흐름도
---
flowchart LR;
    subgraph PrivateZone
        WEB ===> ELB2 ===> WAS
    end
    
    BASTION ===> |keypair .pem| PrivateZone  
    WAS <-. "Abstract Routing DataSource \n LazyConnectionDataSourceProxy" .-> AWS-RDS
    PrivateZone ===> EBS -. fluentd .-> EFS
---
title: 사용자 접근 아키텍처 흐름도
---
flowchart LR;
    subgraph PrivateZone
        WEB ===> ELB2 ===> WAS
    end
    INTERNET ===> ELB1 ===>PrivateZone
    WAS <-. "Abstract Routing DataSource \n LazyConnectionDataSourceProxy" .-> AWS-RDS
    PrivateZone ===> EBS -. fluentd .-> EFS

AWS Resource

오토스케일링처럼 위험도가 높은 작업은 직접 수행하지 않고, 누리 클라우드 업체의 기술지원을 통해 진행했다. 보안을 위해 VPC로 그룹핑되어 있어 외부에서 인스턴스로 직접 접근할 수 없고, 배스천 서버를 거쳐야만 인스턴스에 접근할 수 있다. 배스천 서버는 Public IPv4 주소로 SSH 접근이 가능하지만, 이때 ID·PW가 아니라 Keypair로 인증해야 한다.

INBOUND 규칙에는 8080 포트와 80 포트가 열려 있어야 하고, VPC는 NAT 설정을 통해 고정된 IP로 외부와 통신하므로 VPC 내 인스턴스는 OUTBOUND 통신 시 항상 동일한 IP를 갖는다. WEB과 WAS 각각 별도의 로드밸런서를 사용 중이다.

WEB Elastic Load Balancer는 80 포트로 들어온 요청을 443 포트로 리다이렉트하고, 443 포트 요청은 타겟그룹으로 전달한다. 타겟그룹에는 EC2와 EC2-Autoscaling 두 대가 등록되어 있으며, Health Checks에서 타겟그룹에 속한 인스턴스의 상태를 확인할 수 있다. ELB는 그룹 내 인스턴스로 HTTP 요청을 보내 성공 조건을 만족하면 해당 인스턴스가 서비스 중이라고 판단한다.

WAS Elastic Load Balancer는 8080 포트로 들어온 요청을 타겟그룹으로 전달하는 역할을 한다(타겟그룹에 대한 자세한 설명은 생략한다).

Elastic Computer Cloud

Instance Role Operating System Applications
Bastion Amazon Linux N/A
WEB Ubuntu 20.04 Nginx
WAS Ubuntu 20.04 PM2

특이사항

WAS는 SpringBoot 내장 Tomcat을 사용하고, 프로세스 관리 도구인 PM2도 함께 사용한다. 자세한 설치 과정은 이 글에서는 생략한다.