Contenu connexe
Similaire à aws blackbelt amazon elasticsearch service (20)
Plus de Amazon Web Services Japan (20)
aws blackbelt amazon elasticsearch service
- 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アマゾン ウェブ サービス ジャパン株式会社
ソリューションアーキテクト 半場 光晴
2017.12.06
【AWS Black Belt Online Seminar】
Amazon Elasticsearch Service
- 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
自己紹介
• 名前
半場 光晴 (はんば みつはる)
• 所属
アマゾン ウェブ サービス ジャパン
株式会社
技術統括本部
メディア・エンターテインメント ソ
リューション部
ソリューション アーキテクト
• 好きな AWS サービス
Amazon Kinesis、Amazon S3、
Amazon EMR
- 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Black Belt Online Seminar へようこそ!
質問を投げることができます!
Adobe Connect の Q&A ウィンドウから、質問を書き込んでください
(書き込んだ質問は、主催者にしか見えません)
今後のロードマップに関するご質問はお答えできませんのでご了承ください
Twitter へツイートする際はハッシュタグ #awsblackbelt をご利用ください
①Q&Aウィンドウ
右下のフォームに
質問を書き込んで
ください
②吹き出しマークで
送信してください
- 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Black Belt Online Seminar とは
AWSJ の Tech メンバが AWS に関する様々な事を紹介するオンラインセミナーです
【火曜 12:00~13:00】
主に AWS のソリューションや
業界カットでの使いどころなどを紹介
(例:IoT、金融業界向け etc.)
【水曜 18:00~19:00】
主に AWS サービスの紹介や
アップデートの解説
(例:EC2、RDS、Lambda etc.)
※開催曜日と時間帯は変更となる場合がございます。
最新の情報は下記をご確認下さい。
オンラインセミナーのスケジュール & 申し込みサイト
• https://aws.amazon.com/jp/about-aws/events/webinars/
- 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
内容についての注意点
• 本資料では 2017 年 12 月 6 日時点のサービス内容および価格についてご説明しています。
最新の情報は AWS 公式ウェブサイト (http://aws.amazon.com) にてご確認ください
• 資料作成には十分注意しておりますが、資料内の価格と AWS 公式ウェブサイト記載の価格に
相違があった場合、AWS 公式ウェブサイトの価格を優先とさせていただきます
• 価格は税抜表記となっています。日本居住者のお客様が東京リージョンを使用する場合、別途
消費税をご請求させていただきます
• AWS does not offer binding price quotes. AWS pricing is publicly available and is
subject to change in accordance with the AWS Customer Agreement available at
http://aws.amazon.com/agreement/. Any pricing information included in this
document is provided only as an estimate of usage charges for AWS services based
on certain information that you have provided. Monthly charges will be based on
your actual use of AWS services, and may vary from the estimates provided.
- 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon Elasticsearch Service (ES) のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon Elasticsearch Service (ES) のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 分散検索・分析エンジン
• Elasticsearch と Kibana を使用したマネージドサービス
• フル・マネージド - 管理ゼロ
• 高可用性と信頼性
• 他の AWS サービスと緊密に統合
Amazon
Elasticsearch
Service
(Amazon ES)
- 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IT 運用監視 セキュリティ情報や
イベントの管理
アプリケーションの
監視や分析
IoT/TSDB の
監視やデータ分析
アプリケーションの
検索機能
ターゲテイング
広告
Amazon ES の主たるユースケース
- 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ログ分析
デジタルマーケティング、運用インテリジェンス、不正検
出、広告技術、ゲーム、IoT などの幅広いアプリケーショ
ンに対して、Web サイト、モバイルデバイス、サーバー、
センサーなどによって生成された非構造化および半構造化
ログを分析する
フルテキスト検索
テキストマッチング、ファセッティング、フィルタリング、
あいまい検索、自動補完、ハイライトなどの機能をサポート
し、多様なドキュメントセットで豊富な検索とナビゲーショ
ンを提供する
分散検索エンジン
AZ をまたぎ統合されたレプリケー
ションを使用して、数十億のドキュメ
ントを格納および検索できる、使いや
すく高性能な JSON ドキュメント指向
プラットフォームを使用して、アプリ
ケーションに検索の力を与える
リアルタイム
アプリケーション監視
ほぼリアルタイムで分析するために
データをインデックス化し(1秒未
満)、視覚化し、統計的集計を実行し
て根本的な原因を特定し、問題を修正
することによって、顧客対応アプリ
ケーションおよび Web サイト全体に
アクティビティログを捉える
クリックストリーム
分析
デジタルコンテンツのリアルタイムメ
トリクスを提供し、作成者とマーケ
ティング担当者が顧客とつながること
を可能する
数十億の小さなメッセージを
Elasticsearch に流し込み、そこでデー
タを集約、フィルタリング、および処
理してコンテンツパフォーマンスダッ
シュボードを提供する
Amazon ES が力になるもの
- 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Easy to Use
プロダクション対応の Elasticsearch
クラスターを数分でデプロイ
ソフトウェアパッチ、障害からの回復、
バックアップ、監視など、時間のかか
る管理タスクを簡素化
Open
Elasticsearch オープンソース API に
直接アクセスする
すべてのコードとアプリケーションに
対して、オープンソースの
Elasticsearch API と完全に互換性が
ある
Secure
ユーザとエンドポイントのためのきめ
細かなアクセス制御を備えたAWS
Identity and Access Management
(IAM)ポリシーによるセキュアな
Elasticsearchクラスター
セキュリティパッチを自動的に適用し、
Elasticsearch 環境を安全に保つ
Available
2 つの AZ 間でデータを複製するゾー
ンアウェアネスを使用して高可用性を
実現する
クラスターの正常性を監視し、障害の
発生したノードをサービスの中断なし
で自動的に置き換える
AWS Integrated
Amazon Kinesis Firehose、AWS IoT
、Amazon CloudWatch Logs と統合
して、データをシームレスに処理
監査のための AWS CloudTrail、セキ
ュリティのための AWS IAM、クラウ
ドオーケストレーションの AWS
CloudFormation
Scalable
1 つのノードから 100 ノードまでのク
ラスターのスケール
SSD を搭載した EBS ボリュームを含
む様々なインスタンスタイプとスト
レージオプションから選択して、パ
フォーマンス要件を満たすようにクラ
スターを構成する
Amazon ES の利点
- 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES を検索・分析アプリケーションとして利用し
ている、様々な業種のお客様 1/2
Media &
Entertainment
Online
Services
Technology その他にも
- 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES を検索・分析アプリケーションとして利用し
ている、様々な業種のお客様 2/2
https://youtu.be/oJUpUQ_yNVw
https://github.com/ExpediaDotCom/cloudtrail-log-analytics
- 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon ES のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• Elasticsearch の Terminology
• Document
• ユニークな ID を持つ(RDB の
row に近い)
• Field を持つ(RDB の column に
近い)
• 同じ Field の Document の集合体
を Type(RDB の table に近い)
– Elasticsearch 6.x から 9.x にかけて、
段階的に、Type は廃止されていく予定
となっている
https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html
- 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• Elasticsearch の Terminology
• Index
• Document の集合体(RDB の database に近い)
- 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• Elasticsearch の Terminology
• Shard
• Document は Index 内の複数の Shard に分散して配置される
- 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• Elasticsearch の Terminology
• Node
• 物理・仮想インスタンス
• 複数の Shard を保持
• Cluster
• ひとつ、もしくは、複数のノードからなる
• 複数の Index を保持することができる
• Amazon ES における Domain
• Managed Elasticsearch Cluster
• ひとつの domain に、複数の Index や Type を定義できる
- 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
Amazon ES の Deployment
• 各ノード EBS ボリュームはサイズ指定可能(最大 1.5TB)
• ノードの最大数は 100
node node
EBS EBS
node
node
node
Master Nodes Data Nodes
Cluster Node
Shard 3
node
EBS
node
EBS
Shard 1
Shard 4
Shard 2
https://aws.amazon.com/jp/blogs/news/get-started-with-amazon-elasticsearch-service-how-many-shards-do-i-need/
http://aws.typepad.com/sajp/2017/01/get-started-with-amazon-elasticsearch-service-how-many-data-instances-do-i-need.html
- 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
Amazon ES の Deployment
• 各ノード EBS ボリュームはサイズ指定可能(最大 1.5TB)
• ノードの最大数は 100
node node
EBS EBS
node
node
node
Master Nodes Data Nodes
Cluster Node
Shard 3
node
EBS
node
EBS
Shard 1
Shard 4
Shard 2
https://aws.amazon.com/jp/blogs/news/get-started-with-amazon-elasticsearch-service-how-many-shards-do-i-need/
データノードの台数は?
Index ごとの Shard の数は?
http://aws.typepad.com/sajp/2017/01/get-started-with-amazon-elasticsearch-service-how-many-data-instances-do-i-need.html
ストレージのサイズは?
- 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• dedicated master nodes
• ノードを管理するマスター専用ノード
• Split Brain を考慮して 3 台構成がオススメ
– https://www.elastic.co/guide/en/elasticsearch/reference/5.5/modules-node.html
- 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• Zone awareness - 複数の AZ を使う設定
- 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES のデプロイの注意点
• スケーリングは、各種メトリクスを見ながら、ご自身
で対応する必要がある
• 構成を後から簡単に変更することができる
• 構成変更は、Blue/Green デプロイで実行される
• スケールコントロールの観点で、特に注意を払うべき
代表的なメトリクス
• クラスターの JVMMemoryPressure
• クラスターの FreeStorageSpace
• マスターの CPUUtilization
• プラグインを自由にインストールすることはできない
• マネージドサービスであるため、セキュリティや
可用性を担保する必要があるため
• 商用プラグインに該当するような機能は、IAM や
CloudWatch、Kinesisで補う
Amazon Elasticsearch Service
- 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Supported APIs
Amazon Elasticsearch Service
http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/aes-supported-es-operations.html
- 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
• コンソールで JSON をやりくりするのは辛い?
• Amazon ES 5.1 以降ならば、Kibana の Console を活用できる
• 以前から Chrome プラグイン・Kibana プラグインとしてよく知
られていた Sense が、Elasticsearch に統合された
https://www.elastic.co/guide/en/kibana/5.5/console-kibana.html
- 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Amazon ES の CloudWatch メトリクス
Amazon Elasticsearch Service
Metric for Cluster
ClusterStatus.green FreeStorageSpace
ClusterStatus.yellow ClusterUsedSpace
ClusterStatus.red ClusterIndexWritesBlocked
Nodes JVMMemoryPressure
SearchableDocuments AutomatedSnapshotFailure
DeletedDocuments CPUCreditBalance
CPUUtilization KibanaHealthyNodes
Metric for dedicated master nodes
MasterCPUUtilization
MasterFreeStorageSpace
MasterJVMMemoryPressure
MasterCPUCreditBalance
MasterReachableFromNode http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/es-metricscollected.html
- 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
日本語解析
• ICU と Kuromoji プラグインは、Amazon ES にインストール済み
• analysis-icu (ノーマライズ)
• analysis-kuromoji (形態素解析)
https://www.elastic.co/guide/en/elasticsearch/plugins/5.5/analysis-icu.html
https://www.elastic.co/guide/en/elasticsearch/plugins/5.5/analysis-kuromoji.html
- 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
ICU: International Components for Unicode
• ICU で出来ること => Unicode の正規化
• 具体的には
– ㌕ => キログラム
– ① => 1
• 使い方の詳細は↓の README を参照
– https://github.com/elastic/elasticsearch-analysis-icu
• ICU のホームページ
– http://site.icu-project.org/
– http://icu-project.org/apiref/icu4j/
- 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
Kuromoji
• https://www.atilika.com/ja/kuromoji/
- 30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
Kuromoji
• 英語: This is a pen.
• This 名詞(主語) / is 動詞 / a 不定冠詞 / pen 名詞
• 日本語: これはペンです。
• これ名詞(主語) / は 助詞 / ペン 名詞 / です 助動詞
• 日本語はスペースで区切られていない
• 日本語用の解析が必要
• Kuromoji の由来
• http://shinodogg.com/?p=3346
- 31. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elasticsearch Service
Kuromoji のデモ
• http://www.atilika.org/
コードサンプル
コンパイル
実行結果
- 32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon ES のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
無料利用枠の提供を開始
• t2.micro.elasticsearch または t2.small.elasticsearch インスタン
スタイプが対象
• t2.micro.elasticsearch インスタンスタイプは、
Elasticsearch 2.3 と 1.5 でのみサポートしている
• シングル-AZ の t2.micro.elasticsearch または
t2.small.elasticsearch インスタンスを 1 ヶ月に最大 750 時間、月
あたり 10GB の EBS ストレージ
• Magnetic または General Purpose SSD が対象
• 無料利用枠のリミットを超えると、使用する追加リソース分の
Amazon ES サービス料金が請求される
https://aws.amazon.com/about-aws/whats-new/2017/01/amazon-elasticsearch-service-free-tier-now-available-on-t2-small-elasticsearch-instances/
- 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
最大 100 ノード、150TB ストレージをサポート
• 単一ドメインでサポートするインスタンスの最大数を 100 に増加
• これにより、選択したインスタンスタイプによっては、ドメインあた
りの最大ストレージ容量も 150TB に増加
• C4、M4、R4インスタンスタイプの多くで、最大 1.5TB の EBS ボリュームを
サポート
• ちなみに、EBS PIOPS は最大 16,000 IOPS をサポート
• これにより、大規模なアナリティック・ワークロードに対して最大5
倍のデータを保存および分析し、パフォーマンス要件を満たすために
検索アプリケーションを水平に拡張できる
• 5 倍 = 現在の最大インスタンス数:100 / これまでの最大インスタンス数:20
• デフォルトのドメインごとの制限 20 インスタンスを超えて増加を要
求するには、サービス制限緩和のリクエストを送信するだけ
https://aws.amazon.com/about-aws/whats-new/2017/04/amazon-elasticsearch-service-now-supports-up-to-100-nodes-and-150-tb-storage-capacity-per-domain/
- 35. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elasticsearch 5.5 サポート
https://aws.amazon.com/about-aws/whats-new/2017/09/elasticsearch-5_5-now-available-on-amazon-elasticsearch-service/
• Amazon ES の Elasticsearch 5.5 では、5.3 のスタックよりも、さらにいくつかの機能拡張が提供されている
• より速いパフォーマンス:Apache Lucene 6.6.0 で強化された Elasticsearch 5.5 では、より効率的なレンジクエ
リ、ネストされたクエリへのスピードブースト、最適化された大量クエリなど、多数のクエリ最適化機能を提供す
る
• Kibana 5.5 の機能強化:注目すべき Kibana の機能強化には、探している視覚化を簡単に見つけるための新しいビ
ジュアライゼーション作成ワークフロー、時系列データ用の特別なインターフェイスを提供する新しい時系列ビ
ジュアルビルダー機能、期待される範囲内でデータを提示するのを容易にするゲージおよび目標チャートの視覚化、
が含まれる
• ストアドスクリプトのサポート:ストアドスクリプトのサポートが追加され、ネットワークのペイロードが大幅に
削減される、ストアドスクリプトは、Painless、Lucene Expressions、および Mustache スクリプト言語で使用で
き、既存のインラインスクリプトのサポートを補完する
• 自動スナップショットからのセルフサービスリストア:Amazon ES ドメインのセルフサービスリストアは、サー
ビスによって自動化されたスナップショットから利用できるようになった。すべての自動化されたスナップショッ
トは、Elasticsearch API またはキュレーター CLI から復元することができる。復元リクエストをサポートに依頼
する必要はなくなった(ドメインのマイグレーションには、自動スナップショットを利用できない)
• 設定可能なMax Clause Count:デフォルトの MaxClauseCount 設定は 1024 だが、ドメインの設定で、その「高
度な設定」で上書きできるようになった
- 36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES とスクリプト
• インラインに加えて、ストアドスクリプ
トもサポート
• サポートするスクリプト言語は、セキュ
アかつビルトインの 3 種
• Painless
• Lucene Expressions
• Mustache
• Painless – 汎用、Elasticsearch のデ
フォルトのスクリプト言語でもある
• Lucene Expressions – カスタムランキ
ング・ソーティング用途
• Mustache – サーチテンプレート用途
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/modules-scripting.html
- 37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
バックアップ&リストア
1. 自動スナップショット – AWS が自動で取得するもの
• Daily – 1 日 1 回 Automated snapshot start hour で指定
• リストアはAWS技術サポートへお問い合わせ
1. 手動スナップショット - お客さまがご自身で取得
• _snapshot API を実行する
• Elasticsearch のフォーマットでお客さまの S3 バケット
自動と手動どちらも、任意のタイミングで、セルフリストア可能
Amazon ES とバックアップ&リストア
- 38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES とバージョンアップ
移行元 Ver 移行先 Ver 移行プロセスのポイント
5.1 or 5.3 5.5 移行元バージョンで手動スナップショットを作り、移行先バージョンでそのスナップショッ
トからリストアを実行する
2.3 5.x まず、Index またはアプリケーションへの調整が必要かどうか、Elasticsearch のドキュメ
ント*を確認する(注意:Elasticsearch の移行プラグインは利用できません)
その後、移行元バージョンで手動スナップショットを作り、移行先バージョンでそのスナッ
プショットからリストアを実行する
*https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking-changes-5.0.html
1.5 5.x 移行元バージョンのスナップショットは、移行先バージョンと互換性がないため、手動で
Index を再作成する必要がある
(注意:1.5 のスナップショットは 2.3 と互換性があるが、Amazon ES 2.3 のドメイン
は _reindex 操作をサポートしていないので Index を再作成できないため、1.5 で作成され
た Index では、2.3 のスナップショットを 5.x にリストアできない)
1.5 2.3 まず、Elasticsearch プラグイン _plugin/migration を使用し、直接、移行先バージョンに
アップグレードできるかを確認する(注意:移行前にデータの変更が必要になる場合あり)
ウェブブラウザで、http://<domain_endpoint>/_plugin/migration/ を開き、
[Run checks now] を選択し、結果に応じて、手順に従いデータを変更する
詳細については、Elasticsearch のドキュメント*を要確認
その後、移行元バージョンで手動スナップショットを作り、移行先バージョンでそのスナッ
プショットからリストアを実行する
*https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking-changes.html
- 39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Slow logs サポート
https://aws.amazon.com/about-aws/whats-new/2017/10/optimize-your-amazon-elasticsearch-service-domains-using-slow-logs/
• Amazon ES を使用すると、検索(Search)や索引付け
(Indexing)操作の最適化とトラブルシューティングに役立つ
情報を提供する Slow logs を有効にできるようになりました
• Slow logs は CW Logs に公開され、自由にオン/オフできます
• お客様の使用状況に基づいて発生する CW 料金の支払いのみが
必要で、追加の Amazon ES 料金は適用されません
• AWS ES コンソール、CLI、または API を使用して、ドメイン
ごとに個別に、索引付け(Indexing)および検索操作
(Search)の Slow logs を有効にすることができます
• 検索操作(Search)は、Query と Fetch のフェーズそれぞれ
で Slow Logs を取得できます
• ロギングレベルは 4 段階:trace, debug, info, warn
• Elasticsearch の Index ごとに、Slow とする閾値を設定します
• CW Logs に書き込むための適切な IAM 権限を ES ドメインに
付与してください
curl -XPUT http://<your domain’s endpoint>/index/_settings -d '{"index.search.slowlog.threshold.query.<level>":"10s"}'
- 40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
VPC サポート 1/2
https://aws.amazon.com/about-aws/whats-new/2017/10/amazon-elasticsearch-service-announces-support-for-amazon-virtual-private-cloud-vpc/
• 各ドメインごとにファイアウォールルールと IP ベースの
アクセスポリシーを設定して維持することなく、VPC か
ら Amazon ES へのアクセスを簡単に設定できる
• この新機能により、パブリックインターネットを経由す
ることなく、Amazon VPC と Amazon ES 間のすべての
トラフィックを AWS ネットワーク内に維持することが
できる
• Amazon ES の VPC サポートにより、セキュリティが強
化され、ネットワーク管理が簡素化される
• 追加コストなしで利用可能
• VPC サポートにより、Amazon ES ドメインは VPC 内か
ら IP アドレスを得られるようになり、これらのドメイン
はパブリックインターネットから安全に隔離された状態
に保たれる
• 既存の VPC の SG を使用してアクセスを制御できる
• AWS の IAM ポリシーを適用することで、アクセス制御
をさらに強化することができる
- 41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
VPC サポート 2/2
https://aws.amazon.com/about-aws/whats-new/2017/10/amazon-elasticsearch-service-announces-support-for-amazon-virtual-private-cloud-vpc/
• VPC 内でドメインを起動することも、パブリックエンドポイントを使用することもできるが、二者
択一
• VPC 内で新しいドメインを起動すると、後でそれを切り替えてパブリックエンドポイントを使用す
ることはできず、パブリックエンドポイントを持つドメインを作成した場合も、後で VPC 内に配
置することはできない
• 代わりに、新しいドメインを作成してデータを移行する必要がある
• ドメインを起動する VPC のハードウェアテナンシーは必ず Default
• VPC 内にドメインを配置した後、別の VPC にドメインを移動することはできない
• ただし、サブネットとセキュリティグループの設定を変更することはできる
• Amazon ES は、VPC 内に存在するドメインの KFH との統合をサポートしていない
• Amazon ES で KFH との統合を使用するには、パブリックエンドポイントを使用する必
要がある
• VPC 内に存在するドメインの Kibana にアクセスするには、ユーザーは VPC にアクセスできる必
要がある
• ネットワーク構成によって詳細は異なるが、VPN または管理対象ネットワークに接続す
るか、プロキシサーバーを使用する可能性がある
- 42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES パブリックエンドポイントの利用
1. Amazon ES ドメイン
• IAM はこのドメインへのアクセス
を許可する
• 追加の IP ベースのアクセスポリ
シーは、プロキシサーバーへのア
クセスを提供する
2. VPC サブネット内に存在し、Amazon
EC2 インスタンス上で実行されている
プロキシサーバー
3. EC2 インスタンス上で実行されている
他のアプリケーション
• Sig V4 の署名プロセスを使用し
て、Amazon ESに認証済みの要
求を送信する
4. Kibana クライアントはプロキシ経由で
Amazon ES ドメインに接続する
https://aws.amazon.com/blogs/database/set-access-control-for-amazon-elasticsearch-service/
- 43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon ES のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• イベントの処理フロー
https://www.elastic.co/guide/en/logstash/5.5/input-plugins.html
Amazon ES と Logstash 1/4
https://www.elastic.co/guide/en/logstash/5.5/filter-plugins.html
- 45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
便利な Filter 機能
• 代表的な Filter のひとつ – Grok
• 任意のテキストを解析し、それを構造化する
• 厄介な構造化されていないログデータを構造
化されクエリ可能なものに解析する最良の方
法、とも言われている
• Syslogログ、Apacheやその他のWebサー
バーログ、mysqlログなどのログ形式に最適
• 正規表現の上に成り立っているので、正規表
現も扱える
• つまり、Grok パターンは、一行ずつ
データを照合するために使用される正
規表現の名前付き集合になる
• Athena や Glue でも活用できる
• GitHub で、様々な Grok パターンが公
開されている
Amazon ES と Logstash 2/4
https://github.com/logstash-plugins/logstash-patterns-core/tree/master/patterns
https://www.elastic.co/guide/en/logstash/5.5/plugins-filters-grok.html
- 46. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Logstash – AWS プラグイン
• AWS のクレデンシャルを使ってセキュアに Amazon ES にデータ投入
https://www.elastic.co/guide/en/logstash/5.5/advanced-pipeline.html
Amazon ES と Logstash 3/4
https://github.com/awslabs/logstash-output-amazon_es
- 47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Logstash - AWS プラグイン
• Input
• S3 input プラグイン
– バケットとファイル名のパターンを指定
– https://www.elastic.co/guide/en/logstash/5.5/plugins-inputs-s3.html
• DynamoDB input プラグイン
– DynamoDB Streams のデータを読み込み
– https://github.com/awslabs/logstash-input-dynamodb
• Output
• Amazon Elasticsearch Service output プラグイン
– Sig V4 でセキュアにAmazon ES にインデクシング
– https://github.com/awslabs/logstash-output-amazon_es
Amazon ES と Logstash 4/4
- 48. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM Integration
• IP アドレスベースの制限
• 例) Kibana へのアクセスは社内の IP アドレスレンジからのみ
• Signed requests with Signature Version 4
• 例) AWS のクレデンシャルを使ってセキュアにアクセス
• Logstash プラグイン: https://github.com/awslabs/logstash-output-amazon_es
• Fine-grained アクセスコントロール
• 例) ドメイン内の Index 毎にアクセス権限を分ける
Logstash Amazon ESData Source
Amazon ES と AWS IAM 1/10
Sig V4
- 49. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
role
Elastic IP
address
role
policy
policy
policy
ユーザー
ポリシーやロール
インスタンスなど
ロールや IP
Amazon ES ドメイン
ポリシー
• IAM はすべての適用可能なアイデンティティやポリシーに基づいて認証が
働く
ユーザーベースポリシー リソースベースポリシー
Amazon ES と AWS IAM 2/10
http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html¥
- 50. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 競合するポリシータイプに対して、常に Deny が勝る
• 明示的にポリシーを指定しない場合、Deny がデフォルト
リソースベースポリ
シーで Allow
リソースベースポリ
シーで Deny
リソースベースポリ
シーで Deny/Allow
の指定なし
ユーザーベースポリ
シーで Allow
Allow Deny Allow
ユーザーベースポリ
シーで Deny
Deny Deny Deny
ユーザーベースポリ
シーで Deny/Allow
の指定なし
Allow Deny Deny
Amazon ES と AWS IAM 3/10
- 51. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
IAM ポリシーの構造の概要
{
"Version": "2012-10-17",
"Statement": [ {
"Effect":...
"Principal": ...
"Action": [...],
"Resource": ...,
"Condition": ...
} ]
}
• Effect: Allow or Deny
• Principal: AWS アカウント ID
• Action
• サービスアクション
• HTTP メソッド
• Resource: Amazon ES domain/Index
• Condition: IP アドレスなど
Amazon ES と AWS IAM 4/10
- 52. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
基本的な IP ベースアクセスの例
Amazon ESIAM
Elastic IP
address
• 既知のIPアドレスからのアクセス
• ドメインのポリシーは、Deny/Allow するアクションを制御する
• アクセスは匿名になる
Policy
Amazon ES と AWS IAM 5/10
- 53. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• リソースベースポリシーによるIPベースの制御
• Allow - すべてのユーザー、すべてのアクション、すべての Index
{
"Sid": "",
"Effect": "Allow",
"Principal": { "AWS": "*” },
"Action": "es:*",
"Resource": "arn:aws:es:us-east-1:12345678910:domain/test/*”
"Condition": {
"IpAddress": {
"aws:SourceIp": [”1.2.3.4"]
} }
}
Amazon ES と AWS IAM 6/10
IP ベースアクセス用のポリシーの例
- 54. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ESIAM
• アクセス/秘密鍵で認証されたIDでアクセスする
• ポリシーの解釈は前述のとおり
• 署名されたリクエストによるアクセス
Policy
AWS SigV4
signing
Lambda
AWS SigV4
signing
Amazon ES と AWS IAM 7/10
基本的なアイデンティティベースアクセスの例
- 55. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• リクエストには署名が必須
• Allow - User-name-1 は、すべての Index に対して、すべての
アクション
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::12345678910:user/user-name-1”
]
},
"Action": "es:*",
"Resource": "arn:aws:es:us-east-1:12345678910:domain/test/*”
}
Amazon ES と AWS IAM 8/10
アイデンティティベースアクセス用のポリシーの例
- 56. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES へのアクセスの構成例
Application
Amazon ES - search
Amazon ES - monitor
User
Amazon RDSUpdater
Kibana
Proxy
Administrator
DevOps/IT
Amazon ES と AWS IAM 9/10
- 57. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES にアクセスするための IAM ロールを、それぞれ作成する
例 Administrator IT/DevOps Application Updater Proxy
タイプ ユーザーベース ユーザーベース リソースベース リソースベース リソースベース
アクション • es:CreateElasticsearchDomain
• es:Describe*
• es:DeleteElasticsearchDomain
• es:ListDomainNames
• es:AddTags
• es:ListTags
• es:RemoveTags
• es:Update*
• es:ESHttpGet
• es:ESHttpPut
• es:ESHttpDelete
• es:ESHttpPost
• es:Describe*
• es:ListDomainNames
• es:AddTags
• es:ListTags
• es:RemoveTags
• es:Update*
es:ESHttpGet es:ESHttpPost es:ESHttpGet
リソース Amazon ES search
Amazon ES monitor
Amazon ES search
Amazon ES monitor
Amazon ES search Amazon ES search Amazon ES monitor
IP なし なし EIP EIP EIP
Amazon ES と AWS IAM 10/10
https://youtu.be/lY5olliJ16E
- 58. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES と Beats
• Beats は、単一目的のデータ送信のためのプラット
フォーム、軽量エージェントとしてインストールし、
数百または数千台のマシンから Logstash、または、
Elasticsearch にデータを送信する
• Beats から Amazon ES にドキュメントを書き込むこ
とは、特定の条件下で、できる
• AWS Signature Version 4 が必要なければ、書き込
める
• Sig V4 が必要な場合には、Beats から、Logstash を
経由して、Amazon ES にドキュメントを書き込むこ
とができる
• logstash-output-amazon-es プラグインを利用して、
Sig V4 にサインする
• Sig V4 が必要か否かは、Amazon ES のドメインに対
して設定する IAM リソースベースポリシー の
Principal 属性に指定した値によって決まる
• Amazon ES 自体に Beats をインストールすることは
できない
https://www.elastic.co/products/beats
https://www.elastic.co/products/logstash
Amazon ES
Sig V4
https://github.com/awslabs/logstash-output-amazon_es
- 59. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon ES と Amazon Kinesis 1/2
• ELK だけでなく、EKK という選択肢もある!
• ELK(Elasticsearch, Logstash, Kibana)
• EKK(Elasticsearch, Kinesis, Kibana)
https://aws.amazon.com/jp/blogs/devops/from-elk-stack-to-ekk-aggregating-and-analyzing-
apache-logs-with-amazon-elasticsearch-service-amazon-kinesis-and-kibana/
Amazon
Kinesis
IAM Amazon
CloudWatch
Amazon ES
Sig V4
Amazon Kinesis
enabled app
Sig V4
- 60. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Data producer
Amazon
S3
Amazon
Athena
Lambda
function
Amazon
Kinesis
Analytics
Amazon
Kinesis
Streams
Amazon
SNS
Lambda
function
①可視化
②仮説検証
③自動化
Amazon
Kinesis
Firehose
Amazon
Elasticsearch
Service
Lambda
function
Amazon
S3
(Reference data source)
Amazon ES と Amazon Kinesis 2/2
- 61. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CloudWatch
Metrics
Amazon Linux Ubuntu
Windows Red Hat Linux
CloudWatch
Logs
CloudWatch
Alarm
SNS
Log Agent Log Agent
Log Agent Log Agent
VPC Flow Log
Amazon
ES
Amazon ES と Amazon CloudWatch 1/2
- 62. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CloudWatch Logs
• Stream to Amazon Elasticsearch Service
Amazon ES と Amazon CloudWatch 2/2
- 63. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS IoT との連携
• http://aws.typepad.com/aws_japan/2016/03/aws-iot-update.html
Amazon ES と AWS IoT
- 64. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 検索用途に、ファイルの
メタデータや場合によっ
てはファイル内容をイン
デックスする
• リポジトリを最新に保つ
ために、S3 イベント通知
から Lambda をトリガー
する
Amazon ES とデータレイク
https://aws.amazon.com/blogs/database/indexing-metadata-in-amazon-elasticsearch-service-using-aws-lambda-and-python/
- 65. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
アジェンダ
1. Amazon ES のサービス紹介
2. Amazon ES の構成概要
3. Amazon ES の最近の主なアップデートと関連情報
4. Amazon ES と関連するサービスやソフトウェア
5. まとめ
- 66. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS SDK
AWS CLI
AWS
CloudFormation
Elasticsearch
data nodes
Elasticsearch
master nodes
Elastic Load
Balancing
AWS IAM
CloudWatchCloudTrail
Amazon Elasticsearch Service domain
Internet or
your VPC
AWS Console
https://aws.amazon.com/blogs/database/set-access-control-for-amazon-elasticsearch-service/
Elasticsearch のデプロイと管理が容易
- 67. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
オープンソース互換
No Lock In!
オープンソースの Elasticsearch
への/からの、ただ置換するだけ
の、変更のいらない、ほとんどリ
スクのない移行が可能
- 68. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Log shipper
REST
CWL Agent
EC2 Instances
Amazon
Kinesis
Amazon
RDS
Amazon
DynamoDB
Amazon
SQS
Queue
Log
Shippers
Amazon
Elasticsearch
Service
Amazon
CloudWatch
AWS
Lambda
AWS
CloudTrail
Access Logs
Amazon
VPC Flow
Logs
Amazon S3
bucket
AWS IoT
Amazon Kinesis
Firehose
AWS エコシステムとの統合
Amazon
ECS
- 69. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
さいごに
• Amazon ES Developer Guide
• http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/
• AWS Centralized Logging
• https://aws.amazon.com/answers/logging/centralized-logging/
• AWS Database Blog
• https://aws.amazon.com/blogs/database/category/analytics/amazon-elasticsearch-
service/
• AWS Big Data Blog
• https://aws.amazon.com/blogs/big-data/category/analytics/amazon-elasticsearch-
service/
• Amazon Web Services Blog (日本)
• https://aws.amazon.com/jp/blogs/news/category/analytics/amazon-elasticsearch-
service/
IAM でセキュアに!
そして、EKK!
Amazon
Elasticsearch
Service
(Amazon ES)
- 70. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
オンラインセミナー資料の配置場所
AWS クラウドサービス活用資料集
• http://aws.amazon.com/jp/aws-jp-introduction/
AWS Solutions Architect ブログ
• 最新の情報、セミナー中の Q&A 等が掲載されています
• http://aws.typepad.com/sajp/
- 71. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.