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
430
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Amazon Verified Permissions実践入門 〜Cedar活用とAppSync導入事例/Practical Introduction to Amazon Verified Permissions
JAWS FESTA 2025 in Kanazawa
MURAKAMI Masahiko
October 11, 2025
More Decks by MURAKAMI Masahiko
See All by MURAKAMI Masahiko
AmplifyHostingConstructからSSRフレームワークのためのホスティング設計を考察する/amplify-hosting-construct
fossamagna
1
490
AWS Blocks を触ってみた/first-tach-aws-blocks
fossamagna
2
220
AWS Amplifyをもっと便利に使うための取り組み/amplify-tools-and-contributions
fossamagna
1
180
Amplify Gen2から知るAWS CDK Toolkit Libraryの使い方/How to use the AWS CDK Toolkit Library as known from Amplify Gen2
fossamagna
1
970
AWS Amplify Gen2向けのVSCode拡張を作って公開してみた話/lts-techday-2024
fossamagna
0
70
CDKアプリとしてのAmplify Gen2 - @aws-amplify/backendのアーキテクチャにみるCDKベストプラクティス -
fossamagna
3
3.7k
Amplify Gen2の 新機能と実践的な使用例 AWS Amplify Gen 2 Festival in Japan/New features and practical use cases in Amplify Gen2
fossamagna
0
870
Amplify Gen2を 拡張してみよう JAWS-UG北陸新幹線 ( 福井開催 ) 2024-04-06/Let's extend Amplify Gen2
fossamagna
0
1.1k
みんな本当に AWS Amplify を知っている?/do-you-really-know-aws-amplify
fossamagna
0
210
Other Decks in Programming
See All in Programming
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
160
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
240
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
180
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
560
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.3k
仕様駆動開発の消費期限
watany
20
9.1k
React本体のコードリーディング
high_g_engineer
1
160
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
400
My Marp Sample
sinoue0108
0
130
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
200
Go 1.27 における memory allocation の高速化
andpad
0
350
業務時間外もAIに働いてもらう話
colorful12
2
8.7k
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Ruling the World: When Life Gets Gamed
codingconduct
0
310
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.1k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
220
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
220
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
670
Deep Space Network (abreviated)
tonyrice
0
270
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
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