【AWS】LakeFormation ~ 基礎知識編 ~

■ はじめに

https://dk521123.hatenablog.com/entry/2020/10/12/152659

の『【8】エラー
「message:Insufficient Lake Formation permission(s)
 on global_temp」が表示』で「Lake Formation」って
サービスが出てきたので、どんなものかと調べてみた。

目次

【0】資料
 1)動画
 2)補足:マンガ
 3)チュートリアル
【1】AWS Lake Formation
 1)主な機能
 2)コスト
【2】LakeFormationの全体構成
 1)ブループリント (Blueprint)
 2)データカタログ
【3】EMRとの絡み
【4】データ取得
 1)AWS 内にあるデータベースからデータをインポート
 2)外部ソースからデータをインポートする
【5】外部アカウントへのアクセス許可

【0】資料

* はじめに参照する資料として、AWSからでている資料を載せておく。

1)動画

https://www.youtube.com/watch?v=riS_STGzZHI

は、少し長いかもしれないが、 Lake Formation を使うのであれば、
動画(2:49位~)をみて、概要を掴んでおくといいかも。

動画で使用している資料は以下。

https://www.slideshare.net/AmazonWebServicesJapan/20191001-aws-black-belt-online-seminar-aws-lake-formation-198737098

2)補足:マンガ

* 公式のマンガもあった...

https://aws.amazon.com/jp/campaigns/manga/vol9-1/

3)チュートリアル

https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/getting-started-setup.html
https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/getting-started-tutorials.html
参考文献
https://blog.serverworks.co.jp/lakeformation_tutorial2

【1】AWS Lake Formation

* AWS Glue を発展版
 ⇒ 個人的なイメージとしては、Glueをラップしたサービスって感じ。
* CloudFormation により、設定の自動化を行うことが可能
 => CloudFormation については、以下の関連記事を参照のこと。

https://dk521123.hatenablog.com/entry/2021/10/26/224812

1)主な機能

* めちゃくちゃざっくり言うと、、、

[1] データアクセス制御(IAMとは別に)
[2] データ監査・一元監視

2)コスト

* (Lake Formation自体は) 無料

【2】LakeFormationの全体構成

* 以下のサイトの概要図が分かりやすい

https://qiita.com/sot528/items/8a4c3adf9ba5c2da3fa9

【データソース(外側)】        【データレイク(Lake Formation管理下)】      【利用サービス】
 ┌──────────┐                 ┌──────────────────────────┐               ┌───────────┐
 │   RDS    │ ──ブループリント─> │  Data Lake Storage (S3)  │ <──クエリ─── │  Athena   │
 └──────────┘       (収集)  │                          │  (分析)    └─────┬─────┘
 ┌──────────┐                 │  ┌────────────────────┐  │                     │
 │ S3(外部) │ ────────────────> │  │  ★データカタログ   │  │ <───目次を参照───────┘
 └──────────┘                 │  │ (=Athenaテーブル) │  │
                              │  └────────────────────┘  │
                              └────────────┼─────────────┘
                                           │ 🔑 権限チェック
                              ┌────────────┴─────────────┐
                              │     Lake Formation       │
                              └──────────────────────────┘

1)ブループリント (Blueprint)

* 外側にあるデータソースからデータレイク(S3)へ
 データを自動で吸い上げるための、
 AWSがあらかじめ用意してくれた「データ収集の簡単設定テンプレート」

2)データカタログ

* 永続的なメタデータストア (結局は、Glueのデータカタログ)

https://dk521123.hatenablog.com/entry/2019/11/25/235219

より抜粋

メタストア (Metastore)

* メタデータを管理する場所

メタデータ (Metadata)

* テーブル、パーティション、ロールなどの情報

【3】EMRとの絡み

* 2020/10/22現在では、Beta版
 => 日本語訳もまだ不十分っぽい

使用上の注意

* EMR version のバージョンによって、サポートが変わることに注意
~~~~~~
■ EMR version 5.X系
* 対応しているのは、EMR version 5.31.0以降でサポート
 => これ未満のバージョンでは未対応

■ EMR version 6.X系
* 20201022現在までのところ未サポート
~~~~~~

https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-lake-formation.html

Important

If you currently use EMR clusters with Lake Formation in beta mode,
 you should upgrade your clusters to EMR version 5.31.0 or above <<★ここ
 to continue using this feature.
Clusters with an EMR version below 5.31.0 will stop working with Lake Formation. <<★ここ

EMR integration with Lake Formation is not yet available for the EMR 6.x series. <<★ここ

【4】データ取得

https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/what-is-lake-formation.html#features-general

1)AWS 内にあるデータベースからデータをインポート

* Amazon RDS で実行されているデータベースからデータをインポート可能

2)外部ソースからデータをインポートする

* JDBCを使用した接続によるオンプレミスデータベースからのデータ移動に使用

参考文献
https://dev.classmethod.jp/articles/aws-lake-formation-features/

【5】外部アカウントへのアクセス許可

https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/granting-location-permissions-external.html
参考文献
https://dev.classmethod.jp/articles/share-lake-formation-to-external-account/
https://qiita.com/pioho07/items/3fdf35cec122dd73cc98

【6】トランザクション対応テーブル

* Lake Formation Transactions / ACID特性
* Lake FormationがサポートするACIDトランザクション
 (ACIDトランザクションのサポート、
 StartTransaction, CommitTransaction などのAPI)
* AWS Glue Data Catalogのテーブルに対して、
 複数の書き込み・更新処理が同時に走った際の競合を防ぐための仕組み

参考文献

https://acro-engineer.hatenablog.com/entry/2022/03/15/120000

関連記事

LakeFormation ~ アクセス制御 ~
https://dk521123.hatenablog.com/entry/2026/10/16/000010
LakeFormation ~ クロスアカウントデータ共有 ~
https://dk521123.hatenablog.com/entry/2026/10/19/233354
LakeFormation ~ データ監査・一元監視 ~
https://dk521123.hatenablog.com/entry/2026/10/17/223446
LakeFormation ~ AWS CLI ~
https://dk521123.hatenablog.com/entry/2026/10/15/001823
AWS Glue ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2019/10/01/221926
AWS Glue のトラブル ~ job編 - [2] ~
https://dk521123.hatenablog.com/entry/2020/10/12/152659
EMRのStep実行時にエラー「Insufficient Lake Formation permission(s) on default」が表示
https://dk521123.hatenablog.com/entry/2022/05/09/101121
AWS CloudFormation ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2021/10/26/224812
Resource Access Manager ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2022/02/18/132728
Hive / HiveQL ~ 基礎知識編 ~
https://dk521123.hatenablog.com/entry/2019/11/25/235219