Bigdata JAWS #18 の登壇資料です。
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Amazon Web Services JapanSolutions ArchitectChie HayashidaGlueとLake FormationではじめるデータマネジメントBigData-JAWS 勉強会#18
View Slide
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.データ活用が進むに連れて生まれる課題
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータ量* IDC, Data Age 2025: The Evolution of Data to Life-Critical: Don’t Focus on Big Data, Focus on the Data That’s Big, April 2017.データ想像を超えるデータ量データプラットフォームより多様なデータ5年毎15年運⽤期間1,000倍スケール10倍以上成⻑率
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータソースの種類• 構造化データ/半構造化データ/⾮構造化データ• ファイルフォーマットや圧縮形式(csv, json, Parquet, …)• さまざまな品質のデータ、スキーマ変更への対応尾データ発⽣場所の多様化• アプリケーション/インフラ、IoT/モバイル• オンプレ/クラウド• SNS、サードパーティ製品データフォーマットや特性の多様化• バッチ/ストリーム• データベース/ログファイルデータの送信⽅法の多様化
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.目的に応じたジョブ実行エンジンやワークフローエンジン選定• データサイズに応じた最適なクエリエンジンの利⽤• 並列分散処理の要否• スキルセットに応じたクエリエンジン• プログラマブル/GUIベース• フローの複雑さに応じたワークフローエンジン
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータ連携先データKPIダッシュボード(BI)レコメンド(ML)セキュリティ監視(モニタリングダッシュボード/メトリクス検知)ユーザの動向分析(インタラクティブクエリ)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータ利用者• さまざまな組織・ロールの利⽤者へのデータの出し分け• 機密情報のアクセス管理• ⼈的ミスによるデータ⽋損を防ぐ• さまざまなスキルセットの利⽤者が利⽤できる環境の提供
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータ管理の重要性• データの可視化・検索• さまざまな実⾏エンジンからさまざまなデータへのアクセスを可能にするコネクタ• 細かなアクセス権限管理• データアクセスの監査ログの取得と可視化• 利⽤者のスキルセットや⽬的に応じた実⾏エンジン• データ品質の検査
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.データレイクを安全なものにするための課題典型的なデータレイク構築の流れデータの移⾏2 データを加⼯整形してカタログ化3セキュリティとコンプライアンスポリシーを設定および適⽤4データを分析可能に5ストレージをセットアップ1DataEngineerDataStewardDataAnalystデータを管理する「データスチュワード」の役割が重要に
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.増えるデータ管理の重要性• データの可視化・検索• さまざまな実⾏エンジンからさまざまなデータへのアクセスを可能にするコネクタ• 細かなアクセス権限管理• データアクセスの監査ログの取得と可視化• 利⽤者のスキルセットや⽬的に応じた実⾏エンジン• データ品質の検査AWS Lake FormationAWS Glue、Amazon Redshift、Amazon AthenaAWS Glue DataBrewAWS Glue
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Glue Data Catalogü クエリエンジンからのデータアクセスに必要なスキーマ情報などのメタデータを保存ü テーブル名やデータベース名などでデータ検索ü データの利⽤⽅法などのチームナレッジを保存してシェアü 変更内容のバージョニング
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Glue データカタログ データのスキーマなどのメタデータを保存・管理・可視化
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.データカタログの検索• Resource Attributes 検索Classification(例えばPARQUET),Database(例えばDatabaseA), Location(例えばs3),Name(テーブル名で例えばTableA)• キーワード検索データベース名、テーブル名、列名、Description などのメタデータをキーワード検索• 複数のフィルタ検索上記のいくつかを組み合わせて検索ü Classification を PARQUET、Location を s3、Keyword をaccountnumber(列名) で複数フィルタ検索ü Classification を PARQUETで検索Lake Formation では、テキストベースのファセット検索を全メタデータに対して⾏えるため、分析に利⽤可能なデータセットのカタログにセルフサービスでアクセスできます。※複数のキーワードは組み合わせられない
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.データカタログの検索タグを設定• テーブル datalakejdbc_dblf_personのテーブルプロパティに env:researchを追加• テーブル datalakejdbc_dblf_personのカラム storeid とテーブルtest_person のカラム storecode に、カラムプロパティ storeidenv:dev を追加ü カラムプロパティ (テーブル datalakejdbc_dblf_person のstoried 、テーブル test_person の storecode )ü テーブルプロパティ (テーブル datalakejdbc_dblf_person)ビジネス固有の属性をテーブルプロパティやカラムプロパティとして追加できます。
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.データカタログの検索タグによる検索ü テーブル datalakejdbc_dblf_person (テーブルプロパティ env:research)ü テーブル datalakejdbc_dblf_person (storeidカラムプロパティ storeidenv:dev)ü テーブル test_person (storecodeカラムプロパティ storeidenv:dev)追加したビジネス固有の属性(テーブルプロパティやカラムプロパティ)で検索できます。マーケティングやリサーチャーなどデータを扱いたい⼈が欲しいデータを探しやすくなります。• テーブルプロパティで“env:research”で検索。datalakejdbc_dblf_person がヒット• カラムプロパティで”storeidenv:dev”による検索。test_person,datalakejdbc_dblf_person の2つのテーブルがヒット
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Glue データカタログの特徴 ①• S3やデータベースといったデータソース上のデータに、AWS GlueやAthena、Redshift Spectrumなどからアクセスするときに必要なメタデータ(テーブル名、列名、S3のパスなど)をもっている• データカタログにメタデータを作成するにはクローラー、AWS GlueのAPI、DDL(Athena/EMR/Redshift Spectrum)の3つの⽅法が利⽤可能。• データソースとして、Amazon DynamoDB、Amazon S3、Amazon Redshift、Amazon RDS、JDBC接続可能なDB、Kinesis、HDFSなどが指定可能• メタストアデータベースの管理が不要の為、運⽤負荷を低減できるDynamoDBS3RedshiftRDSJDBC 接 続 可 能 なDBデータソースメタデータ保存AWS GlueETLAthenaRedshiftSpectrumEMR連携可能なサービスHive互換アプリデータカタログクローラーデータカタログの利⽤イメージ①メタデータアクセス②データアクセス
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.さまざまなデータソースにまたがった統合的なデータカタログの構築• データ移動をなくしてコストや管理の削減• データ検索やアクセスの一元化してサイロ化を解消• 構造化・非構造化データからの素早い洞察• 自動でデータを登録することでプロダクティビティアップ
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.メタデータの構成例テーブル情報テーブルプロパティテーブルスキーマテーブルパーティションクローラーがHiveパーティションを⾃動認識する「sample-data/location=US/year=2019/month=08/day=06・・・」
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.テーブルの編集画面例「説明」欄にデータの利⽤⽅法などのチームナレッジを記述
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.タグを利用したデータ管理例• データオーナの情報• ある特定の⼈が管理するデータを⼀覧化• あるデータのオーナを特定して問い合わせ• トピック情報• 分析したいトピックを検索してデータを発⾒• データの有効期限• 期限切れデータの発⾒• どのデータソースから作成されたか• あるデータに異常があったときに影響範囲を確認
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.スキーマのバージョン管理バージョンを指定して変更箇所を確認できる旧バージョン 新バージョンスキーマ編集画⾯でデータ型が変更可能スキーマのバージョンを管理差分を⽐較スキーマバージョン⽐較
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.目的に応じたクエリエンジンからさまざまなデータソースにアクセス• AWS Glue コネクタ• Amazon Redshift Federated Query• Amazon Athena Federated Query
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Glue コネクタ• AWS Glue ETLとカスタムのデータソースとの接続を⽤意に⾏うことができる機能• 数クリックでAWS Marketplaceからコネクタを検索して選択し、ETLワークフローを作成可能AWS Glue ETL
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Marketplaceからsubscribeして利用(無料)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.カスタムGlue コネクタの開発カスタムコネクタ現在マーケットプレイスに必要なコネクタがない場合はカスタムコネクタの作成が可能
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.カスタムコネクタの開発手順やサンプルhttps://github.com/aws-samples/aws-glue-samples/tree/master/GlueCustomConnectors
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Glue スキーマレジストリ• ストリームデータのスキーマを一元的に定義・検出・制御可能• スキーマ定義により、データのガバナンスや品質向上につながる• 登録したスキーマを利用してKinesis Data Analyticsによるストリームデータへのクエリ実行などが可能
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Amazon Redshift Federated QueryRedshiftからさまざまなデータソースにまたがった分析• RDS/Aurora PostgreSQL およびRDS/Aurora MySQL(Preview) をサポート• データコピーなしに最新のデータを分析• DWH、データレイク、業務DBにまたがったデータを統合して分析• データの取り込み⼿順が柔軟で簡単に• セキュアで⾼パフォーマンスなデータアクセスJDBC/ODBChttps://docs.aws.amazon.com/redshift/latest/dg/federated-overview.html
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.Amazon Athena Federated Queriesl リレーショナル、⾮リレーショナル、オブジェクト、またはカスタムデータソース間でクエリを実⾏するl オンプレミスまたはクラウドデータソース間でクエリを実⾏するl データソースコネクターを利⽤してAthena クエリエンジンを拡張できるhttps://aws.amazon.com/jp/blogs/news/query-any-data-source-with-amazon-athenas-new-federated-query/※ コネクター実装チュートリアル動画も掲載されています(英語)
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Lake Formationセキュアなデータレイクを実現するためのコンポーネント
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Lake Formation アクセスコントロール• GRANT/REVOKEといったシンプルな命令によってデータの細かなアクセス制御設定が可能• AWS Glue カタログ上のデータに対して、データベース、テーブル、列、⾏、セル(※)といった単位でアクセスコントロールを⾏うことができる Grant 選択※行とセルはプレビュー
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.テーブルおよびカラムレベルの権限付与ユーザー 1⼀部の列のみアクセス可能ユーザー 2全ての列にアクセス可能列レベルのアクセス制御の指定Include/Exclude 表記をサポート
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.リソースベースの権限管理とタグベースのリソース管理リソースベースの権限管理ユーザやテーブルが増えるごとにたくさんの設定変更が必要タグベースの権限管理(推奨)ユーザやテーブルが増えた場合は増えた対象にタグを付与すればいい
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Lake Formationを利⽤したアクセスコントロールのイメージクエリ実行時にLake Formationに権限の問い合わせを行うUserQuery TCheck authorization for principalReturn temporarycredentialsAmazon S3Request objs comprising TReturn objs of TAWSLake Formation12345Trusted servicesPrincipals can beIAM users, roles, andusers via federatione.g., Active DirectoryAmazonAthenaAmazonRedshiftAWSGlueAmazonEMR6
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.ニアリアルタイム監査とモニタリングCloudTrail を有効化しておくことで、Lake Formation のコンソールでデータアクセスを監査できます。[View Event] でどのユーザーまたはロールがどのデータにどのサービスでアクセスしたかなどの詳細を確認できます。
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Lake Formation クロスアカウントアクセスプロデューサ コンシューマSales OpportunitiesSales Opportunitieseu_sales eu_oppsDatacatalogDatacatalogAWS LakeFormationAmazonAthenaAWSGlueAmazonEMRAmazonRedshift組織やチームごとに運用する個別のアカウント間でデータコピーなしでセキュアにデータシェアが可能
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.アカウントをまたいだデータアクセスのパターン中央集権型 組織横断でのデータ連携 データメッシュOrganization
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Glue DataBrewによるノンコードETLと品質検査•レシピジョブ• データセットに対してレシピを適⽤してノンコードで変換処理を⾏うもの•プロファイルジョブ• データセットの統計に関するプロファイルを作成するもの
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.AWS Glue DataBrewの画⾯
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.プロジェクト内でインタラクティブに変換イメージを確認しながら、データセットに対する変換ステップのコレクションであるレシピを作成作成したレシピはJSONやYAMLでダウンロード可レシピジョブの作成1. 250 種類以上の組み込みの処理から選択して変換ステップを作成2. 変換ステップが確定したらレシピを発⾏(2)(1)https://docs.aws.amazon.com/databrew/latest/dg/recipes.html
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.レシピジョブで行える代表的な変換処理• フィルタリング• 結合• 集計• ⽋損値補完• 関数を使った新たな列の追加• 複数列の結合• フラグ値の作成• One-hotエンコーディング• 数値データの正規化
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.プロファイルジョブによる品質検査サンプリングデータもしくは全てのデータに対して実⾏可
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.まとめ• データの可視化・検索• さまざまな実⾏エンジンからさまざまなデータへのアクセスを可能にするコネクタ• 細かなアクセス権限管理• データアクセスの監査ログの取得と可視化• 利⽤者のスキルセットや⽬的に応じた実⾏エンジン• データ品質の検査AWS Lake FormationAWS Glue、Amazon Redshift、Amazon AthenaAWS Glue DataBrewAWS Glue
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.まとめ• データ活⽤が広まるにつれ、⾼度なデータマネジメントが求められている• AWS GlueやAWS Lake Formationを利⽤して、データの可視化、アクセス管理、さまざまなデータソースへのアクセスといった⾼度なデータマネジメントを⾏うことができる• データ活⽤を加速させるAWSのデータマネジメント機能の進化に期待︕
© 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.Thank You!