JSCODE Logo
프로그래밍 과외블로그후기멘토진
회사명 : JSCODE대표 : 박재성사업자 등록번호 : 244-22-01557통신판매업 : 제 2023-인천미추홀-0381 호
학원 명칭 : 제이에스코드(JSCODE)원격학원학원설립ㆍ운영 등록번호 : 제6063호

서울특별시 구로구 경인로 20가길 11(오류동, 아델리아)

Copyright ⓒ 2025 JSCODE - 최상위 현업 개발자들의 프로그래밍 교육 All rights reserved.

이용약관개인정보처리방침
← 블로그 목록으로 돌아가기

[실습] EC2에 간단한 API 서버 셋팅하기

JSCODE 박재성
JSCODE 박재성
2025-12-06
author
JSCODE 박재성
category
부하테스트
createdAt
Dec 6, 2025
series
대규모 트래픽 처리를 위한 부하테스트 입문/실전
slug
exercise-setup-simple-api-server-on-ec2
type
post
updatedAt
Dec 6, 2025 04:46 AM
🧑🏻
AWS에 초점을 맞춘 강의가 아니기 때문에 EC2, RDS, ELB에 대한 디테일한 설명은 생략할 예정이다. 혹시 AWS에 대한 기본기를 다지고 싶다면 아래 강의를 추천한다. 비전공자도 이해할 수 있는 AWS 입문/실전 (https://inf.run/73afg)

✅ EC2 인스턴스 생성하기

notion image
notion image
notion image
notion image
notion image
notion image
 
 

✅ 간단한 API 서버 셋팅하기

🧑🏻‍🏫
참고) 이번 실습에서는 Node 기반의 Express 서버를 활용하지만, 이후 실습에서는 Spring Boot를 활용해 테스트를 할 예정이다.
  1. Node 설치
    1. Ubuntu 환경에서 Express 서버를 실행시키려면 Node.js가 설치되어 있어야 한다. 그래서 Ubuntu에 우선 Node.js를 설치해보자.
      distributions
      nodesource • Updated Jan 12, 2026
      $ sudo su $ apt-get update && / apt-get install -y ca-certificates curl gnupg && / mkdir -p /etc/apt/keyrings && / curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && / NODE_MAJOR=20 && / echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list && / apt-get update && / apt-get install nodejs -y # 잘 설치됐는 지 확인하기 $ node -v
       
  1. Express 서버 셋팅하기
    1. 기본 프로젝트 셋팅
      $ mkdir my-server $ cd my-server $ npm init # 의존성 관리 파일 생성 $ npm i express # express 라이브러리 설치
       
      API 로직 작성
      app.js
      const express = require('express'); const app = express(); const port = 80; app.get('/boards', (req, res) => { res.send([ { id: 1, title: '첫 번째 게시글', content: '이것은 첫 번째 게시글의 내용입니다.' }, { id: 2, title: '두 번째 게시글', content: '이것은 두 번째 게시글의 내용입니다.' }, { id: 3, title: '세 번째 게시글', content: '이것은 세 번째 게시글의 내용입니다.' } ]); }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) })
       
  1. pm2 설치하기
    1. Node 기반의 서버는 pm2를 활용해서 많이 실행시킨다. 서비스를 운영하는 데 있어서 유용한 기능들을 pm2가 많이 가지고 있기 때문이다.
      $ npm i -g pm2
 
  1. API 서버 실행시키기
    1. $ pm2 start app.js
       
  1. 잘 잘동하는 지 확인하기
    1. notion image
 
author
category
부하테스트
createdAt
Dec 6, 2025
series
대규모 트래픽 처리를 위한 부하테스트 입문/실전
slug
type
series-footer
updatedAt
Dec 6, 2025 04:54 AM
📎
이 글은 대규모 트래픽 처리를 위한 부하테스트 입문/실전 강의의 수업 자료 중 일부입니다.