Deploy

CREATE APPLICATION AND DEPLOYMENT GROUP

AWS 관리 콘솔 접속

서비스 선택

CodeDeploy 선택

Applications 선택

Create Application 선택

Application name - DemoApp 입력

AWS 관리 콘솔 접속

서비스 선택

CodeDeploy 선택

Applications 선택

DemoApp 선택

Create deployment group 선택

Deployment group name - Development 입력

Service role - InfrastructureStack 선택

Deployment type - In-place 선택

Environment configuration - Amazon EC2 instances 선택

Tag group 1 - Key: App

Tag group 1 - Value: DemoApp

Add tag group 선택

Tag group 2 - Key: Env

Tag group 2 - Value: DEV

Deployment settings - CodeDeployDeafult:AllAtOnce 선택

Load balancer - Enable load balancing 선택 해제

Create deployment group 선택

ADD APPLICATION SPECIFICATION

appspec 파일 생성

cat <<EOT >> ~/environment/DemoApp/appspec.yml
version: 0.0
os: linux
files:
  - source: /target/javawebdemo.war
    destination: /tmp/codedeploy-deployment-staging-area/
  - source: /scripts/configure_http_port.xsl
    destination: /tmp/codedeploy-deployment-staging-area/
hooks:
  ApplicationStop:
    - location: scripts/stop_application
      timeout: 300
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
  ApplicationStart:
    - location: scripts/write_codedeploy_config.sh
    - location: scripts/start_application
      timeout: 300
  ValidateService:
    - location: scripts/basic_health_check.sh
EOT

CodeCommit 원격 저장소에 변경사항 반영

cd ~/environment/DemoApp
git add .
git commit -m "Add appspec"
git push

AWS 관리 콘솔 접속

서비스 선택

CodeBuild 선택

Build Project - DemoApp 선택

Start Build 선택

Status - Succeeded 변경 확인

Verify Deployment

CodeDeploy 서비스 선택

Application 선택

DemoApp 선택