System Architecture
The AVP Demo is a serverless application built on AWS that demonstrates fine-grained authorization using AWS Verified Permissions (AVP). The architecture follows a secure, scalable design pattern that separates authorization logic from application code.Architecture Diagram
The system consists of the following components:Component Relationships
API Gateway
The API Gateway serves as the entry point for all requests:- Stage:
prod - CORS: Enabled for all origins (demo purposes)
- Endpoints: Three main endpoints for access checking, user listing, and AI agent queries
Lambda Functions
Three Lambda functions handle different aspects of the application:- CheckAccessFunction (
avp-check-access): Validates user access requests against AVP policies - GetUsersFunction (
avp-get-users): Provides demo user and resource data for the UI - AgentFunction (
avp-agent): AI-powered agent that answers natural language questions about permissions
AWS Verified Permissions
AVP is the authorization engine that evaluates Cedar policies. The Policy Store contains:- Cedar Policies: Fine-grained access control rules
- Entity Types: User, Role, Document, Action
- Schema: Defines the structure of entities and their relationships
The Policy Store ID is passed as a CloudFormation parameter and made available to Lambda functions via environment variables.
Data Flow
Access Check Flow
- Frontend Request: User selects a principal, action, and resource
- API Gateway: Routes POST request to CheckAccessFunction
- Lambda Processing:
- Validates request parameters
- Constructs entity list with user and resource attributes
- Calls AVP
is_authorizedAPI
- AVP Evaluation:
- Evaluates Cedar policies against the request
- Returns ALLOW or DENY decision
- Response: Lambda returns decision with detailed information
AI Agent Flow
- User Question: Natural language query about permissions
- Agent Lambda: Receives conversation messages
- Anthropic API: Claude processes the query with tool definitions
- Agentic Loop:
- Claude decides if it needs to check permissions
- Agent executes
check_avp_accesstool - Results feed back to Claude for reasoning
- Response: Natural language explanation of permissions
The AI agent acts as a secure proxy - the Anthropic API key is never exposed to the frontend.
Security Design
IAM Permissions
Each Lambda function has minimal IAM permissions:IsAuthorized API, following the principle of least privilege.
Secrets Management
Sensitive configuration is handled securely:- Policy Store ID: CloudFormation parameter, stored in environment variables
- Anthropic API Key: CloudFormation NoEcho parameter, only accessible to AgentFunction
Authorization Pattern
The application implements externalized authorization:- Authorization logic lives in AVP (Cedar policies)
- Application code only makes authorization decisions, doesn’t implement them
- Policies can be updated without deploying code changes
Demo Data
The application includes three demo users:- Alice Garcia: Finance Analyst, clearance level 2
- Bob Torres: Finance Admin, clearance level 3
- Carol Mendez: HR Auditor, clearance level 1
- Q4-Report-2024: Finance document, confidential classification
- HR-Payroll-2024: HR document, restricted classification
- Sales-Dashboard: Sales document, internal classification
In production, user attributes would come from an Identity Provider (Cognito, Okta, etc.) rather than hardcoded data.
Deployment
The infrastructure is defined intemplate.yaml using AWS SAM (Serverless Application Model):
Key Design Decisions
Serverless Architecture
Why: Zero infrastructure management, automatic scaling, pay-per-use pricingEntity Lists
Why: AVP needs entity attributes to evaluate ABAC (Attribute-Based Access Control) policies. Entity lists provide user departments, clearance levels, and resource classifications.AI Agent Pattern
Why: Natural language interface makes permissions more accessible to non-technical users while maintaining security through the Lambda proxy pattern.Cedar Policy Language
Why: Cedar provides human-readable, analyzable authorization policies that can be validated and tested independently of application code.Next Steps
Lambda Functions
Detailed documentation of each Lambda function
AVP Integration
How the application integrates with AWS Verified Permissions
AI Agent
Deep dive into the agentic authorization system
Quick Start
Deploy and run the demo