How aws-samples/avp-petstore-sample works
This is an Amplify-hosted Pet Store sample demonstrating Cognito sign-in and role- and attribute-based authorization through Amazon Verified Permissions. A signed-in user selects role-specific pet or order actions in the React app; the app sends an authenticated API request, and the Lambda backend verifies the token, constructs authorization entities and a resource, and asks Verified Permissions for a decision. The README also describes manual setup of Cognito users/groups and Verified Permissions schema and policies. Some backend wiring is documented rather than visible in sampled source.
Main entry points: index.js Authorization handler · App.js Role actions UI · override.ts Cognito user pool · petstoreapi REST API
Components 9
Pet Store app
- Role actions UI
src/App.js
Backend API
- REST API
amplify/backend/api/petstoreapi - Authorization handler
amplify/backend/function/petstoresample78b39c63/src/index.js - Action mapping
amplify/backend/function/petstoresample78b39c63/src/index.js - Entity context
amplify/backend/function/petstoresample78b39c63/src/index.js
Identity
- Cognito user pool
amplify/backend/auth/petstoresample483a619c/override.ts
Authorization
- Verified Permissions
Other components
- Pet Store user
- AWS console administrator
Connections 10
- Pet Store user → Role actions UI: uses
README.md - Role actions UI → Cognito user pool: signs in; gets token
src/App.js - Role actions UI → REST API: sends requests
src/App.js - REST API → Authorization handler: routes requests
README.md - Authorization handler → Cognito user pool: verifies token
amplify/backend/function/petstoresample78b39c63/src/index.js - Authorization handler → Action mapping: maps route
amplify/backend/function/petstoresample78b39c63/src/index.js - Authorization handler → Entity context: builds entities
amplify/backend/function/petstoresample78b39c63/src/index.js - Authorization handler → Verified Permissions: asks decision
amplify/backend/function/petstoresample78b39c63/src/index.js - AWS console administrator → Cognito user pool: manages users
README.md - AWS console administrator → Verified Permissions: configures policies
README.md