【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
【2】Lake Formation の 各コンポーネント
 1)ブループリント (Blueprint)
 2)パーミッション
 3)データカタログ
 4)ロギング
【3】関連用語
 1)プリンシパル (Principal)
 2)ペルソナ(persona)
 3)データカタログ(Data Catalog)
【4】EMRとの絡み
【5】データ取得
 1)AWS 内にあるデータベースからデータをインポート
 2)外部ソースからデータをインポートする
【6】外部アカウントへのアクセス許可

【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をラップしたサービスって感じ。
 ⇒ 以下のサイトの概要図が分かりやすい

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

* CloudFormation により、設定の自動化を行うことが可能
 => CloudFormation については、以下の関連記事を参照のこと。

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

費用

* (Lake Formation自体は) 無料

【2】Lake Formation の 各コンポーネント

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

の7:24位 より抜粋

1)ブループリント ... データ取り込みと構造化
2)パーミッション ... セキュリティ&コントロール
3)データカタログ ... 協調&利用
4)ロギング ... 監視&監査

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

* 汎用的なデータ取り込みができるテンプレート。

2)パーミッション

* SQLライクな Grant / Revoke でデータアクセス制御する仕組み

cf revoke = 元に戻す、無効にする

Glueとの違い

* テーブルレベルだけでなく、列レベルでアクセス許可が可能になった
 => 動画(15:09位~)を参照。19:05位~でもGlueとの差異を説明。
 => これは個人情報の管理にもいいかも!

* Lake Formation 独自の管理者「データレイク管理者」を設定できる
 => IAMと組み合わせて、きめ細かいアクセス制御ができそう

アクセス制御の仕組み

* 動画(15:52位~)を参照
 => かなり分かりやすい

3)データカタログ

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

4)ロギング

* コンソール上で直近のアクティビティの履歴と詳細を閲覧

【3】関連用語

* 今回あげる用語以外にも、
 以下の公式サイトにも関連用語が載っている

https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/how-it-works.html#how-it-works-terminology

1)プリンシパル (Principal)

* IAMユーザやIAMロールのこと

2)ペルソナ(persona)

* データレイクを使うユーザタイプ

cf persona = 登場人物, 役割
《心理学》外界に対して見せたいと願う、その人の外面

* e.g. データレイク管理者, データ分析者
* その他の例は、以下の公式サイトを参照。

https://docs.aws.amazon.com/ja_jp/lake-formation/latest/dg/cloudtrail-tut-personas.html

3)データカタログ(Data Catalog)

* 永続的なメタデータストア

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

より抜粋
~~~~~~~~~
メタストア (Metastore)
* メタデータを管理する場所

メタデータ (Metadata)
* テーブル、パーティション、ロールなどの情報
~~~~~~~~~

【4】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. <<★ここ

【5】データ取得

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/

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

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

参考文献

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

関連記事

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