© 2020, Amazon Web Services, Inc. or its Affiliates.
김필중
Developer Specialist Solutions Architect,
Amazon Web Services
서버리스 애플리케이션 개발 워크플로 자동화 (CI/CD)
© 2020, Amazon Web Services, Inc. or its Affiliates.
강연 중 질문하는 방법
오른쪽의 “Questions/질문” 창에 질문을 남겨주세요.
본인만 답변을 받고 싶으신 경우, (비공개)라고
하고 질문해 주시면 됩니다.
본 컨텐츠는 고객의 편의를 위해 AWS 서비스 설명을 위해 온라인 세미나용으로 별도로 제작, 제공된 것입니다. 만약 AWS
사이트와 컨텐츠 상에서 차이나 불일치가 있을 경우, AWS 사이트(aws.amazon.com)가 우선합니다. 또한 AWS 사이트
상에서 한글 번역문과 영어 원문에 차이나 불일치가 있을 경우(번역의 지체로 인한 경우 등 포함), 영어 원문이 우선합니다.
AWS는 본 컨텐츠에 포함되거나 컨텐츠를 통하여 고객에게 제공된 일체의 정보, 콘텐츠, 자료, 제품(소프트웨어 포함) 또는 서비스를 이용함으로 인하여 발생하는 여하한 종류의 손해에
대하여 어떠한 책임도 지지 아니하며, 이는 직접 손해, 간접 손해, 부수적 손해, 징벌적 손해 및 결과적 손해를 포함하되 이에 한정되지 아니합니다.
고지 사항(Disclaimer)
© 2020, Amazon Web Services, Inc. or its Affiliates.
Agenda
• CI/CD가 무엇인가요?
• 도구
• 테스팅
• 모범 사례
© 2020, Amazon Web Services, Inc. or its Affiliates.
CI/CD가 무엇인가요?
© 2020, Amazon Web Services, Inc. or its Affiliates.
CI/CD란 무엇인가요?
CI: Continuous Integration  지속적 통합
CD: Continuous Delivery  지속적 전달
CD: Continuous Deployment  지속적 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
파이프라인
Source Control Build Staging Production
개발자 버전 및
코드 변경 커밋
빌드 작업 및
유닛 테스트
테스트
환경에 배포
프로덕션
환경에 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
지속적 통합 (CI)
automated
파이프라인: 지속적 통합 (CI)
Source Control Build Staging Production
© 2020, Amazon Web Services, Inc. or its Affiliates.
지속적 통합 (CI)
automated
파이프라인: 지속적 전달 (CD)
Source Control Build Staging Production
지속적 전달 (CD)
배포 승인
automated manual
© 2020, Amazon Web Services, Inc. or its Affiliates.
지속적 통합 (CI)
automated
파이프라인: 지속적 배포 (CD)
Source Control Build Staging Production
지속적 전달 (CD)
배포 승인
automated
지속적 배포 (CD)
배포 자동화
automated
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks 아키텍처
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks 아키텍처
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks 폴더 구조
클라이언트:Vuejs 애플리케이션
백엔드: 서버리스
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks 폴더 구조
클라이언트:Vuejs 애플리케이션
백엔드: 서버리스
필요한 경우 클라이언트를
별도의 리포지토리로 쉽게
분리할 수 있어요
© 2020, Amazon Web Services, Inc. or its Affiliates.
도구
© 2020, Amazon Web Services, Inc. or its Affiliates.
Serverless Application Model
SAM
© 2020, Amazon Web Services, Inc. or its Affiliates.
SAM은 2 부분으로 나뉘어요
© 2020, Amazon Web Services, Inc. or its Affiliates.
SAM은 2 부분으로 나뉘어요
SAM templates SAM CLI
약식 구문을 사용하여
리소스 및 이벤트 소스
매핑을 표현하며
서버리스
애플리케이션을 위한
코드형 인프라 (IaC)를
제공해요
서버리스
애플리케이션을 위한
로컬 개발, 디버깅, 빌드,
패키징, 배포를 위한
도구를 제공해요
https://aws.amazon.com/serverless/sam/
© 2020, Amazon Web Services, Inc. or its Affiliates.
SAM 템플릿
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetProductsFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.getProducts
Runtime: nodejs12.x
CodeUri: src/
Policies:
- DynamoDBReadPolicy:
TableName: !Ref ProductTable
Events:
GetResource:
Type: HttpApi
Properties:
Path: /products/{productId}
Method: get
ProductTable:
Type: AWS::Serverless::SimpleTable
단 20줄로 생성하는 리소스:
• Lambda 함수
• IAM 역할
• API Gateway
• DynamoDB 테이블
© 2020, Amazon Web Services, Inc. or its Affiliates.
SAM 템플릿
AWSTemplateFormatVersion: '2010-09-09’
Transform: AWS::Serverless-2016-10-31
Resources:
GetProductsFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.getProducts
Runtime: nodejs12.x
CodeUri: src/
Policies:
- DynamoDBReadPolicy:
TableName: !Ref ProductTable
Events:
GetResource:
Type: HttpApi
Properties:
Path: /products/{productId}
Method: get
ProductTable:
Type: AWS::Serverless::SimpleTable
Amazon API Gateway
Lambda function
Table
Role
===
To become this
Allowing this
AWS Cloud
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks
애플리케이션의
약 90%는
SAM으로 관리 및
배포돼요
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks
Auth0은 별도로
배포돼요
Amplify 앱이
생성돼요
클라이언트
코드는 별도로
배포돼요
© 2020, Amazon Web Services, Inc. or its Affiliates.
코드 리포지토리
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CodeCommit
• 안전한 Git 기반 저장소를
호스팅하는 완전 관리형 소스 제어
서비스
• 팀이 안전하고 확장성이 뛰어난
에코 시스템에서 코드에 대해
협업할 수 있도록 도와줌
• 전송 중 및 저장중에 파일을
자동으로 암호화
• AWS Identity and Access
Management (IAM)와 통합
https://aws.amazon.com/codecommit/
© 2020, Amazon Web Services, Inc. or its Affiliates.
서드파티 코드 리포지토리
Integrates with CodeBuild and
CodePipeline
Integrates with CodeBuild
private repo
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS Amplify Console
클라이언트 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
Amplify Console
• Lambda@Edge, Amazon S3,
Amazon CloudFront 기반
• 통합 CI/CD
• 빌드 구성
• 기능 브랜치 배포
• 글로벌 가용성 (CDN)
• 기본 암호 보호
AWS Lambda Amazon S3Amazon
CloudFront
© 2020, Amazon Web Services, Inc. or its Affiliates.
Amplify Console buildspec.yaml
version: 1.0
env:
variables:
key: value
backend:
phases:
preBuild:
build:
postBuild:
frontend:
phases:
preBuild:
commands:
- *enter command*
build:
artifacts:
files:
- location
discard-paths: yes
baseDirectory:
cache:
customHeaders:
test:
phases:
preTest:
commands:
- *enter command*
test:
commands:
- *enter command*
postTest:
commands:
- *enter command*
artifacts:
files:
- location
- location
configFilePath: *location*
baseDirectory: *location*
© 2020, Amazon Web Services, Inc. or its Affiliates.
Amplify Console buildspec.yaml
version: 1.0
env:
variables:
key: value
backend:
phases:
preBuild:
build:
postBuild:
frontend:
phases:
preBuild:
commands:
- *enter command*
build:
artifacts:
files:
- location
discard-paths: yes
baseDirectory:
cache:
customHeaders:
test:
phases:
preTest:
commands:
- *enter command*
test:
commands:
- *enter command*
postTest:
commands:
- *enter command*
artifacts:
files:
- location
- location
configFilePath: *location*
baseDirectory: *location*
Amplify 생성 아키텍처 전용
배포를 위한 클라이언트 아티팩트
준비
엔드-투-엔드 테스트
배포 아티팩트
© 2020, Amazon Web Services, Inc. or its Affiliates.
클라이언트 배포
1. 개발자가 코드를 리포지토리에
커밋
2. Amplify console이 트리거
3. 코드가 준비되고 buildspec 사양에
따라 테스트가 실행
4. 클라리언트가 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
클라이언트 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CodePipeline
오케스트레이터
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CodePipeline
• 빠르고 안정적인 애플리케이션
업데이트를 위한 지속적 전달
서비스
• 소프트웨어 릴리즈 프로세스
모델링 및 시각화
• 코드가 변경될 때 마다 코드를
빌드, 테스트, 배포
• 서드파티 및 AWS와 통합
https://aws.amazon.com/codepipeline/
© 2020, Amazon Web Services, Inc. or its Affiliates.
전체 파이프라인 예제
파이프라인:
• 5 단계
• 코드 아티팩트 빌드
• 3 군데의 “환경”에 배포
• SAM/CloudFormation으로 아티팩트와 다른
AWS 리소스 배포
• 함수 테스트를 위한 Lambda 커스텀 작업
• 서드파티 도구/서비스와 통합
• 프로덕션에 배포하기 전 수동 승인
Dev Account
Staging Account
Production Account
Source
Source
GitHub i
Build
test-build-source
CodeBuild i
Deploy-Testing
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
Run-stubs
AWS Lambda i
Deploy-Staging
Deploy-Prod
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
Post-Deploy-Stack
AWS Lambda i
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
QA-Sign-Off
Manual Approval i
Review
Run-API-test
Runscope i
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CodeBuild
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CodeBuild
• 소스코드를 컴파일, 테스트를 실행,
소프트웨어 패키지를 생성할 수
있는 완전 관리형 빌드 서비스
• 지속적으로 확장하고 여러 빌드를
동시에 처리
• AWS SSM Parameter Store에서
환경 변수를 사용 가능
• VPC 및 로컬에서 실행 가능
• 종속성 캐싱 지원
https://aws.amazon.com/codebuild/
© 2020, Amazon Web Services, Inc. or its Affiliates.
buildspec.yaml 파일
version: 0.2
variables:
parameter-store:
BUCKET_NAME: /CodeBuild/BucketName
phases:
install:
commands:
- npm install
pre_build:
commands:
- eslint *.js
build:
commands:
- sam build
post_build:
commands:
- sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml
artifacts:
type: zip
files:
- out.yaml
© 2020, Amazon Web Services, Inc. or its Affiliates.
buildspec.yaml 파일
version: 0.2
variables:
parameter-store:
BUCKET_NAME: /CodeBuild/BucketName
phases:
install:
commands:
- npm install
pre_build:
commands:
- eslint *.js
build:
commands:
- sam build
post_build:
commands:
- sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml
artifacts:
type: zip
files:
- out.yaml
코드 준비 및 테스트
배포 아티팩트
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks
© 2020, Amazon Web Services, Inc. or its Affiliates.
FreshTracks
코드로 빌드 및 테스트
© 2020, Amazon Web Services, Inc. or its Affiliates.
아티팩트
sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CloudFormation
백엔드 배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS CloudFormation
• 코드형 인프라 (Infrastructure as
code, IaC)
• 클라우드 환경의 모든 인프라
리소스를 설명하고 프로비저닝할
수 있는 공통 언어를 제공
• 수동 작업을 수행하거나 커스텀
스크립트를 작성하지 않고도
인프라와 애플리케이션을 구축하고
재구축
https://aws.amazon.com/cloudformation/
© 2020, Amazon Web Services, Inc. or its Affiliates.
CloudFormation 배포
1 2 3
템플릿이
CloudFormation
으로 제출됨
변경 세트가
생성되고
검증됨
스택을
생성하거나
업데이트하기
위해 변경
세트가 실행됨
© 2020, Amazon Web Services, Inc. or its Affiliates.
테스팅
© 2020, Amazon Web Services, Inc. or its Affiliates.
파이프라인: 테스팅
Source Control Build Staging Production
구성 및/또는 컴파일 테스트 패키지
빌드 단계가 테스트를 위한 보통의
장소에요
© 2020, Amazon Web Services, Inc. or its Affiliates.
파이프라인: 테스팅
Source Control Build Staging Production
구성 및/또는 컴파일 테스트 패키지
테스트 지점
서버리스로 파이프라인의
여러 지점에서 쉽게
테스트를 할 수 있어요
© 2020, Amazon Web Services, Inc. or its Affiliates.
어디서 무엇을 테스트해야할까요
• Pull Request를 통한
코드 검토
• Lint/구문 검사
• 유닛 테스트 통과
• 코드가 성공적으로
컴파일
• 애플리케이션이
성공적으로 배포
• 모의/스텁 통합 테스트
• 애플리케이션이 성공적으로
배포
• 실제 서비스에 대해 테스트
(잠재적으로 프로덕션
종속성에 대해)
• Pre-traffic Lambda 테스트
실행
• 카나리 배포
• 대기 기간 동안 성공적으로
완료
• 100% 배포
• Post-traffic Lambda 테스트
실행
Source
Source
GitHub i
Build
test-build-source
CodeBuild i
Deploy-Testing
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
Run-stubs
AWS Lambda i
Deploy-Staging
Deploy-Prod
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
Post-Deploy-Stack
AWS Lambda i
create-changeset
AWS CloudFormation i
execute-changeset
AWS CloudFormation i
QA-Sign-Off
Manual Approval i
Review
Run-API-test
Runscope i
© 2020, Amazon Web Services, Inc. or its Affiliates.
안전한 배포로 테스팅
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs12.x
AutoPublishAlias: !Ref ENVIRONMENT
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms:
# A list of alarms that you want to monitor
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm
Hooks:
# Validation Lambda functions that are run before & after traffic shifting
PreTraffic: !Ref PreTrafficLambdaFunction
PostTraffic: !Ref PostTrafficLambdaFunction
© 2020, Amazon Web Services, Inc. or its Affiliates.
배포
© 2020, Amazon Web Services, Inc. or its Affiliates.
숫자로 확인
© 2020, Amazon Web Services, Inc. or its Affiliates.
숫자로 확인
Developers
1
개발자가 리포지토리에 코드를 커밋
CodeCommit
© 2020, Amazon Web Services, Inc. or its Affiliates.
숫자로 확인
Developers
1
Amplify Console이 클라이언트를 빌드하고 배포.
CodePipeline이 백엔드 빌드를 트리거
CodeCommit
2
2
Amplify Console
CodePipeline
© 2020, Amazon Web Services, Inc. or its Affiliates.
숫자로 확인
Developers
1
CodeBuild는 배포 용 코드를 빌드, 테스트, 준비
CodeCommit
2
2
Amplify Console
CodePipeline
3
CodeBuild
© 2020, Amazon Web Services, Inc. or its Affiliates.
숫자로 확인
Developers
1
CloudFormation은 트래픽 이동을 위해
CodeDeploy를 사용하여 코드를 배포
CodeCommit
2
2
Amplify Console
CodePipeline
3
CodeBuild
4
CloudFormation
© 2020, Amazon Web Services, Inc. or its Affiliates.
배포된 FreshTracks
© 2020, Amazon Web Services, Inc. or its Affiliates.
CI/CD 파트너
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS 현대적 애플리케이션 개발 관련 자료를 원하시면…
• 현대적 어플리케이션 e-book
• AWS 여정 가속화: 마이그레이션과 현대화
• 서버리스 우선 보고서로의 여정
• AWS 컨테이너를 사용한 현대화
• 그 밖에 동영상, 기술 백서 등
https://tinyurl.com/aws-
modern-apps-KR
지금 방문하세요! »
새롭게 만들어진 기술 백서 및 전자책을 자세히 살펴
현대화 과정을 가속화 시키세요.
© 2020, Amazon Web Services, Inc. or its Affiliates.
현대화 과정을 가속화하세요.
IT 의사 결정자의 90 %가 클라우드 기술역량의 부족1 을 호소하고 있습니다.
클라우드 기술역량의 부족은 현대적 애플리케이션 개발에도 영향을 미칩니다.
AWS 교육 및 자격증과 함께 현대적 애플리케이션 개발 여정을 시작하시기 바랍니다.
현대적 애플리케이션의 설계, 구축 및 관리를 위한 기술역량을 개발하세요.
무료 디지털 교육 수강하기
AWS 무료 디지털 교육을 통해
약간의 시간과 노력으로
실질적인 클라우드 지식을
향상시킬 수 있습니다.
짧게는 10분부터 길게는 몇
시간까지 소요되는 다양한
온디맨드 교육 과정은 서버리스,
컨테이너 및 개발자 도구와 같은
특정 주제에 대한 이해를 넓히는
데 도움이 될 것입니다.
라이브, 실습, 강의실 교육 받기
대면 또는 가상 강의실 교육은
기술 역량을 심화하고자 하는
분들에게 보다 심층적인 교육을
제공합니다. 수업은 해당 분야의
전문가가 이끄는 프레젠테이션,
실습 랩 및 그룹 토론으로
구성되어 있습니다. 교육
과정에는 Developing on AWS 및
Advanced Developing on AWS가
있습니다.
현대적 애플리케이션 기술역량을
빠르게 램프업하기
자율적인 학습을 통해 지식
격차를 메우고 자신의 속도에
맞춰 새로운 주제를 학습할 수
있습니다. 특정한 기술에 대해
보다 깊이 알고자 하는 IT
전문가들을 위한 다양한 백서,
블로그 게시물, 영상, 웨비나,
모범 사례 등 다양한 리소스가
준비되어 있습니다. 더 알아보기.
1 451 Research, DemystifyingCloudTransformation:Where Enterprises Should Start, September 2019.
© 2020, Amazon Web Services, Inc. or its Affiliates.
AWS 앱 현대화 및 개발 특집 온라인 세미나에
참석해주셔서 대단히 감사합니다.
저희가 준비한 내용, 어떻게 보셨나요?
더 나은 세미나를 위하여 설문을 꼭 작성해 주시기 바랍니다.
aws-korea-marketing@amazon.com
twitter.com/AWSKorea
facebook.com/amazonwebservices.ko
youtube.com/user/AWSKorea
slideshare.net/awskorea
twitch.tv/aws
© 2020, Amazon Web Services, Inc. or its Affiliates.
Thank you!

