Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWS GlueとAWS Lake Formationではじめるデータマネジメント

chie8842
September 13, 2021

AWS GlueとAWS Lake Formationではじめるデータマネジメント

Bigdata JAWS #18 の登壇資料です。

chie8842

September 13, 2021
Tweet

More Decks by chie8842

Other Decks in Technology

Transcript

  1. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    Amazon Web Services Japan
    Solutions Architect
    Chie Hayashida
    GlueとLake Formationではじめる
    データマネジメント
    BigData-JAWS 勉強会#18

    View Slide

  2. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    データ活用が進むに連れて
    生まれる課題

    View Slide

  3. © 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倍以上
    成⻑率

    View Slide

  4. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータソースの種類
    • 構造化データ/半構造化データ/⾮構造化データ
    • ファイルフォーマットや圧縮形式(csv, json, Parquet, …)
    • さまざまな品質のデータ、スキーマ変更への対応尾
    データ発⽣場所の多様化
    • アプリケーション/インフラ、IoT/モバイル
    • オンプレ/クラウド
    • SNS、サードパーティ製品
    データフォーマットや特性の多様化
    • バッチ/ストリーム
    • データベース/ログファイル
    データの送信⽅法の多様化

    View Slide

  5. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    目的に応じたジョブ実行エンジンやワークフローエンジン選定
    • データサイズに応じた最適なクエリエンジンの利⽤
    • 並列分散処理の要否
    • スキルセットに応じたクエリエンジン
    • プログラマブル/GUIベース
    • フローの複雑さに応じたワークフローエンジン

    View Slide

  6. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ連携先
    データ
    KPIダッシュボード
    (BI)
    レコメンド
    (ML)
    セキュリティ監視
    (モニタリング
    ダッシュボード/
    メトリクス検知)
    ユーザの動向分析
    (インタラクティ
    ブクエリ)

    View Slide

  7. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ利用者
    • さまざまな組織・ロールの利⽤者へのデータの出し分け
    • 機密情報のアクセス管理
    • ⼈的ミスによるデータ⽋損を防ぐ
    • さまざまなスキルセットの利⽤者が利⽤できる環境の提供

    View Slide

  8. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査

    View Slide

  9. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    データレイクを安全なものにするための課題
    典型的なデータレイク構築の流れ
    データの移⾏
    2 データを加⼯整形
    してカタログ化
    3
    セキュリティとコンプライアンス
    ポリシーを設定および適⽤
    4
    データを分析可能に
    5
    ストレージを
    セットアップ
    1
    Data
    Engineer
    Data
    Steward
    Data
    Analyst
    データを管理する「データスチュワード」
    の役割が重要に

    View Slide

  10. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  11. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  12. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Glue Data Catalog
    ü クエリエンジンからのデータアクセスに必要なスキー
    マ情報などのメタデータを保存
    ü テーブル名やデータベース名などでデータ検索
    ü データの利⽤⽅法などのチームナレッジを保存してシ
    ェア
    ü 変更内容のバージョニング

    View Slide

  13. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    Glue データカタログ データのスキーマなどの
    メタデータを保存・管理・可視化

    View Slide

  14. © 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 では、テキストベースのファセット検索を全メタデータに対して⾏えるため、分析に
    利⽤可能なデータセットのカタログにセルフサービスでアクセスできます。
    ※複数のキーワードは組み合わせられない

    View Slide

  15. © 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)
    ビジネス固有の属性をテーブルプロパティ
    やカラムプロパティとして追加できます。

    View Slide

  16. © 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つの
    テーブルがヒット

    View Slide

  17. © 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などが指定可能
    • メタストアデータベースの管理が不要の為、運⽤負荷を低減できる
    DynamoDB
    S3
    Redshift
    RDS
    JDBC 接 続 可 能 な
    DB
    データソース
    メタデータ保存
    AWS Glue
    ETL
    Athena
    Redshift
    Spectrum
    EMR
    連携可能なサービス
    Hive互換アプリ
    データカタログ
    クローラー
    データカタログの利⽤イメージ
    ①メタデータアクセ

    ②データアクセス

    View Slide

  18. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    さまざまなデータソースにまたがった統合的なデータカタログの構築
    • データ移動をなくしてコストや管理
    の削減
    • データ検索やアクセスの一元化して
    サイロ化を解消
    • 構造化・非構造化データからの素早
    い洞察
    • 自動でデータを登録することでプロ
    ダクティビティアップ

    View Slide

  19. © 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・・・」

    View Slide

  20. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    テーブルの編集画面例
    「説明」欄にデータの利⽤⽅法などのチームナ
    レッジを記述

    View Slide

  21. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    タグを利用したデータ管理例
    • データオーナの情報
    • ある特定の⼈が管理するデータを⼀覧化
    • あるデータのオーナを特定して問い合わせ
    • トピック情報
    • 分析したいトピックを検索してデータを発⾒
    • データの有効期限
    • 期限切れデータの発⾒
    • どのデータソースから作成されたか
    • あるデータに異常があったときに影響範囲を確認

    View Slide

  22. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    スキーマのバージョン管理
    バージョンを指定して変更箇所を確認できる
    旧バージョン 新バージョン
    スキーマ編集画⾯でデータ型が変更可能
    スキーマのバージョンを管理
    差分を⽐較
    スキーマバージョン⽐較

    View Slide

  23. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  24. © 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

    View Slide

  25. © 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

    View Slide

  26. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Marketplaceからsubscribeして利用(無料)

    View Slide

  27. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    カスタムGlue コネクタの開発
    カスタムコネクタ
    現在マーケットプレイスに必
    要なコネクタがない場合はカ
    スタムコネクタの作成が可能

    View Slide

  28. © 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

    View Slide

  29. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    Glue スキーマレジストリ
    • ストリームデータのスキーマ
    を一元的に定義・検出・制御
    可能
    • スキーマ定義により、データ
    のガバナンスや品質向上につ
    ながる
    • 登録したスキーマを利用して
    Kinesis Data Analyticsによる
    ストリームデータへのクエリ
    実行などが可能

    View Slide

  30. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    Amazon Redshift Federated Query
    Redshiftからさまざまなデータソースにまたがった分析
    • RDS/Aurora PostgreSQL および
    RDS/Aurora MySQL(Preview) をサポート
    • データコピーなしに最新のデータを分析
    • DWH、データレイク、業務DBにまたがった
    データを統合して分析
    • データの取り込み⼿順が柔軟で簡単に
    • セキュアで⾼パフォーマンスなデータアクセス
    JDBC/O
    DBC
    https://docs.aws.amazon.com/redshift/latest/dg/federated-overview.html

    View Slide

  31. © 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 Queries
    l リレーショナル、⾮リレーショナル、
    オブジェクト、またはカスタムデータ
    ソース間でクエリを実⾏する
    l オンプレミスまたはクラウドデータ
    ソース間でクエリを実⾏する
    l データソースコネクターを利⽤して
    Athena クエリエンジンを拡張できる
    https://aws.amazon.com/jp/blogs/news/query-any-data-source-with-amazon-athenas-new-federated-query/
    ※ コネクター実装チュートリアル動画も掲載されています(英語)

    View Slide

  32. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  33. © 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
    セキュアなデータレイクを実現
    するためのコンポーネント

    View Slide

  34. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Lake Formation アクセスコントロール
    • GRANT/REVOKEといった
    シンプルな命令によって
    データの細かなアクセス制御
    設定が可能
    • AWS Glue カタログ上の
    データに対して、データ
    ベース、テーブル、列、⾏、
    セル(※)といった単位で
    アクセスコントロールを⾏う
    ことができる Grant 選択
    ※行とセルはプレビュー

    View Slide

  35. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    テーブルおよびカラムレベルの権限付与
    ユーザー 1
    ⼀部の列のみ
    アクセス可能
    ユーザー 2
    全ての列に
    アクセス可能
    列レベルのアクセス制御の指定
    Include/Exclude 表記をサポート

    View Slide

  36. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    リソースベースの権限管理とタグベースのリソース管理
    リソースベースの権限管理
    ユーザやテーブルが増えるごとに
    たくさんの設定変更が必要
    タグベースの権限管理(推奨)
    ユーザやテーブルが増えた場合は増
    えた対象にタグを付与すればいい

    View Slide

  37. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Lake Formationを利⽤したアクセスコントロール
    のイメージ
    クエリ実行時にLake Formationに権限の問い合わせを行う
    User
    Query T
    Check authorization for principal
    Return temporary
    credentials
    Amazon S3
    Request objs comprising T
    Return objs of T
    AWS
    Lake Formation
    1
    2
    3
    4
    5
    Trusted services
    Principals can be
    IAM users, roles, and
    users via federation
    e.g., Active Directory
    Amazon
    Athena
    Amazon
    Redshift
    AWS
    Glue
    Amazon
    EMR
    6

    View Slide

  38. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    ニアリアルタイム監査とモニタリング
    CloudTrail を有効化しておくことで、Lake Formation のコンソールでデータアク
    セスを監査できます。[View Event] でどのユーザーまたはロールがどのデータに
    どのサービスでアクセスしたかなどの詳細を確認できます。

    View Slide

  39. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Lake Formation クロスアカウントアクセス
    プロデューサ コンシューマ
    Sales Opportunities
    Sales Opportunities
    eu_sales eu_opps
    Data
    catalog
    Data
    catalog
    AWS Lake
    Formation
    Amazon
    Athena
    AWS
    Glue
    Amazon
    EMR
    Amazon
    Redshift
    組織やチームごとに運用する個別の
    アカウント間でデータコピーなしで
    セキュアにデータシェアが可能

    View Slide

  40. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    アカウントをまたいだデータアクセスのパターン
    中央集権型 組織横断でのデータ連携 データメッシュ
    Organization

    View Slide

  41. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    増えるデータ管理の重要性
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  42. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Glue DataBrewによるノンコードETLと品質検査
    •レシピジョブ
    • データセットに対してレシピを適⽤し
    てノンコードで変換処理を⾏うもの
    •プロファイルジョブ
    • データセットの統計に関するプロ
    ファイルを作成するもの

    View Slide

  43. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    AWS Glue DataBrewの画⾯

    View Slide

  44. © 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

    View Slide

  45. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    レシピジョブで行える代表的な変換処理
    • フィルタリング
    • 結合
    • 集計
    • ⽋損値補完
    • 関数を使った新たな列の追加
    • 複数列の結合
    • フラグ値の作成
    • One-hotエンコーディング
    • 数値データの正規化

    View Slide

  46. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    プロファイルジョブによる品質検査
    サンプリングデータもしくは
    全てのデータに対して実⾏可

    View Slide

  47. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    まとめ
    • データの可視化・検索
    • さまざまな実⾏エンジンからさまざまなデータへのアクセスを
    可能にするコネクタ
    • 細かなアクセス権限管理
    • データアクセスの監査ログの取得と可視化
    • 利⽤者のスキルセットや⽬的に応じた実⾏エンジン
    • データ品質の検査
    AWS Lake Formation
    AWS Glue、Amazon Redshift、Amazon Athena
    AWS Glue DataBrew
    AWS Glue

    View Slide

  48. © 2021, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
    まとめ
    • データ活⽤が広まるにつれ、⾼度なデータマネジメントが求められて
    いる
    • AWS GlueやAWS Lake Formationを利⽤して、データの可視化、
    アクセス管理、さまざまなデータソースへのアクセスといった⾼度な
    データマネジメントを⾏うことができる
    • データ活⽤を加速させるAWSのデータマネジメント機能の進化に
    期待︕

    View Slide

  49. © 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!

    View Slide