Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Amazon Verified Permissions実践入門 〜Cedar活用とAppSy...
Search
MURAKAMI Masahiko
October 11, 2025
Programming
2
230
Amazon Verified Permissions実践入門 〜Cedar活用とAppSync導入事例/Practical Introduction to Amazon Verified Permissions
JAWS FESTA 2025 in Kanazawa
MURAKAMI Masahiko
October 11, 2025
Tweet
Share
More Decks by MURAKAMI Masahiko
See All by MURAKAMI Masahiko
Amplify Gen2から知るAWS CDK Toolkit Libraryの使い方/How to use the AWS CDK Toolkit Library as known from Amplify Gen2
fossamagna
1
750
AWS Amplify Gen2向けのVSCode拡張を作って公開してみた話/lts-techday-2024
fossamagna
0
26
CDKアプリとしてのAmplify Gen2 - @aws-amplify/backendのアーキテクチャにみるCDKベストプラクティス -
fossamagna
3
3.4k
Amplify Gen2の 新機能と実践的な使用例 AWS Amplify Gen 2 Festival in Japan/New features and practical use cases in Amplify Gen2
fossamagna
0
780
Amplify Gen2を 拡張してみよう JAWS-UG北陸新幹線 ( 福井開催 ) 2024-04-06/Let's extend Amplify Gen2
fossamagna
0
940
みんな本当に AWS Amplify を知っている?/do-you-really-know-aws-amplify
fossamagna
0
170
Amplify OSSにコントリビュートしてAmplify Badgeを手に入れよう!/contribute-to-amplify-oss-and-get-an-amplify-badge
fossamagna
0
570
Using custom function template with AWS Amplify
fossamagna
1
540
Amplifyで始めるサーバレス開発/serverless-development-starting-with-amplify
fossamagna
0
1.5k
Other Decks in Programming
See All in Programming
GoLab2025 Recap
kuro_kurorrr
0
3.6k
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.3k
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
3
420
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
210
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
930
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
460
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
240
[AI Engineering Summit Tokyo 2025] LLMは計画業務のゲームチェンジャーか? 最適化業務における活⽤の可能性と限界
terryu16
2
280
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
340
Implementation Patterns
denyspoltorak
0
150
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
ゲームの物理 剛体編
fadis
0
400
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
190
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
130
Exploring anti-patterns in Rails
aemeredith
2
220
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
51
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Visualization
eitanlees
150
16k
For a Future-Friendly Web
brad_frost
180
10k
Color Theory Basics | Prateek | Gurzu
gurzu
0
170
It's Worth the Effort
3n
188
29k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Discover your Explorer Soul
emna__ayadi
2
1k
Transcript
Amazon Verified Permissions 実践入門 〜Cedar 活用と AppSync 導入事例〜 JAWS FESTA
2025 in Kanazawa 2025-10-11 株式会社永和システムマネジメント プリンシパルエンジニア 村上 雅彦 a.k.a @fossamagna Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 1
自己紹介 名前: 村上 雅彦 所属: 株式会社永和システムマネジメント コミュニティ活動: Amplify Japan User
Group 運営メンバ ー、AWS Community Builder (DevTools since 2022) X (Twitter): @fossamagna GitHub: @fossamagna Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 2
アジェンダ 1. 認可実装での課題と背景 2. Amazon Verified Permissions(AVP)/Cedar の基礎 3. Amplify
Gen2 / AppSync 概要 4. AVP を AppSync に統合する(Amplify Gen2 ベース) 5. Cedar ポリシーのテスト 6. まとめ Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 3
Amazon Verified Permissions を採用した背景 AWS Amplify 標準機能だけでは表現が難しく複雑な認可要件が発生 権限情報はアプリケーションのデータとして管理したい(属性ベースのアクセス制 御) アプリロジックと認可を分離して実装したい(AWS
Amplify が自動生成したコード も利用したい) Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 4
Amazon Verified Permissions(AVP) と Cedar AVP: Cedar ポリシーを評価するマネージドサービス Cedar: 読みやすいポリシー言語(permit/forbid、Principal/Action/Resource)
permit( principal in Group::"Viewrs", action == Action::"read", resource == File::"144887AF-402E-4BC3-897E-3A62F38CC8D7" ); 認可判定は IsAuthorized で問い合わせ、結果(allow/deny)が返ってくる Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 5
アプリのデータ構造 アプリのデータは Project, Folder, File がそれぞれ 1 対多の関係をもつ階層構造 ProjectMember で
Project に対するユーザーとそのロール( owner , contributor , viewer )、 FolderMember で Folder に対するユーザーとロールを管理する。 これらの権限は継承される Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 6
属性ベース(ABAC)のポリシー定義 principal.viewerProjects に含まれる Project 配下の Folder、または、 principal.viewerFolders に含まれる Folder に対して
Query.getFolder という アクションを許可するポリシー 権限に関する情報を Cedar 以外のストアで管理し、リソースへのきめ細やかな アクセスコントロールを必要とするため ABAC を採用 permit ( principal, action == Action::"Query.getFolder", resource ) when { resource in principal.viewerProjects || resource in principal.viewerFolders }; Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 7
AVP(IsAuthorized) のリクエスト ID: folder-123 の Folder リソースに対して Query.getFolder の操作を実行する fossamagna
というプリンシパルの承認を判断するためのリクエスト { "principal": { "entityType": "App::User", "entityId": "fossamagna" }, "action": { "actionType": "Action", "actionId": "Query.getFolder" }, "resource": { "entityType": "App::Folder", "entityId": "folder-123" }, "entities": { "entityList": [ { "identifier": { "entityType": "App::Folder", "entityId": "folder-123" }, "parents": [{ "entityType": "App::Project", "entityId": "project-123" }] }, ... { "identifier": { "entityType": "App::User", "entityId": "fossamagna" }, "attributes": { "viewerProjects": {"set":[{"entityIdentifier": { "entityType": "App::Project", "entityId": "project-123" }}]} } } ] }, "policyStoreId": "PSEXAMPLEabcdefg111111" } Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 8
AVP(IsAuthorized) のレスポンス decision の ALLOW / DENY で結果を判断 { "determiningPolicies":
[ { "PolicyId": "SPEXAMPLEabcdefg111111" } ], "decision": "ALLOW", "errors": [] } Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 9
AWS Amplify Gen2 / AppSync 概要 AWS Amplify Gen2: TypeScript
でインフラ/データ API を宣言、すぐに AppSync に デプロイして API を構築可能 AppSync: GraphQL API、パイプラインリゾルバーで任意の処理をパイプライン状 に繋げて実装できる(ビジネスロジックの前後に認可を挿入しやすい) データソース: DynamoDB / HTTP / Lambda / RDS など Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 10
AppSync のリゾルバーの 動作と認可処理の実装方針 AppSync は GraphQL リクエスト に対してフィールド毎に対応す るリゾルバーを呼び出す getFolder
-> Query.getFolder files -> Folder.files project -> Folder.project データモデル毎のリゾルバー、 それぞれで認可チェックが必要 Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 11
自動生成される Query.getFolder のパイプラインリゾルバー 1. Amplify(Cognito)の認証 2. DynamoDB からのデータ取得 Amazon Verified
Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 12
認可処理を追加した Query.getFolder のパイプラインリゾルバー 1. principalAttrsFn: AVP へのリクエストに含める Principal の属性情報を取得する関数 2.
isAuthorizedFn: AVP の IsAuthorized の HTTP API を呼び出す関数 Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 13
自動生成される Mutation.updateFolder のパイプラインリゾルバー 1. Amplify(Cognito)の認証 2. DynamoDB からのデータ取得(更新対象データの存在チェック) 3. DynamoDB
に対する対象データの更新処理 Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 14
認可処理を追加した Mutation.updateFolder の パイプラインリゾルバー 1. principalAttrsFn: AVP へのリクエストに含める Principal の属性情報を取得する関数
2. GetItemFn: AVP へのリクエストに含める Resource を取得する関数 3. isAuthorizedFn: AVP の IsAuthorized の HTTP API を呼び出す関数 Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 15
Cedar ポリシーの自動テスト @cedar-policy/cedar-wasm を利用して IsAuthorized が実行可能 vitest などと組み合わせて自動テストでポリシーのテストが可能 import {
test, expect } from "vitest"; import * as cedar from "@cedar-policy/cedar-wasm/nodejs"; test("FolderMemberにviewerで登録された場合、Query.getFolderの認可判定がALLOWになること", () => { const policies = new cedar.PolicySet(/* Cedar policy text */); const result = cedar.isAuthorized({ principal: { type: "User", id: "fossamagna" }, action: { type: "Action", id: "Query.getFolder" }, resource: { type: "Folder", id: "folder-123" }, entities: {...}, policies, }); expect(result.response.decision).toBe("allow"); }); Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 16
まとめ AVP/Cedar により 複雑なモデル・認可ルールに対応可能 AppSync パイプラインリゾルバーで認可処理を追加可能 DynamoDB データソース、HTTP データソースにより低遅延を実現 初期実装は
Lambda リゾルバー + AppSync API 呼び出しを利用したため性能 問題が発生 ポリシーとアプリロジックが分離されるので並行開発も可能 Cedar ポリシーをテスト自動化で品質を担保 認可処理が必要な場合には AVP を検討してみてください Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 17
参考資料 サンプルリポジトリ github.com/fossamagna/amplify-verified-permissions-examples このスライドの内容を実際に動かして確認可能 Amazon Verified Permissions ユーザーガイド Cedar policy
language AWS AppSync GraphQL デベロッパーガイド Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in Kanazawa 18
ご清聴、ありがとうございました! Amazon Verified Permissions 実践入門 〜Cedar活用とAppSync導入事例〜 JAWS FESTA 2025 in
Kanazawa 19