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
1
56
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
620
AWS Amplify Gen2向けのVSCode拡張を作って公開してみた話/lts-techday-2024
fossamagna
0
12
CDKアプリとしてのAmplify Gen2 - @aws-amplify/backendのアーキテクチャにみるCDKベストプラクティス -
fossamagna
3
3.2k
Amplify Gen2の 新機能と実践的な使用例 AWS Amplify Gen 2 Festival in Japan/New features and practical use cases in Amplify Gen2
fossamagna
0
700
Amplify Gen2を 拡張してみよう JAWS-UG北陸新幹線 ( 福井開催 ) 2024-04-06/Let's extend Amplify Gen2
fossamagna
0
880
みんな本当に AWS Amplify を知っている?/do-you-really-know-aws-amplify
fossamagna
0
160
Amplify OSSにコントリビュートしてAmplify Badgeを手に入れよう!/contribute-to-amplify-oss-and-get-an-amplify-badge
fossamagna
0
550
Using custom function template with AWS Amplify
fossamagna
1
510
Amplifyで始めるサーバレス開発/serverless-development-starting-with-amplify
fossamagna
0
1.5k
Other Decks in Programming
See All in Programming
10年もののAPIサーバーにおけるCI/CDの改善の奮闘
mbook
0
800
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
2.7k
Railsだからできる 例外業務に禍根を残さない 設定設計パターン
ei_ei_eiichi
0
440
overlayPreferenceValue で実現する ピュア SwiftUI な AdMob ネイティブ広告
uhucream
0
180
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
2
150
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
220
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
520
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
190
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
2
810
理論と実務のギャップを超える
eycjur
0
120
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
110
Devoxx BE - Local Development in the AI Era
kdubois
0
120
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
900
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Thoughts on Productivity
jonyablonski
70
4.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Producing Creativity
orderedlist
PRO
347
40k
Unsuck your backbone
ammeep
671
58k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
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 に対するユーザーとロールを管理する。 これらの権限は継承される アプリのER図 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