Specificaties
Het VEMAP Backend is een serverless applicatie die draait op AWS en maakt gebruik van verschillende AWS services voor authenticatie, data opslag, messaging en monitoring. De applicatie is gebouwd met het Chalice framework en volgt een hybride architectuur met in de kern een modulair monoliet met kenmerken van een N-tier (layered) architectuur, serverless services voor de API en database, en een microservices architectuur voor de email service. In dit document vind je een overzicht van de AWS services die worden gebruikt in het VEMAP Backend systeem.
AWS Services Overzicht
Section titled “AWS Services Overzicht”Compute & API Services
Section titled “Compute & API Services”AWS Lambda
Section titled “AWS Lambda”- Gebruik: Serverless compute voor de backend applicatie
- Framework: Chalice (Python serverless framework)
- Implementatie: Automatisch beheerd door Chalice deployment
- Regio: eu-central-1 (standaard)
API Gateway
Section titled “API Gateway”- Gebruik: HTTP endpoints en request routing
- Features: CORS configuratie, rate limiting, request/response transformation
- Implementatie: Automatisch geconfigureerd door Chalice
- Security: API key validation en user authentication
Authentication & Authorization
Section titled “Authentication & Authorization”AWS Cognito
Section titled “AWS Cognito”- Gebruik: User authentication en management
- Features:
- User Pool voor gebruikersregistratie en login
- JWT token generatie voor stateless authentication
- Custom attributes (company, fullname, email, sub, phone)
- User groups voor client environment bundling
- Implementatie:
CognitoRepositoryvoor user operationsAuthenticationServicevoor login/logout flows- Role-based access control (ROLE_ADMIN, ROLE_ORGANISATION, ROLE_MANAGER, ROLE_STAKEHOLDER)
AWS IAM
Section titled “AWS IAM”- Gebruik: Role-based permissions en access control
- Features:
- Lambda execution roles
- S3 bucket access policies
- Cognito user pool permissions
- Cross-service access control
Data Storage
Section titled “Data Storage”Amazon RDS (PostgreSQL)
Section titled “Amazon RDS (PostgreSQL)”- Gebruik: Relational database voor applicatie data
- Features:
- Multi-tenant data isolation per client environment
- Connection pooling via psycopg2
- JSONB support voor flexibele data structuren
- Implementatie:
BaseRepositorypattern voor database operaties- Connection management via
SingletonRegistry - Prepared statements voor SQL injection preventie
Amazon S3
Section titled “Amazon S3”- Gebruik: File storage en static website hosting
- Buckets:
- Client Files Bucket: File uploads (VKM plans, support files, logos)
- Message Storage Bucket: HTML email content
- Frontend Bucket: Static website hosting voor React frontend
- Features:
- Presigned URLs voor secure file upload/download
- Folder structure:
{client_env_id}/{project_id}/{closure_id}/files/ - Content type validation en file metadata
- Implementatie:
S3Managerclass voor alle S3 operaties
Communication Services
Section titled “Communication Services”Amazon SQS
Section titled “Amazon SQS”- Gebruik: Message queuing voor asynchrone email processing
- Queues:
- Mail Queue: Email processing queue
- Result Queue: Email delivery results
- Features:
- Batch processing (max 10 messages per batch)
- FIFO queue support
- Message deduplication
- Implementatie:
SQSRepositoryvoor queue operatiesSQSServicevoor email batch processing- Unified email flow (single en bulk emails)
Amazon SES
Section titled “Amazon SES”- Gebruik: Email sending service
- Features:
- SMTP interface voor email verzending
- Delivery status tracking
- Bounce en complaint handling
- Implementatie: Via externe SES microservice
Monitoring & Logging
Section titled “Monitoring & Logging”Amazon CloudWatch
Section titled “Amazon CloudWatch”- Gebruik: Application monitoring en logging
- Features:
- Lambda function logs
- Custom application metrics
- Performance monitoring via timer decorators
- Error tracking en alerting
- Implementatie:
- Custom logging via
Loggerclass - Performance metrics via
@timerdecorator - Business event logging
- Custom logging via
Security & Configuration
Section titled “Security & Configuration”AWS Secrets Manager
Section titled “AWS Secrets Manager”- Gebruik: Secure credential storage
- Features:
- Database connection strings
- API keys en tokens
- Environment-specific configuration
- Implementatie: Via
SingletonRegistryvoor lazy loading
Frontend Hosting
Section titled “Frontend Hosting”S3 Static Website Hosting
Section titled “S3 Static Website Hosting”- Frontend: React applicatie gehost op S3
- Features:
- Static website hosting
- CloudFront CDN voor globale distributie
- HTTPS via SSL certificates
- Implementatie:
- S3 bucket configured voor website hosting
- Index document routing voor SPA
- Error document handling
Architectuur Patterns
Section titled “Architectuur Patterns”Serverless Architecture
Section titled “Serverless Architecture”- Lambda Functions: Event-driven compute
- API Gateway: Request routing en transformation
- SQS: Asynchrone message processing
- S3: Stateless file storage
Microservices Design
Section titled “Microservices Design”- Service-oriented: Elke service heeft eigen verantwoordelijkheid
- Loose coupling: Services communiceren via APIs en queues
- Independent scaling: Elke service kan onafhankelijk schalen
Multi-tenant Architecture
Section titled “Multi-tenant Architecture”- Client Environment Isolation: Data gescheiden per client
- Role-based Access: Gebruikers hebben verschillende permissions
- Resource Sharing: Efficiënt gebruik van AWS resources
Deployment Strategy
Section titled “Deployment Strategy”Chalice Framework
Section titled “Chalice Framework”- Local Development:
chalice localvoor lokale ontwikkeling - Dev Stage:
chalice deploy --stage devvoor development - Production Stage:
chalice deploy --stage prodvoor productie - Automatic Infrastructure: Chalice beheert Lambda en API Gateway
Manual Configuration
Section titled “Manual Configuration”- RDS Database: Handmatig geconfigureerd
- S3 Buckets: Handmatig aangemaakt en geconfigureerd
- Cognito User Pool: Handmatig geconfigureerd
- SQS Queues: Handmatig aangemaakt
- Secrets Manager: Handmatig geconfigureerd
Security Considerations
Section titled “Security Considerations”Data Protection
Section titled “Data Protection”- Encryption in Transit: HTTPS voor alle communicatie
- Encryption at Rest: S3 en RDS encryptie
- Access Control: IAM roles en policies
- Authentication: Cognito JWT tokens
Network Security
Section titled “Network Security”- VPC: Lambda functions in VPC (indien nodig)
- Security Groups: Network access control
- Private Endpoints: Database en service endpoints
Cost Optimization
Section titled “Cost Optimization”Serverless Benefits
Section titled “Serverless Benefits”- Pay-per-use: Alleen betalen voor gebruikte resources
- Auto-scaling: Automatische schaling op basis van load
- No Infrastructure Management: Geen server management
Resource Efficiency
Section titled “Resource Efficiency”- Connection Pooling: Database connection hergebruik
- S3 Lifecycle: Automatische data archival
- Lambda Optimization: Cold start minimalisatie
Monitoring & Observability
Section titled “Monitoring & Observability”Application Metrics
Section titled “Application Metrics”- Performance Tracking: Timer decorators voor function timing
- Business Events: Custom logging voor business logic
- Error Tracking: Comprehensive error logging
Infrastructure Metrics
Section titled “Infrastructure Metrics”- CloudWatch Logs: Centralized logging
- CloudWatch Metrics: Performance en health monitoring
- Custom Dashboards: Business-specific monitoring
Disaster Recovery
Section titled “Disaster Recovery”Data Backup
Section titled “Data Backup”- RDS Automated Backups: Point-in-time recovery
- S3 Cross-Region Replication: Data redundancy
- Secrets Manager: Secure credential backup
High Availability
Section titled “High Availability”- Multi-AZ Deployment: Database high availability
- S3 Durability: 99.999999999% durability
- Lambda Redundancy: Automatic failover
Compliance & Governance
Section titled “Compliance & Governance”Data Governance
Section titled “Data Governance”- Multi-tenant Isolation: Client data separation
- Audit Logging: Comprehensive activity tracking
- Data Retention: Configurable retention policies
Security Compliance
Section titled “Security Compliance”- IAM Best Practices: Least privilege access
- Encryption Standards: Industry-standard encryption
- Access Logging: Comprehensive access tracking
Conclusie
Section titled “Conclusie”De VEMAP Backend infrastructuur is ontworpen voor:
- Scalability: Serverless architecture voor automatische schaling
- Security: Multi-layer security met AWS best practices
- Reliability: High availability en disaster recovery
- Cost Efficiency: Pay-per-use model met optimale resource gebruik
- Maintainability: Chalice framework voor eenvoudige deployment en management
De infrastructuur ondersteunt zowel de backend API als de frontend hosting, met een focus op security, performance en cost optimization.