More Related Content Similar to AWS Fault Injection Simulator를 통한 실전 카오스 엔지니어링 - 윤석찬 AWS 수석 테크에반젤리스트 / 김신 SW엔지니어, 비바리퍼블리카 :: AWS Summit Seoul 2021 (20) More from Amazon Web Services Korea (20) AWS Fault Injection Simulator를 통한 실전 카오스 엔지니어링 - 윤석찬 AWS 수석 테크에반젤리스트 / 김신 SW엔지니어, 비바리퍼블리카 :: AWS Summit Seoul 20211. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
K O R E A | M A Y 1 1 - 1 2 , 2 0 2 1
2. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Fault Injection Simulator를 통한
실전 카오스 엔지니어링
윤석찬
수석 테크에반젤리스트
AWS
김신
SW엔지니어,
비바리퍼블리카
3. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 분산 시스템의 문제점
• 카오스 엔지니어링 소개 및 제약점
• AWS Fault Injection Simulator (FIS)
• 주요 기능 및 활용 방법
목차
4. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed systems are complex
Message
Message
Reply
Reply
Network Server
Client
Message
Message
Reply
Reply
Network
Microservice
참고 – 분산 시스템의 도전 과제 - Amazon Builders Library
https://aws.amazon.com/ko/builders-library/challenges-with-distributed-systems
Microservice
5. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
전통적인 테스트의 어려움
모르는 것은 테스트할 수 없다!
구성 요소의 단위 테스트
기능이 기대치를 충족하는지 확인하기
위해 격리 테스트
통합 기능 테스트
예상 결과를 보장하기 위해 각 실행
경로 테스트
6. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
close failed in file object destructor:
IOError: No space left on device
미지의 문제에 대한 문제
logfile
ROTATE
logfile.0
ROTATE
logfile.1
ROTATE
logfile.2
ROTATE
logfile.n
ROTATE
7. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Chaos Engineering?
실 서비스 장애 주입(Failure Injection)
드러나지 않은 문제 발견
통제된 환경에서 실험
복원성 높은 아키텍처 신뢰성 확보
(Monitoring, observability, and alarm…)
8. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
카오스 엔지니어링 시작과 현재 상태
Amazon 2006
GameDay: Creating
Resiliency Through
Destruction
Jesse Robbins
Netflix 2011
Chaos Monkeys:
Test the resilience of
its Infrastructure
Simian Army – Open Source
Chaos Toolkit
Netflix, Dropbox, Uber, Twilio,
Digitla Ocean, LinkedIn, NAB…
참고 – Chaos Engineering Mind Map
http://bit.ly/chaos-engineering-mindmap
9. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
카오스 엔지니어링 과정
비지니스에 영향을
주는 통계치 사용
Amazon: 100 ms of extra
load time caused a 1% drop
in sales (Greg Linden).
• 404 혹은 503 상태인가?
• 300ms까지 지연중인가?
• 서버에 접속할 수 있는가?
What if?
• 실험할 가설 선택
• 실험 범위 측정 지표 정하기
• 실험 계획 알리기 및 실행
통제된 환경에서
실험 구성
• 문제 인지 및 알림 시간?
• 자동 롤백 시작 시점?
• 전체 복구 및 안정화 시간?
실험 평가 및
오류 확인
• 문제점 해부(PostMortems)
• 오류 해결(Correction of
Errors)
재발 방지
대책 수립
http://channy.creation.net/blog/netflix-principles-of-chaos-engineering
참고 – 카오스 엔지니어링 원칙 Principlas of Chaos Engineering
10. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
카오스 엔지니어링 도입의 어려움
실험 안정성
확보가 어려움
다양한 도구와
기존 스크립트
결합
1
에이전트 또는
라이브러리 설치
필요
3
2
"실제"이벤트를
재현하기 어려움
(한 번에 다중 장애)
4
11. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
안전하게 실험 가능
실제 장애 사례 기반
손쉽게 장애 주입
AWS Fault Injection Simulator
완전 관리형 카오스 엔지니어링 서비스
12. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
13. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
직접 스크립트를 제작/에이전트 설치 불필요
AWS 관리 콘솔 및 AWS CLI만 이용
기존 실험 템플릿 기반 몇 분만에 시작 가능
다른 개발자들과 공유 가능
손쉽게 장애 주입
14. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
실제 장애 사례 기반
이벤트 순서 또는 병렬로 실험 실행
시스템의 모든 수준 (호스트, 인프라,
네트워크 등)을 대상
서비스 제어 수준에서 실제 장애 주입
15. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
"자동 정지 조건" 알람 기능
롤백 기능 기본 제공
Amazon CloudWatch와 통합
세분화 된 IAM 제어 가능
안전하게 실험 가능
16. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS FIS 실험 과정
AWS Fault Injection
Simulator
Experiment
template
AWS Command
Line Interface
AWS Management
Console
AWS Identity and
Access Management
FIS safeguards
FIS engine
Compute
Start experiment
Third party
AWS
Amazon
EventBridge
Amazon
CloudWatch
alarms
AWS resources
Databases Networking Storage
Compute
Monitoring
Stop experiment
17. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Experiment
templates
(실험 템플릿)
Experiments
(실험)
Actions
(작업)
Targets
(대상)
AWS FIS 구성 요소
18. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
19. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Actions - 실험 중에 실행되는 오류 주입 내용
aws:<service-name>:<action-type>
작업 내용:
• 장애 유형
• 지속 시간
• 대상 자원
• 다른 작업과 관련된 타이밍
• 롤백 동작 같은 오류 별 매개 변수
Actions (작업)
AWS FIS 구성 요소
20. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Actions (작업)
"actions":{
"StopInstances":{
"actionId":"aws:ec2:stop-instances",
"parameters":{
"start-instances-at-end":"true"
},
"duration":"PT10M",
"targets":{
"Instances":"AllTaggedInstances"
}
},
"TerminateInstances":{
"actionId":"aws:ec2:terminate-instances",
"parameters":{
},
"duration":"PT1M",
"targets":{
"Instances":"RandomInstancesInAZ"
},
"startAfter":[
"StopInstances"
]
}
}
AWS FIS 구성 요소
21. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 인스턴스 재부팅
EC2 인스턴스 중단
EC2 인스턴스 종료
ECS 인스턴스 중단
EKS 노드 중단
API 내부 오류 주입
API 쓰로틀링 생성
API 사용 불가
대기 시간 주입
DB 클러스터 오류
DB 인스턴스 재부팅
SSM 커맨드 명령
22. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Targets (대상)
Targets (대상) - 작업을 수행 할 하나 이상의 AWS 리소스
대상 내용:
• 리소스 유형
• 리소스 IDs, 태그 및 필터
• 선택 모드 (e.g., ALL, RANDOM)
AWS FIS 구성 요소
23. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
"targets":{
"AllTaggedInstances":{
"resourceType":"aws:ec2:instance",
"resourceTags":{
"Purpose":"chaos-ready"
},
"selectionMode":"ALL"
},
"RandomInstancesInAZ":{
"resourceType":"aws:ec2:instance",
"resourceTags":{
"Purpose":"chaos-ready"
},
"filters":[
{
"path":"Placement.AvailabilityZone’,
values: [‘us.east.1a’]
},
{
path: ”state.Name",
"values":['running’]
}
]
}
]
Targets
AWS FIS 구성 요소
24. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Experiment templates 실험 시작을 위한 구성
템플릿 내용:
• Actions (작업)
• Targets (대상)
• Stop condition alarms (알람 조건)
• IAM 역할
• 설명
• 태그
Experiment
templates
(실험 템플릿)
AWS FIS 구성 요소
25. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Experiment
templates
(실험 템플릿)
AWS FIS 구성 요소
{
"tags”: {
"Name": "StopAndRestartRandomeInstance"
},
"description": "Valkyrie Stop and Restart One Random Instance",
"roleArn": "arn:aws:iam::0123456789:role/MyFISExperimentRole”,
"stopConditions": [
{
"source": "aws:cloudwatch:alarm",
"value": " "arn:aws:cloudwatch::alarm:No_Traffic"
}
],
"targets": {
"myInstance": {
"resourceTags": {
”Purpose": "chaos-ready"
},
"resourceType": "aws:ec2:instance",
"selectionMode": ”RANDOM(1)"
}
},
"actions": {
"StopInstances": {
"actionId": "aws:ec2:stop-instances",
"description": "stop the instances",
"duration": "PT2M",
"parameters": {
"start-instances-at-end": "true"
},
"targets": {
"Instances": "myInstance"
}
}
Description
IAM role
Stop conditions
Targets
Actions
Name
26. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
27. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Experiment template A
Stop conditions
Targets
Actions Action 1 Action 2
Amazon
CloudWatch alarm
i-aaaa i-bbbb i-cccc
Specific EC2 instances
Experiment template B
Stop conditions
Targets
Actions
Action 3
Action 1
Action 2
Amazon CloudWatch
alarms
All EC2 instances with
“chaos-ready” tag
AWS FIS 실험 구성하기
28. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Experiments (실험)은 실험 템플릿이 실행된 목록 및 내역
실험 결과에 있는 항목:
• 실험 스냅 샷
• 생성 및 시작 시간
• 상태
• 실행 ID
• 실험 템플릿 ID
• IAM 역할 ARN
Experiments
AWS FIS 구성 요소
29. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
30. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
31. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
카오스 엔지니어링 어떻게 시작할까?
• 서비스 복원성을 증진시키기 위해 기술,
인력 및 프로세스에 대한 주기적인 훈련
• 위험이 없는(risk-free) 게임화 된 환경에서
현실 문제를 해결하기 위한 AWS 솔루션
구현 기술을 테스트할 수 있는 기회
• AWS 담당자를 통해 개최 가능
1) AWS Game Day 활용하기
32. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
카오스 엔지니어링 어떻게 시작할까?
• 카오스 엔지니어링에 대한 다양한
정보를 나누는 공간이 있습니다.
• 온라인 질문 및 답변, 정보 고유, 주기적인
밋업 등을 개최합니다.
2) 커뮤니티 활용하기
https://www.facebook.com/groups/chaosengkorea/
https://www.meetup.com/Korea-Chaos-Engineering-Community/
33. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 복잡한 분산 시스템 환경에서 기존 테스트 뿐만 아니라, 다양한 장애 환경
예측이 필요하며, 이를 위해 카오스 엔지니어링 기법을 사용할 수 있다.
• AWS 내에서 안전한 환경에서 다양한 장애 주입 실험을 위해 AWS Fault
Injection Simulator 서비스를 이용할 수 있다.
• Amazon EC2, ECS, EKS, RDS 서비스 장애 주입 및 API 오류, 단일 서버 장애
등의 다양한 작업과 모니터링, 실험 결과 공유 등이 가능하다.
• JSON/YAML 기반 실험 템플릿과 AWS SSM 커맨드 결합을 통해 더 복잡한
종류의 실험을 설계하고 수용할 수 있다.
• 카오스 기법을 통해 알 수 없었던 장애를 미리 탐지하여, 높은 복원성 및
신뢰성을 가진 서비스를 운영할 수 있다.
마무리
34. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
• 복잡한 분산 시스템 환경에서 기존 테스트 뿐만 아니라, 다양한 장애 환경
예측이 필요하며, 이를 위해 카오스 엔지니어링 기법을 사용할 수 있다.
• AWS 내에서 안전한 환경에서 다양한 장애 주입 실험을 위해 AWS Fault
Injection Simulator 서비스를 이용할 수 있다.
• Amazon EC2, ECS, EKS, RDS 서비스 장애 주입 및 API 오류, 단일 서버 장애
등의 다양한 작업과 모니터링, 실험 결과 공유 등이 가능하다.
• JSON/YAML 기반 실험 템플릿과 AWS SSM 커맨드 결합을 통해 더 복잡한
종류의 실험을 설계하고 수용할 수 있다.
• 카오스 기법을 통해 알 수 없었던 장애를 미리 탐지하여, 높은 복원성 및
신뢰성을 가진 서비스를 운영할 수 있다.
마무리
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
여러분의 소중한 피드백을 기다립니다.
강연 종료 후, 강연 평가에 참여해 주세요!
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
35. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.
감사합니다
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved.