[AWS] 0. Tutorial

김미숙's avatar
Jul 31, 2025
[AWS] 0. Tutorial

MobaXterm Install

notion image
notion image
다른 사람의 컴퓨터에 접근 위함
notion image
notion image
notion image
notion image
개인키가 있어야 공개키로 열어볼 수 있음
개인키 발급이 필요하다
notion image
 

Tutorial

1.

notion image
AWS 붙어 있는 것들을 먼저 공부해야한다
primitive한 것들에 아마존이 붙는다
EC2 → primitive

2.

notion image
 

3.

notion image
notion image
notion image
 

4.

notion image
notion image
EC2의 공개키로 metacoding-aws-key 를 연다
 

5.

인바운드 & 아웃바운드 규칙 설정
notion image
 

6.

notion image
notion image
이렇게 하면 남의 집에 OS 설치 가능
컴퓨터 한대에 여러명이 붙는다 → 컴퓨터 한 대에 여러 OS가 붙는다 / 가상화를 공부해야 이해 가능
 

7.

notion image
설치가 진행중이라면 F5
설치가 진행중이라면 F5
 

8.

F5 클릭
notion image
상태 검사 통과
ip, port번호, OS user이름(사용자이름), private key 필요
지금은 ip와 사용자 이름을 모르는 상태
 

9.

notion image
notion image
고정IP로 쓰지 않으면 서버운영을 할 수 없다
지금 유동IP라서 서버를 운영할 수 없음
IP는 빌리는 것 만큼 비용이 나간다
notion image
퍼블릭 IPv4 주소 복사
 

10.

notion image
 

11. EC2 실행

notion image
Console clear
clear
notion image
notion image
 

11-1 apt update

sudo apt update
apt update - 메뉴판 업데이트 같은 것 / 업데이트 안 하면 JDK를 설치할 수 없다
업데이트하면 동기화가 됨
apt update - 메뉴판 업데이트 같은 것 / 업데이트 안 하면 JDK를 설치할 수 없다 업데이트하면 동기화가 됨
 

11-2 JDK 찾기

sudo apt-cache search jdk
notion image
 

11-3 grep

sudo apt-cache search jdk | grep 21 // 21로 필터링
notion image
notion image
여기에 jar 파일을 던져서 실행하고 싶으면 JDK 없이 jre만 있으면 된다
github에서 코드를 내려받아 컴파일 하면서 jar 파일을 구워낼려면 JDK 필요
JDK 설치하면 jre는 같이 있음
 

11-4 JDK 설치

sudo apt install openjdk-21-jdk
notion image
notion image
 

11-4 Java & Git version 확인

java --version git --version
notion image
 

11-5 GitHub Clone

git clone https://github.com/2025-green/flutter-blog-restapi-server.git ls cd f + tab // cd -> change directory ls ls -l // 자세히 보기
notion image
x → 실행파일의 약자 / x가 없으면 실행파일이 아니다
 

11-6 build

./gradlew clean build ./gradlew build -x test //통합테스트 없이 build해서 jar 파일 생성 -> 우리는 무조건 clean build
notion image
EC2에서 build하는 건 EC2에서 통합테스트 후 jar 파일을 만드는 것
통합테스트 중 뻗음..
Ctrl + c → 인터럽트
나중에 배포할 때는 비용드는 걸로 한 후 한시간 정도만 켜놨다가 끈다
 

12 Git 프로젝트 바꿔서 재실행

AWS 서버 삭제 후 새로 생성
apt update
sudo apt update
apt update - 메뉴판 업데이트 같은 것 / 업데이트 안 하면 JDK를 설치할 수 없다
업데이트하면 동기화가 됨
apt update - 메뉴판 업데이트 같은 것 / 업데이트 안 하면 JDK를 설치할 수 없다 업데이트하면 동기화가 됨
apt install openjdk-21-jdk
sudo apt install openjdk-21-jdk
notion image
Git Clone
cd .. // 있던 폴더에서 나올때 rm -rf f+tab ---------------------------------------- git clone https://github.com/metacoding-books/aws-v1.git ls cd a + tab // cd -> change directory ls -l chmod +x gradlew ls -l
notion image
./gradlew clean build
Build Successful
Build Successful
폴더 이동 후 서버 실행
ls cd build/libs ls java -jar v+tab
현재 8080 포트로 실행 중 → 인바운드에 8080 포트 열어야함
현재 8080 포트로 실행 중 → 인바운드에 8080 포트 열어야함
 

13. Port 열기 - 인바운드 규칙 설정

보안 그룹 클릭 → 인바운드와 아웃바운드 규칙을 편집한다
보안 그룹 클릭 → 인바운드와 아웃바운드 규칙을 편집한다
 
notion image
notion image
notion image
notion image
8080 포트 개방 완료
8080 포트 개방 완료
IP 복사해서 주소창에 입력 → IP주소:8080/~
notion image
 
notion image
 
이제 어디서든 접근이 가능하다
이제 어디서든 접근이 가능하다
 
로그 확인
notion image
notion image
notion image
notion image
notion image
notion image
Share article

parangdajavous