Full-stack architecture and tenant boundaries
Design a tenant boundary end to end
Host a frontend with Amplify or S3 behind CloudFront with private origin access. Authenticate with Cognito; use API Gateway/Lambda or AppSync for controlled APIs. For pooled DynamoDB data, include tenant in access keys and enforce authorized tenant in every access path, including indexes; use condition expressions for writes. For RDS use tenant-scoped parameterized queries, composite constraints and where appropriate database row security with carefully managed session context. Separate databases/accounts may be appropriate for stricter isolation but add operational cost. Never rely on a UI filter, a partition key alone or an untrusted tenant header.
File uploads are delegated capabilities
After authorization, generate a unique server-assigned object key such as north/uploads/u-7/photo.bin. Issue a short-lived presigned PUT URL for that key from a limited signing role. Treat the URL as a bearer capability; avoid logs and public buckets. The URL can generally be reused before expiry and a PUT to an existing key can replace the object. Where enforced upload size is needed, consider presigned POST policy conditions or an upload proxy; verify actual size, type and content after upload in a private quarantine area before making it available. Keep downloads authorized and lifecycle-clean abandoned uploads.
Cache without leaking tenant data
Cache immutable versioned frontend assets at CloudFront; keep user-specific API responses uncached by default. A shared cache key that ignores identity can return North data to South. If caching private data is necessary, design keys and origin authorization so tenants and permission scopes cannot collide, and handle revocation and invalidation. Do not assume Cache-Control alone overrides a cache policy with positive minimum TTL. Log cross-tenant denials and correlation IDs across API, queue and worker, with retention and redaction. Measure cost per completed job including storage, requests, transfers, retries, messages and logs; set operational limits rather than relying on alerts as a hard cap.
Practice with a local app
In lab-fixtures/full-stack-review, run python test_full_stack.py. The app uses SQLite and synthetic post-verification subjects, not an actual web server or token verifier. North editor may create a job and North reader may read it; South reader and unknown subjects must be denied. Retry the same creation key, change its payload, simulate completion twice, and inspect the audit log. Verify a user cannot subscribe to another tenant channel or mint its upload key. Revisit API Gateway, SQS/SNS, EventBridge, Cognito identity and the frontend HTML/JavaScript and backend HTTP/database tracks for prerequisite skills; cross-track publication links remain unverified. No AWS account or paid service is required.
{ "tenant": "north", "key": "req-1", "photo": "north/uploads/u-7/photo.bin"}Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Full-stack architecture and tenant boundaries — knowledge check
Distinguish identity, integration and tenant-safe resource access.
What makes a pooled database query tenant-safe?
What risk remains with a presigned PUT URL?
What is the safest default for tenant-specific API caching?
Which audit entry avoids exposing credentials?
What must a test demonstrate to support tenant isolation?