pySatellite / restdb

0 stars 19 forks source link

AWS Github Action Deploy to EC2 #7

Open pySatellite opened 6 months ago

pySatellite commented 6 months ago

STEP 1


image

그룹권한 추가 ( TL )

image

역할 생성 ( TL )

역할 연결 -> EC2 ( TL )

image

image

image

배포용 S3 Bucket 만들기 ( 각자 )

image

pySatellite commented 6 months ago

STEP 2


image

CodeDeploy 애플리케이션 생성 (각자)

CodeDeploy 애플리케이션 - 배포그룹 생성 ( TL )

image

image

pySatellite commented 6 months ago

STEP 3


GitHub Actions 가 사용자로 인증하기 위해 사용할 액세스 키를 생성(TL)

image

image

GitHub Repository Secrets 액세스 키 저장(각자)

image

pySatellite commented 6 months ago

STEP 4


EC2 설정 (각자)

각 리전 참조 : https://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/using-regions-availability-zones.html

$ sudo aws configure AWS Access Key ID [None]: <CSV - AWS_ACCESS_KEY_ID 입력> AWS Secret Access Key [None]: Default region name [None]: Default output format [None]: json


- codedeploy-agent 설치

루비 설치

$ sudo apt update $ sudo apt install ruby-full $ sudo apt install wget

$ wget https://aws-codedeploy-ap-northeast-2.s3.ap-northeast-2.amazonaws.com/latest/install $ chmod +x ./install $ sudo ./install auto > /tmp/logfile

실행 확인

$ sudo service codedeploy-agent status

인스턴스가 부팅시 codedeploy-agent 가 자동 실행 파일 작성 및 권한

$ sudo cat /etc/init.d/codedeploy-startup.sh

!/bin

sudo service codedeploy-agent restart $ sudo chmod +x /etc/init.d/codedeploy-startup.sh