SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
1.
Amazon Elasticsearch Service
소개 및 활용 방법
윤석찬
@channyun
AWS Korea 테크에반젤리스트
2.
목차
• Elasticsearch 및 Amazon Elasticsearch 서비스 소개
• Amazon ES 활용하기
1. Amazon ES 도메인 설정 (데모: ES 도메인 생성)
2. Amazon ES 확장성
3. 안전한 도메인 접근 제어
4. 분석 데이터 로딩하기 (데모: VPC Flow Log 분석)
5. Amazon ES 관리 기능
• Amazon ES 시작하기
3.
US-WEST (Oregon)
EU (Ireland)
ASIA PACIFIC
(Tokyo)
US-WEST (N. California)
SOUTH
AMERICA (Sao
Paulo)
US-EAST (N. Virginia)
AWS GOVCLOUD (US)
ASIA PACIFIC
(Sydney)
ASIA PACIFIC
(Singapore)
CHINA (Beijing)
32 AZ
Availability Zones
EU (Frankfurt)
ASIA PACIFIC
(Seoul)
12 Regions
오하이오,중국,인도,영국, 캐나다 (2016-17)
54 Edges
2016년 1월 7일 - 서울 리전 개시!
4.
2016년 1월 7일 - 서울 리전 개시!
* 서울 리전 이용가능 서비스 (2016. 1. 7 현재)
Compute
Elastic
Beanstalk
EC2
Elastic
Load
Balancing
Networking
VPC
Direct
Connect
Route 53
Analytics
EMR Kinesis
Management Tools
CloudWatch
Cloud
Formation
CloudTrail
Security & Identity
Identity &
Access
Management
Trusted
Advisor
Key
Management
Service
Storage & CDN
S3 CloudFront Glacier
Database
RDS DynamoDB ElastiCache RedShift
App Services
SQS SWF SNS
The Next Wave
6.
Amazon Elasticsearch
• 실시간 분석 + 모니터링
ü ELK 스택 관리형 서비스
ü 대용량 데이터 볼륨 지원
ü 저렴한 실시간 분석 및 시각화
두 가지 클라우드 검색 서비스?
Amazon CloudSearch
• 자동화된 검색 서비스
ü 키워드 텍스트 검색에 효과적
ü 간단한 API로 동작
ü 간편한 스키마 변경
7.
Elasticsearch 소개
강력한 실시간 분산 기반 검색 및 분석 엔진:
• 2010년에 처음 출시되어 인기 오픈 소스 검색 및 분석 엔진으로 성장
• Apache Lucene 기반으로 수백대까지 분산 클러스터를 구성 가능
• 유연한 스키마를 가진 JSON 데이터 스토어
• 개발자 친화적 RESTful API 제공
8.
Elasticsearch의 강점
로그 수집기인 Logstash와 시각화 도구인 Kibana를 연결하여,
ELK Stack을 통해 강력한 실시간 데이터 분석이 가능!
9.
Elasticsearch를 사용하는 AWS 고객
• 실시간 고객 행동 분석 및 이해
• 모바일 유저 및 애플리케이션 로그 분석
• 웹 로그 분석
• 소셜 미디어/스트리밍 분석
• 일반적인 웹 사이트 검색
10.
Elasticsearch에 대한 고객의 소리
“Elasticsearch는 매우 편리하고 빠르게 빅데이터 분석용
애플리케이션을 만들 수 있는 ELK 스택을 제공합니다. 다만, 서버
클러스터운영 및 확장성에 대한 관리 부담 때문에 Elasticsearch
API에 직접 접속 만으로 유연하게 서비스를 빠르게 만들 수 있는
Amazon Elasticsearch Services를 선택했습니다."
Sean Curtis,
SVP Engineering at Major League
Baseball Advanced Engineering
11.
Amazon Elasticsearch Service란?
Amazon Elasticsearch Service는 ES
클러스터를 클라우드에 설치, 운영 및 확장을
용이하고 하는 관리형 서비스로 AWS 기타
서비스와 연계하기에 편리합니다!
12.
Amazon ES의 주요 이점
손쉽게 클러스터
설정 및 관리 가능ELK 스택 지원
AWS IAM을 통한
사용자 인증 및
CloudWatch를
통한 모니터링
다른 AWS
자원과 손쉽게
통합 가능
23.
Amazon ES 도메인 내부 용어
Shard 1 Shard 2
{
{
Id Id Id . . .
Documents
{
Index
• Document: 검색 단위 문서
• ID: 각 문서에 대한 인식자
• Shard: 인덱스의 부분을
가지는 Lucene 인스턴스
• Index: 검색 데이터 집합
24.
Amazon ES 도메인 내 클러스터 구성
• Index 1
• Shard 1
• Shard 2
• Shard 3
• Index 2
• Shard 1
• Shard 2
• Shard 3
Amazon ES cluster
1
2
3
1
2
3
1
2
3
1
2
3
Primary Replica
1
3
3
1
Instance 1
2
1
1
2
Instance 2
3
2
2
3
Instance 3
25.
Amazon ES 인스턴스 타입
Instance 타입 업무 영역 예제 타입 가격 구조
T2 개발 및 테스트에 용이 Busting 모델
t2.micro.elasticsearch는 프리티어
제공 (매월 750시간)
M4 쓰기 및 읽기 볼륨이 비슷할 때
(블록 스토리지가 5TB까지)
m4.large.elasticsearch
(2vcpu/8GB/EBS 전용)
=0.243/시간당
R3 쿼리 요청이 많은 읽기 중심 서비스 r3.large.elasticsearch
(2vcpu/15GB/32GBSSD)
= 0.294/시간당 * 동경리전 기준
I2 16TB까지 SSD 스토리지 제공 i2.xlarge.elasticsearch
(4vcpu/30.5GB/800GBSSD)
= 1.401/시간당
https://aws.amazon.com/ko/elasticsearch-service/pricing/ 서울리전 기준
27.
안전한 도메인 접근 제어 방법
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam:123456789012:user/susan"
},
"Action": [ "es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost",
"es:CreateElasticsearchDomain",
"es:ListDomainNames" ],
"Resource":
"arn:aws:es:ap-northeast-2:###:domain/logs/<index>/*"
} ] }
28.
안전한 도메인 접근 제어 방법
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam:123456789012:user/susan"
},
"Action": [ "es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost",
"es:CreateElasticsearchDomain",
"es:ListDomainNames" ],
"Resource":
"arn:aws:es:ap-northeast-2:###:domain/logs/<index>/*"
} ] }
사용자 기반 권한 관리
29.
안전한 도메인 접근 제어 방법
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam:123456789012:user/susan"
},
"Action": [ "es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost",
"es:CreateElasticsearchDomain",
"es:ListDomainNames" ],
"Resource":
"arn:aws:es:ap-northeast-2:###:domain/logs/<index>/*"
} ] }
HTTP 메소드에 따른 허용/거부 및 정책 설정
30.
안전한 도메인 접근 제어 방법
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam:123456789012:user/susan"
},
"Action": [ "es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost",
"es:CreateElasticsearchDomain",
"es:ListDomainNames" ],
"Resource":
"arn:aws:es:ap-northeast-2:###:domain/logs/<index>/*"
} ] }
인덱스에 대한 세부적인 권한 관리
31.
안전한 도메인 접근 제어 방법
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [ "es:ESHttpGet", "es:ESHttpPut", "es:ESHttpPost",
"es:CreateElasticsearchDomain",
"es:ListDomainNames" ],
"Resource":
"arn:aws:es:ap-northeast-2:###:domain/logs/<index>/*"
"Condition":
"IpAddress": {
"aws:SourceIp": [ "xx.xx.xx.xx/yy" ]
} } ] }
IP 주소 기반한 접근 제어 가능
36.
3. AWS Lambda를 통한 데이터 전달
Amazon
Lambda
Amazon
Elasticsearch
Service
Amazon S3
DynamoDB
Amazon
Kinesis
37.
예제. 간단한 Lambda 함수
var AWS = require('aws-sdk');
var creds = new AWS.EnvironmentCredentials('AWS');
function postDocumentToES(doc, context) {
var req = new AWS.HttpRequest(endpoint);
var signer = new AWS.Signers.V4(req, 'es');
signer.addAuthorization(creds, new Date());
var send = new AWS.NodeHttpClient();
send.handleRequest(req, null, function(httpResp)...
https://github.com/awslabs/amazon-elasticsearch-lambda-samples
38.
Arrow direction indicates general direction of data flow
EC2 instances
Logstash
cluster on EC2
DynamoDB
Tables
RDS Databases
(via JDBC)
SQS
Queues
Kinesis
Streams
Amazon
Elasticsearch
domain
CWL Logs agent
VPC
Flow Logs
CloudTrail
Audit Logs
S3
Access
Logs
ELB
Access
Logs
CloudFront
Access
Logs
SNS
Notifications
DynamoDB
Streams
SES
Inbound
Email
Cognito
Events
Kinesis
Streams
CloudWatch
Events &
Alarms
Config
Rules
Lambda
Filebeat agent
REST API client
S3
CloudWatch
Logs
39.
데모.
Amazon ES기반
CloudWatch 로그 분석
CloudWatch Amazon
Elasticsearch
Service
40.
VPC Flow Logs 분석하기
• 특정 VPC 그룹에 대한 네트워크 로그 수집 및 스트리밍 가능
• 소스 / 목적지 IP 주소, 포트, 프로토콜 번호 패킷 바이트 모니터링 간격 시간, 그리고
이에 따른 액션(ACCEPT 또는 REJECT) 정보 포함
43.
Amazon ES 모니터링 및 스냅샷 백업
• CloudWatch 및 CloudTrail을 통한 모니터링
44.
모니터링 필수 지표
• FreeStorageSpace – 클러스터의 남은 용량 알람 설정
• CPUUtilization – 확장을 고려하여 80% CPU 시 알람 설정
• ClusterStatus.yellow – 추가 노드의 리플리케이션이 필요할 때
• JVMMemoryPressure – 인스턴스 타입 선정 및 자원 확인
• MasterCPUUtilization – 마스터 노드에 대한 모니터링
45.
Amazon ES 자동 스냅샷 및 백업
• 추가 비용 없음
• 무료로 14일까지 저장 가능
47.
맺으면서
1. Elasticsearch는 검색, 로그 분석 및 시각화를 위한 일체형 오픈
소스 분석 엔진으로 실시간 데이터 폭증에도 유리한 도구입니다.
2. Amazon Elasticsearch Service는 ES 클러스터를 손쉽게 만들고
관리하는데 용이합니다.
3. 여러분이 Amazon EC2에서 ES를 사용하고 계시다면, 자원
비용외 추가 비용 없이 관리 서비스를 사용해 보실 수 있습니다.
4. 만약 기존 데이터 센터에 계시다면, 확장성 고려 및 ES 관리
비용을 줄여 보세요!
48.
지금 시작하기
1. 아마존 웹 서비스(AWS) 가입
• http://aws.amazon.com/ko
2. Amazon ES 서비스 시작하기
• 서비스 소개: https://aws.amazon.com/ko/elasticsearch-service/
• FAQ: https://aws.amazon.com/ko/elasticsearch-service/faqs/
3. Amazon ES 프리티어
• 750시간의 t2.micro.elasticsearch 인스턴스와 10GB의 Amazon
EBS 스토리지 옵션
※ t2.micro 인스턴스 10대 x 월 75시간 무료 사용 가능
49.
AWS 코리아 소통 채널
• 공식 블로그: http://aws.amazon.com/ko/blogs/korea
• 공식 소셜 미디어
• 한국 사용자 모임: http://awskr.org
@AWSKorea
AmazonWebServices.ko
AWSKorea
AWSKorea
50.
질문을 남겨주세요
강연에 대한 설문조사
발표자료 / 녹화영상
http://bit.ly/awskr-webinar