서버리스 애플리케이션 개발 워크플로우 자동화 (CI/CD) - 김필중:: AWS 현대적 애플리케이션 개발

  • 1.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 김필중 Developer Specialist Solutions Architect, Amazon Web Services 서버리스 애플리케이션 개발 워크플로 자동화 (CI/CD)
  • 2.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 강연 중 질문하는 방법 오른쪽의 “Questions/질문” 창에 질문을 남겨주세요. 본인만 답변을 받고 싶으신 경우, (비공개)라고 하고 질문해 주시면 됩니다. 본 컨텐츠는 고객의 편의를 위해 AWS 서비스 설명을 위해 온라인 세미나용으로 별도로 제작, 제공된 것입니다. 만약 AWS 사이트와 컨텐츠 상에서 차이나 불일치가 있을 경우, AWS 사이트(aws.amazon.com)가 우선합니다. 또한 AWS 사이트 상에서 한글 번역문과 영어 원문에 차이나 불일치가 있을 경우(번역의 지체로 인한 경우 등 포함), 영어 원문이 우선합니다. AWS는 본 컨텐츠에 포함되거나 컨텐츠를 통하여 고객에게 제공된 일체의 정보, 콘텐츠, 자료, 제품(소프트웨어 포함) 또는 서비스를 이용함으로 인하여 발생하는 여하한 종류의 손해에 대하여 어떠한 책임도 지지 아니하며, 이는 직접 손해, 간접 손해, 부수적 손해, 징벌적 손해 및 결과적 손해를 포함하되 이에 한정되지 아니합니다. 고지 사항(Disclaimer)
  • 3.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Agenda • CI/CD가 무엇인가요? • 도구 • 테스팅 • 모범 사례
  • 4.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. CI/CD가 무엇인가요?
  • 5.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. CI/CD란 무엇인가요? CI: Continuous Integration  지속적 통합 CD: Continuous Delivery  지속적 전달 CD: Continuous Deployment  지속적 배포
  • 6.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 파이프라인 Source Control Build Staging Production 개발자 버전 및 코드 변경 커밋 빌드 작업 및 유닛 테스트 테스트 환경에 배포 프로덕션 환경에 배포
  • 7.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 지속적 통합 (CI) automated 파이프라인: 지속적 통합 (CI) Source Control Build Staging Production
  • 8.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 지속적 통합 (CI) automated 파이프라인: 지속적 전달 (CD) Source Control Build Staging Production 지속적 전달 (CD) 배포 승인 automated manual
  • 9.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 지속적 통합 (CI) automated 파이프라인: 지속적 배포 (CD) Source Control Build Staging Production 지속적 전달 (CD) 배포 승인 automated 지속적 배포 (CD) 배포 자동화 automated
  • 10.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 아키텍처
  • 11.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 아키텍처
  • 12.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 폴더 구조 클라이언트:Vuejs 애플리케이션 백엔드: 서버리스
  • 13.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 폴더 구조 클라이언트:Vuejs 애플리케이션 백엔드: 서버리스 필요한 경우 클라이언트를 별도의 리포지토리로 쉽게 분리할 수 있어요
  • 14.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 도구
  • 15.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Serverless Application Model SAM
  • 16.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. SAM은 2 부분으로 나뉘어요
  • 17.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. SAM은 2 부분으로 나뉘어요 SAM templates SAM CLI 약식 구문을 사용하여 리소스 및 이벤트 소스 매핑을 표현하며 서버리스 애플리케이션을 위한 코드형 인프라 (IaC)를 제공해요 서버리스 애플리케이션을 위한 로컬 개발, 디버깅, 빌드, 패키징, 배포를 위한 도구를 제공해요 https://aws.amazon.com/serverless/sam/
  • 18.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. SAM 템플릿 AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetProductsFunction: Type: AWS::Serverless::Function Properties: Handler: index.getProducts Runtime: nodejs12.x CodeUri: src/ Policies: - DynamoDBReadPolicy: TableName: !Ref ProductTable Events: GetResource: Type: HttpApi Properties: Path: /products/{productId} Method: get ProductTable: Type: AWS::Serverless::SimpleTable 단 20줄로 생성하는 리소스: • Lambda 함수 • IAM 역할 • API Gateway • DynamoDB 테이블
  • 19.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. SAM 템플릿 AWSTemplateFormatVersion: '2010-09-09’ Transform: AWS::Serverless-2016-10-31 Resources: GetProductsFunction: Type: AWS::Serverless::Function Properties: Handler: index.getProducts Runtime: nodejs12.x CodeUri: src/ Policies: - DynamoDBReadPolicy: TableName: !Ref ProductTable Events: GetResource: Type: HttpApi Properties: Path: /products/{productId} Method: get ProductTable: Type: AWS::Serverless::SimpleTable Amazon API Gateway Lambda function Table Role === To become this Allowing this AWS Cloud
  • 20.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 애플리케이션의 약 90%는 SAM으로 관리 및 배포돼요
  • 21.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks Auth0은 별도로 배포돼요 Amplify 앱이 생성돼요 클라이언트 코드는 별도로 배포돼요
  • 22.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 코드 리포지토리
  • 23.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CodeCommit • 안전한 Git 기반 저장소를 호스팅하는 완전 관리형 소스 제어 서비스 • 팀이 안전하고 확장성이 뛰어난 에코 시스템에서 코드에 대해 협업할 수 있도록 도와줌 • 전송 중 및 저장중에 파일을 자동으로 암호화 • AWS Identity and Access Management (IAM)와 통합 https://aws.amazon.com/codecommit/
  • 24.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 서드파티 코드 리포지토리 Integrates with CodeBuild and CodePipeline Integrates with CodeBuild private repo
  • 25.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS Amplify Console 클라이언트 배포
  • 26.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Amplify Console • Lambda@Edge, Amazon S3, Amazon CloudFront 기반 • 통합 CI/CD • 빌드 구성 • 기능 브랜치 배포 • 글로벌 가용성 (CDN) • 기본 암호 보호 AWS Lambda Amazon S3Amazon CloudFront
  • 27.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Amplify Console buildspec.yaml version: 1.0 env: variables: key: value backend: phases: preBuild: build: postBuild: frontend: phases: preBuild: commands: - *enter command* build: artifacts: files: - location discard-paths: yes baseDirectory: cache: customHeaders: test: phases: preTest: commands: - *enter command* test: commands: - *enter command* postTest: commands: - *enter command* artifacts: files: - location - location configFilePath: *location* baseDirectory: *location*
  • 28.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Amplify Console buildspec.yaml version: 1.0 env: variables: key: value backend: phases: preBuild: build: postBuild: frontend: phases: preBuild: commands: - *enter command* build: artifacts: files: - location discard-paths: yes baseDirectory: cache: customHeaders: test: phases: preTest: commands: - *enter command* test: commands: - *enter command* postTest: commands: - *enter command* artifacts: files: - location - location configFilePath: *location* baseDirectory: *location* Amplify 생성 아키텍처 전용 배포를 위한 클라이언트 아티팩트 준비 엔드-투-엔드 테스트 배포 아티팩트
  • 29.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 클라이언트 배포 1. 개발자가 코드를 리포지토리에 커밋 2. Amplify console이 트리거 3. 코드가 준비되고 buildspec 사양에 따라 테스트가 실행 4. 클라리언트가 배포
  • 30.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 클라이언트 배포
  • 31.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CodePipeline 오케스트레이터
  • 32.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CodePipeline • 빠르고 안정적인 애플리케이션 업데이트를 위한 지속적 전달 서비스 • 소프트웨어 릴리즈 프로세스 모델링 및 시각화 • 코드가 변경될 때 마다 코드를 빌드, 테스트, 배포 • 서드파티 및 AWS와 통합 https://aws.amazon.com/codepipeline/
  • 33.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 전체 파이프라인 예제 파이프라인: • 5 단계 • 코드 아티팩트 빌드 • 3 군데의 “환경”에 배포 • SAM/CloudFormation으로 아티팩트와 다른 AWS 리소스 배포 • 함수 테스트를 위한 Lambda 커스텀 작업 • 서드파티 도구/서비스와 통합 • 프로덕션에 배포하기 전 수동 승인 Dev Account Staging Account Production Account Source Source GitHub i Build test-build-source CodeBuild i Deploy-Testing create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i Run-stubs AWS Lambda i Deploy-Staging Deploy-Prod create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i Post-Deploy-Stack AWS Lambda i create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i QA-Sign-Off Manual Approval i Review Run-API-test Runscope i
  • 34.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CodeBuild
  • 35.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CodeBuild • 소스코드를 컴파일, 테스트를 실행, 소프트웨어 패키지를 생성할 수 있는 완전 관리형 빌드 서비스 • 지속적으로 확장하고 여러 빌드를 동시에 처리 • AWS SSM Parameter Store에서 환경 변수를 사용 가능 • VPC 및 로컬에서 실행 가능 • 종속성 캐싱 지원 https://aws.amazon.com/codebuild/
  • 36.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. buildspec.yaml 파일 version: 0.2 variables: parameter-store: BUCKET_NAME: /CodeBuild/BucketName phases: install: commands: - npm install pre_build: commands: - eslint *.js build: commands: - sam build post_build: commands: - sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml artifacts: type: zip files: - out.yaml
  • 37.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. buildspec.yaml 파일 version: 0.2 variables: parameter-store: BUCKET_NAME: /CodeBuild/BucketName phases: install: commands: - npm install pre_build: commands: - eslint *.js build: commands: - sam build post_build: commands: - sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml artifacts: type: zip files: - out.yaml 코드 준비 및 테스트 배포 아티팩트
  • 38.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks
  • 39.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. FreshTracks 코드로 빌드 및 테스트
  • 40.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 아티팩트 sam package –template-file template.yaml –s3-bucket $BUCKET_NAME –output-template out.yaml
  • 41.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CloudFormation 백엔드 배포
  • 42.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS CloudFormation • 코드형 인프라 (Infrastructure as code, IaC) • 클라우드 환경의 모든 인프라 리소스를 설명하고 프로비저닝할 수 있는 공통 언어를 제공 • 수동 작업을 수행하거나 커스텀 스크립트를 작성하지 않고도 인프라와 애플리케이션을 구축하고 재구축 https://aws.amazon.com/cloudformation/
  • 43.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. CloudFormation 배포 1 2 3 템플릿이 CloudFormation 으로 제출됨 변경 세트가 생성되고 검증됨 스택을 생성하거나 업데이트하기 위해 변경 세트가 실행됨
  • 44.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 테스팅
  • 45.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 파이프라인: 테스팅 Source Control Build Staging Production 구성 및/또는 컴파일 테스트 패키지 빌드 단계가 테스트를 위한 보통의 장소에요
  • 46.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 파이프라인: 테스팅 Source Control Build Staging Production 구성 및/또는 컴파일 테스트 패키지 테스트 지점 서버리스로 파이프라인의 여러 지점에서 쉽게 테스트를 할 수 있어요
  • 47.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 어디서 무엇을 테스트해야할까요 • Pull Request를 통한 코드 검토 • Lint/구문 검사 • 유닛 테스트 통과 • 코드가 성공적으로 컴파일 • 애플리케이션이 성공적으로 배포 • 모의/스텁 통합 테스트 • 애플리케이션이 성공적으로 배포 • 실제 서비스에 대해 테스트 (잠재적으로 프로덕션 종속성에 대해) • Pre-traffic Lambda 테스트 실행 • 카나리 배포 • 대기 기간 동안 성공적으로 완료 • 100% 배포 • Post-traffic Lambda 테스트 실행 Source Source GitHub i Build test-build-source CodeBuild i Deploy-Testing create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i Run-stubs AWS Lambda i Deploy-Staging Deploy-Prod create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i Post-Deploy-Stack AWS Lambda i create-changeset AWS CloudFormation i execute-changeset AWS CloudFormation i QA-Sign-Off Manual Approval i Review Run-API-test Runscope i
  • 48.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 안전한 배포로 테스팅 MyLambdaFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs12.x AutoPublishAlias: !Ref ENVIRONMENT DeploymentPreference: Type: Linear10PercentEvery10Minutes Alarms: # A list of alarms that you want to monitor - !Ref AliasErrorMetricGreaterThanZeroAlarm - !Ref LatestVersionErrorMetricGreaterThanZeroAlarm Hooks: # Validation Lambda functions that are run before & after traffic shifting PreTraffic: !Ref PreTrafficLambdaFunction PostTraffic: !Ref PostTrafficLambdaFunction
  • 49.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 배포
  • 50.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 숫자로 확인
  • 51.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 숫자로 확인 Developers 1 개발자가 리포지토리에 코드를 커밋 CodeCommit
  • 52.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 숫자로 확인 Developers 1 Amplify Console이 클라이언트를 빌드하고 배포. CodePipeline이 백엔드 빌드를 트리거 CodeCommit 2 2 Amplify Console CodePipeline
  • 53.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 숫자로 확인 Developers 1 CodeBuild는 배포 용 코드를 빌드, 테스트, 준비 CodeCommit 2 2 Amplify Console CodePipeline 3 CodeBuild
  • 54.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 숫자로 확인 Developers 1 CloudFormation은 트래픽 이동을 위해 CodeDeploy를 사용하여 코드를 배포 CodeCommit 2 2 Amplify Console CodePipeline 3 CodeBuild 4 CloudFormation
  • 55.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 배포된 FreshTracks
  • 56.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. CI/CD 파트너
  • 57.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS 현대적 애플리케이션 개발 관련 자료를 원하시면… • 현대적 어플리케이션 e-book • AWS 여정 가속화: 마이그레이션과 현대화 • 서버리스 우선 보고서로의 여정 • AWS 컨테이너를 사용한 현대화 • 그 밖에 동영상, 기술 백서 등 https://tinyurl.com/aws- modern-apps-KR 지금 방문하세요! » 새롭게 만들어진 기술 백서 및 전자책을 자세히 살펴 현대화 과정을 가속화 시키세요.
  • 58.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. 현대화 과정을 가속화하세요. IT 의사 결정자의 90 %가 클라우드 기술역량의 부족1 을 호소하고 있습니다. 클라우드 기술역량의 부족은 현대적 애플리케이션 개발에도 영향을 미칩니다. AWS 교육 및 자격증과 함께 현대적 애플리케이션 개발 여정을 시작하시기 바랍니다. 현대적 애플리케이션의 설계, 구축 및 관리를 위한 기술역량을 개발하세요. 무료 디지털 교육 수강하기 AWS 무료 디지털 교육을 통해 약간의 시간과 노력으로 실질적인 클라우드 지식을 향상시킬 수 있습니다. 짧게는 10분부터 길게는 몇 시간까지 소요되는 다양한 온디맨드 교육 과정은 서버리스, 컨테이너 및 개발자 도구와 같은 특정 주제에 대한 이해를 넓히는 데 도움이 될 것입니다. 라이브, 실습, 강의실 교육 받기 대면 또는 가상 강의실 교육은 기술 역량을 심화하고자 하는 분들에게 보다 심층적인 교육을 제공합니다. 수업은 해당 분야의 전문가가 이끄는 프레젠테이션, 실습 랩 및 그룹 토론으로 구성되어 있습니다. 교육 과정에는 Developing on AWS 및 Advanced Developing on AWS가 있습니다. 현대적 애플리케이션 기술역량을 빠르게 램프업하기 자율적인 학습을 통해 지식 격차를 메우고 자신의 속도에 맞춰 새로운 주제를 학습할 수 있습니다. 특정한 기술에 대해 보다 깊이 알고자 하는 IT 전문가들을 위한 다양한 백서, 블로그 게시물, 영상, 웨비나, 모범 사례 등 다양한 리소스가 준비되어 있습니다. 더 알아보기. 1 451 Research, DemystifyingCloudTransformation:Where Enterprises Should Start, September 2019.
  • 59.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. AWS 앱 현대화 및 개발 특집 온라인 세미나에 참석해주셔서 대단히 감사합니다. 저희가 준비한 내용, 어떻게 보셨나요? 더 나은 세미나를 위하여 설문을 꼭 작성해 주시기 바랍니다. aws-korea-marketing@amazon.com twitter.com/AWSKorea facebook.com/amazonwebservices.ko youtube.com/user/AWSKorea slideshare.net/awskorea twitch.tv/aws
  • 60.
    © 2020, AmazonWeb Services, Inc. or its Affiliates. Thank you!

Editor's Notes

  • #6 Definition: Automated process of integrating, testing, packaging, delivering, and possibly deploying code. Delivery: automated pipeline to make code ready to deploy Deployment: automated pipeline that deploys
  • #37 This will install awscli and aws-sam-cli every time This can be avoided by building a container with these libraries already installed
  • #38 This will install awscli and aws-sam-cli every time This can be avoided by building a container with these libraries already installed
  • #58 Suggested speaker notes: We hope you found this session helpful. If you would like to learn more building modern applications, visit our resource hub to get access to the newly created resources. Innovate and scale with increased agility and lower cost on AWS today!
  • #60 Suggested speaker notes: Your modern application development journey starts with AWS Training and Certification. Visit the link to find out the courses available to build your cloud skills and innovate faster using AWS.