AWS CodePipeline은 빠르고 안정적인 애플리케이션 및 인프라 업데이트를 위해 릴리스 파이프라인을 자동화하는데 도움이 되는 완전관리형 지속적 전달 서비스입니다. 사용한 만큼만 비용을 지불합니다.
이 실습에서는 CodePipeline을 사용하여 앞서 생성한 CodeCommit, CodeBuild 및 CodeDeploy 구성 요소를 사용하여 자동화된 파이프라인을 생성합니다. 파이프라인은 새 커밋이 Git 리포지토리의 기본 분기로 푸시될 때 트리거됩니다.
파이프라인 생성
AWS 콘솔에 CodePipeline 서비스 를 검색합니다 .
파이프라인에서 파이프라인 생성을 선택합니다 .
파이프라인 이름으로 unicorn-web-pipeline을 입력 합니다. 새 서비스 역할을 선택하고 자동 생성된 역할 이름을 사용하도록 합니다. 다른 설정은 기본값으로 두고 다음을 클릭 합니다.
4. 소스 공급자에서 AWS CodeCommit을 선택하고 unicorn-web-project를 리포지토리로 선택합니다. 브랜치이름을 main으로 설정합니다. 변경 감지 옵션은 Amazon CloudWatch Events로, 출력 아티팩트 형식은 CodePipeline default로 둡니다. 다음을 클릭 합니다.
5. 빌드 공급자 화면에서 AWS CodeBuild를 빌드 공급자로 선택하고 리전은 그 전에 AWS Code 시리즈를 생성한 리전으로 선택합니다. unicorn-web-build를 프로젝트 이름으로 선택합니다. 빌드 유형을 단일 빌드로 둡니다. 다음을 클릭 합니다.
6. AWS CodeDeploy를 배포 공급자로 선택하고 unicorn-web-deploy를 애플리케이션 이름으로 선택합니다. 배포 그룹으로 unicorn-web-deploy-group을 선택 합니다. 다음을 클릭 합니다.
7. 파이프라인 설정을 검토하고 파이프라인 생성을 클릭 합니다. 생성을 클릭하면 전체 파이프라인이 처음으로 실행됩니다. 성공적으로 완료되었는지 확인합니다(몇 분 정도 소요될 수 있음).
변경 사항 릴리스
이제 완전히 관리되는 CI/CD 파이프라인이 생겼습니다! 모든 것이 작동하는지 테스트해 봅시다.
Cloud9 환경에 다시 로그인합니다.
index.jsp를 아래의 html로 업데이트 합니다.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body{
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.site-header .title{
background: url(images/wr-home-top.jpg) no-repeat top;
background-size: cover;
padding-bottom: 70.2753441802%;
margin: 0;
text-indent: -999em;
position: relative;
}
.home-about {
background: #f50856;
color: #fff;
padding: 5rem 0;
text-align: center;
}
</style>
<title>Wild Rydes</title>
</head>
<body>
<header class="site-header">
<h1 class="title">Wild Rydes</h1>
</header>
<section class="home-about">
<h2 class="section-title">How Does This Work?</h2>
<p class="content">
In today's fast paced world, you've got places you need to be but not enough time in your jam packed schedule. Wouldn't it be nice if there were a transportation service that changed the way you get around daily? Introducing Wild Rydes, an innovative transportation service that helps people get to their destination faster and hassle-free. Getting started is as easy as tapping a button in our app.
</p>
<h2 class="section-title">Our Story</h2>
<p class="content">
Wild Rydes was started by a former hedge fund analyst and a software developer. The two long-time friends happened upon the Wild Rydes idea after attending a silent yoga retreat in Nevada. After gazing upon the majestic herds of unicorns prancing across a surreal Nevada sunset, they witnessed firsthand the poverty and unemployment endemic to that once proud race. Whether it was modern society's reliance on science over magic or not, we'll never know the cause of their Ozymandian downfall and fade to obscurity. Moved by empathy, romance, and free enterprise, they saw an opportunity to marry society's demand for faster, more flexible transportation to underutilized beasts of labor through an on-demand market making transportation app. Using the founders' respective expertise in animal husbandry and software engineering, Wild Rydes was formed and has since raised untold amounts of venture capital. Today, Wild Rydes has thousands of unicorns in its network fulfilling hundreds of rydes each day.
</p>
</section>
</body>
</html>
3. 배경 이미지 클릭해서 로컬 컴퓨터에 이미지를 저장합니다. 그리고 unicorn-web-project/src/main/webapp아래에 images라는 새 폴더를 만들고 이미지 파일을 드래그 해서 images 폴더 밑에 업로드 합니다.
4. 아래 명령을 사용하여 변경 사항을 커밋합니다.
cd ~/environment/unicorn-web-project/
git add *
git commit -m "Visual improvements to homepage"
git push -u origin main
5. CodePipeline 콘솔에서 다시 확인하십시오. 파이프라인은 푸시에 의해 자동으로 트리거되어야 합니다. 파이프라인이 성공적으로 완료될 때까지 기다립니다.
6. 파이프라인이 완료되면 EC2 공용 IP 주소 http://<ip-address>/ 로 이동하여 변경 사항을 확인합니다.