Every decision uses a durable principal, tenant, session assurance and explicit purpose.
Trust is the platform boundary.
A Lambda-first pathway for controlled access to models, knowledge, tools and generated media. Authorization, content rights, geography, guardrails and evidence remain deterministic—even when the model changes.
Cedar and AppConfig change independently from runtime deployments, with validation and rollback.
Applications request capabilities and quality profiles rather than provider model identifiers.
Each request emits policy, content, model, safety and configuration provenance.
Four decisions. Four owners.
The platform remains governable when authentication, authorization, content rights and AI safety are modeled as separate decisions with independent evidence.
Authentication
Question: Who is making the request?
Enterprise OIDC. Durable subject ID. Tenant. Session assurance. Authentication time.
Authorization
Question: May this principal perform this platform action?
Amazon Verified Permissions. Cedar policies. Default-deny. Explicit action and resource.
Content rights
Question: May this principal use this asset now, here and for this purpose?
Entitlement, subscription, time window, country, classification and derivative-use terms.
AI safety
Question: Is this input, retrieved context, action or output acceptable?
Guardrails, schema validation, sanitizers, prompt-injection defenses and evaluations.
Models generate content. They never authorize access. Primary security invariant
Fail closed
Deny when identity, tenant, rights, policy version, geography or required safety enforcement cannot be established.
No direct provider access
Applications do not receive broad model invocation permissions. The governed gateway is the approved invocation boundary.
Separate the path from the policy.
The data plane handles low-latency requests. The control plane governs policies, models, prompts, guardrails and evaluations without coupling changes to application code.
Data plane
Identity, request normalization, authorization, retrieval, provider invocation, output enforcement and evidence.
Control plane
Policy source, schemas, configuration, model catalog, prompts, guardrail versions, evaluations and approvals.
Evidence plane
Operational telemetry and immutable governance events, separated from raw prompt or response retention.
The contract, policy model, audit schema and provider adapters must remain portable to ECS, EKS or another Kubernetes runtime.
Authorize before context becomes capability.
Every request follows the same order. Each stage emits enough evidence to explain why the final response was allowed, constrained, blocked or denied.
Strip spoofable headers. Verify signature, key ID, issue time, expiry and request binding.
Convert provider claims into a stable platform principal. Email is not the durable key.
Evaluate principal, tenant, purpose, subscription, country and application against Cedar policy.
Enforce schema, size, Unicode, secret, PII, content and prompt-injection controls before retrieval.
Metadata narrows candidates. Per-resource authorization remains the final boundary.
Resolve a capability alias to an approved provider, model, region, quota and guardrail version.
Recheck safety, structured output, URLs, citations, data leakage and rights-dependent excerpt limits.
Record decision provenance, content IDs, policy hashes, model route and usage without default raw-content logging.
Entitlement is data, not code.
Premium access, person-specific grants, embargoes, time windows, purpose limits and geographic restrictions should be editable as rights data and policy.
| Rights dimension | Example attribute | Enforcement |
|---|---|---|
| Identity | allowedPrincipalIds, groups, tenant | Per-resource Cedar decision |
| Subscription | minimumSubscription = premium | Policy plus entitlement record |
| Time | validFrom, validUntil, embargo | Signed request time in context |
| Geography | Allowed and denied countries or legal regions | Signed edge context, rechecked at origin |
| Purpose | Support, research, summary, publication | Explicit action and request purpose |
| AI usage | Retrieval, summarization, transformation, training | Separate rights flags and actions |
| Output | Maximum excerpt length, citation requirement | Prompt and response post-processing |
export interface ContentRights {
contentId: string;
contentVersion: string;
tenantId: string;
classification: "public" | "internal" | "confidential" | "restricted";
requiredEntitlement?: string;
minimumSubscription: "free" | "standard" | "premium" | "enterprise";
allowedPrincipalIds?: string[];
allowedGroups?: string[];
allowedCountries?: string[];
deniedCountries?: string[];
validFromEpoch?: number;
validUntilEpoch?: number;
allowedPurposes: string[];
aiRetrievalAllowed: boolean;
summarizationAllowed: boolean;
derivativeGenerationAllowed: boolean;
modelTrainingAllowed: boolean;
maximumExcerptCharacters?: number;
policyVersion: string;
}
Use filters to reduce the candidate set. Load authoritative metadata and authorize each returned content resource before it enters a prompt.
Guard the whole context path.
Input guardrails alone are insufficient. Retrieved documents, structured tool arguments, generated URLs, image prompts and final output each require separate enforcement.
Before retrieval
- Schema and payload limits
- Unicode normalization
- Secret and PII detection
- Direct prompt-injection analysis
- Denied topics and abuse controls
Before inference
- Authorized context only
- Instruction/data separation
- Active markup removal
- Indirect prompt-injection analysis
- Protected prompt template
Before release
- Output guardrail
- Structured schema validation
- URL and HTML sanitization
- Citation authorization check
- Rights-based excerpt enforcement
| Layer | Primary controls | Failure posture |
|---|---|---|
| Edge | WAF, bot controls, coarse quotas, size limits | Reject obvious abuse early |
| Identity | JWT claims, issuer, audience, session assurance | Deny unverified identity |
| Request | JSON schema, normalization, replay and idempotency | Reject malformed request |
| Retrieval | Ingestion quarantine, metadata filters, resource authorization | Exclude unauthorized context |
| Model | Approved alias, token limits, region policy, timeout | No uncontrolled fallback |
| Output | Guardrail, data loss prevention, citation and format checks | Block, transform or safe refusal |
| Evidence | Redaction, digests, immutable audit archive | Do not log raw sensitive content by default |
A knowledge document can contain instructions designed to override the system, exfiltrate data or trigger tools. It must never inherit authority from its storage location.
Route capabilities, not model IDs.
Clients request governed capabilities. The platform resolves provider, model, region, quota, guardrail and cost profile at runtime.
Client-facing aliases
knowledge-balanced, regulated-text, low-latency, approved-image.
Aliases remain stable when providers, versions or regions change.
Provider adapter ownership
Credential handling, request translation, streaming normalization, retries, usage extraction and provider error mapping.
Authorization remains outside the adapter.
export type AICapability =
| "chat"
| "structured-output"
| "embeddings"
| "image-generation"
| "tool-use";
export interface ModelProviderAdapter {
readonly providerId: string;
supports(capability: AICapability): boolean;
invoke(
request: GovernedAIRequest,
context: GovernedContext,
signal: AbortSignal
): AsyncIterable<GatewayEvent>;
}
A provider outage may trigger an approved route change. It must not remove a required guardrail, broaden data residency or reduce the authorization posture.
Policy changes are production changes.
Cedar, AppConfig, prompts, guardrails and model routes require schema validation, regression tests, provenance and staged release—even when no application code changes.
Verified Permissions
Fine-grained action and resource policy. Use a strict Cedar schema and policy validation for production stores.
AWS AppConfig
Model routes, quotas, country controls, feature flags and kill switches with validators, staged deployment and rollback alarms.
Guardrail registry
Named, versioned safety policies. Routes pin a tested guardrail version rather than resolving an unversioned mutable configuration.
ai-governance/
├── cedar/
│ ├── schema.json
│ ├── platform/
│ ├── knowledge/
│ └── images/
├── appconfig/
│ ├── model-routes.json
│ ├── quotas.json
│ └── emergency-controls.json
├── guardrails/
├── prompts/
├── evals/
│ ├── authorization/
│ ├── safety/
│ ├── retrieval/
│ └── model-quality/
└── provenance/
└── release-manifest.schema.json
Every answer needs an evidence trail.
The system must reconstruct who requested what, which rights and policies applied, what content was authorized, which route ran and what safety decisions occurred.
Operational telemetry
CloudWatch metrics and logs, X-Ray traces, latency, errors, quotas, provider health and cost units.
Governance evidence
Structured events through Data Firehose into a dedicated, KMS-encrypted S3 archive protected by Object Lock.
| Evidence category | Record | Avoid by default |
|---|---|---|
| Identity | Principal hash, tenant, application, session assurance | Email or unnecessary profile data |
| Authorization | Decision, policy store, bundle hash, determining policies | Opaque “allowed=true” only |
| Content | Requested, allowed and denied content IDs; rights versions | Full protected document text |
| AI route | Provider, alias, resolved model, prompt and guardrail versions | Unversioned “latest” references |
| Usage | Input/output tokens, latency, cost units, result class | Secrets, access tokens and raw credentials |
| Integrity | Input/output digests and archive checks | Raw prompt/response retention as the standard path |
Authorization evaluations
Zero cross-tenant, premium, person, embargo, time-window or geography leakage.
Safety evaluations
Direct and indirect injection, secret extraction, PII, jailbreaks, malicious URLs and tool misuse.
Quality evaluations
Groundedness, citation precision, retrieval recall, refusal correctness, answer relevance and hallucination rate.
A safer model cannot compensate for an authorization regression or a metadata-filter bug. Release gates must cover the entire trust path.
Enrich at the edge. Decide at the origin.
Edge infrastructure can reduce abuse and attach signed geography or network risk. It should not become the sole authority for legal or rights-sensitive access.
Akamai
Best when the enterprise perimeter already uses Akamai. EdgeWorkers can validate JWTs, apply bot signals and sign context.
CloudFront
AWS-native path with WAF, Shield, origin controls and viewer geography headers. Keep personalized AI responses uncacheable.
Varnish
Flexible and capable when already standardized. Requires explicit ownership for patching, policy distribution, observability and availability.
{
"requestId": "0190…",
"country": "CO",
"region": "ANT",
"networkRisk": "low",
"issuedAt": 1784451600,
"expiresAt": 1784451660,
"keyId": "edge-context-2026-07"
}
The gateway must strip internal headers, verify the edge signature and fail closed when a jurisdiction is required but cannot be established.
Trust scales through account boundaries.
Separate policy ownership, runtime operation, content stewardship, security detection and immutable evidence while keeping the synchronous request path regional and resilient.
Governance owns
Policy source, schemas, release authority, evaluation datasets and signed release manifests.
Platform owns
Runtime, regional policy stores, adapters, SLOs, incident response and deployment automation.
Content owners own
Authoritative rights metadata, classification, legal restrictions, embargoes and allowed AI transformations.
Start with governed knowledge.
Knowledge answering exercises the full platform boundary: identity, subscription, geography, resource rights, retrieval safety, model routing, citations and evidence.
| Capability | Recommended first implementation | Why |
|---|---|---|
| Perimeter | Akamai or CloudFront + AWS WAF | Existing enterprise edge or AWS-native control |
| API | API Gateway REST API | Managed ingress, authorizers, quotas and response streaming path |
| Runtime | TypeScript Lambda | Fast delivery and AWS SDK integration |
| Authorization | Amazon Verified Permissions | Externalized Cedar policy |
| Configuration | AWS AppConfig | Validated, staged operational policy and rollback |
| Knowledge | S3 + Bedrock Knowledge Bases | Managed retrieval with metadata filters |
| Rights | DynamoDB or dedicated rights service | Authoritative resource metadata and versioning |
| Safety | Bedrock Guardrails + application validators | Independent input/output checks and deterministic schema controls |
| Evidence | Firehose → S3 Object Lock | Durable and tamper-resistant governance trail |
Resolve tenant, durable subject, premium tier, groups and session assurance.
Include purpose, application, subscription, geography and requested collection scope.
Block or transform unsafe, secret-bearing or malformed inputs before retrieval.
Constrain by tenant, entitlement, validity window, country and allowed purpose.
Exclude any chunk whose authoritative rights record does not independently allow access.
Invoke the approved route, apply output guardrails and validate citations against the authorized source set.
Generated media stays quarantined until cleared.
Image generation adds person, brand, intellectual-property, publication and provenance controls. It should reuse the same action, policy and audit model.
Rights
Commercial use, publication, person likeness, protected brands, characters and permitted transformations.
Safety
Prompt controls, image moderation, minor safety, prohibited content and human review thresholds.
Provenance
Provider/model alias, prompt digest, watermark or C2PA status, output digest, retention and release decision.
Model availability, capability and regional support change. Keep provider identifiers behind the approved model catalog and evaluation process.
Choose operations proportionate to the workload.
Lambda is the preferred first runtime. ECS or EKS becomes appropriate when sustained connections, long workflows, specialized networking or self-hosted inference justify the operational cost.
| Runtime | Use when | Trade-off |
|---|---|---|
| Lambda | Initial gateway, bursty traffic, straightforward RAG, policy orchestration | Concurrency, long workflows, connection behavior and cold-path tuning |
| ECS/Fargate | Sustained traffic, connection pooling, long-lived streams, predictable capacity | More runtime operations and capacity management |
| EKS/Kubernetes | Existing platform mandate, service mesh, GPU/self-hosted inference, specialized sidecars | Highest security and operational burden |
TypeScript first
Best delivery velocity for Lambda, JSON contracts, AWS SDKs, streaming web APIs and shared application types.
Go selectively
Use for profiled high-throughput processors, sustained services, ingestion workers or resource-constrained components.
Stabilize the policy contract, adapter boundary and audit schema before creating a second runtime implementation.
Make the trust boundary explicit in code.
The initial repository should keep transport, domain policy, provider adapters, retrieval, safety and evidence isolated behind testable interfaces.
Data-plane API
POST /v1/responses
POST /v1/retrieve
POST /v1/images/generations
GET /v1/image-jobs/{jobId}
GET /v1/models
GET /v1/usage
Administrative boundary
Keep policy, model approval, guardrail, rights administration and evaluation APIs separate from the public AI data plane.
Require stronger identity assurance and explicit separation of duties.
src/
├── transport/
│ ├── api-gateway.ts
│ └── response-stream.ts
├── identity/
│ ├── jwt-validator.ts
│ └── principal-normalizer.ts
├── authorization/
│ ├── policy-client.ts
│ ├── action-catalog.ts
│ └── rights-authorizer.ts
├── safety/
│ ├── input-pipeline.ts
│ ├── output-pipeline.ts
│ └── guardrail-client.ts
├── retrieval/
│ ├── metadata-filter.ts
│ ├── knowledge-base.ts
│ └── citation-validator.ts
├── models/
│ ├── router.ts
│ ├── provider-adapter.ts
│ └── providers/bedrock.ts
├── audit/
│ ├── event-schema.ts
│ └── publisher.ts
└── application/
└── governed-response.ts
Non-negotiable decisions
Direct provider invocation by product applications is denied by IAM and organizational controls.
IAM secures workloads and AWS resources. Neither replaces the other.
Vector filters improve precision. They do not replace authorization.
No mutable “latest” dependency in a production decision trail.
Identity, jurisdiction, content rights and required safety state must be established.
Use IDs, digests, policy evidence and tightly governed diagnostic sampling.
Permission to answer does not imply permission to publish, send, modify or transact.
Safety, rights, provenance and release policy apply before delivery.
Deliver trust before breadth.
The first release should prove the complete decision and evidence path with one use case. Expansion becomes safer after the core contracts stabilize.
Governed knowledge
Prove the full platform boundary.
- Canonical API
- OIDC principal
- Cedar schema
- Rights-aware retrieval
- Input/output guardrails
- Immutable evidence
Platform hardening
Increase resilience and operability.
- Multi-region runtime
- Regional policy stores
- Cost and usage quotas
- Provider failover
- Advanced evaluations
- Formal SLOs
Image generation
Extend the same governance model.
- Image actions and rights
- Async job orchestration
- Output moderation
- Provenance controls
- Quarantine and review
- Signed delivery
Tools and agents
Authorize each consequential action.
- Tool registry
- Purpose-bound scopes
- Step-up authentication
- Approval workflows
- Action-level audit
- Revocation and kill switches
Identity issues the ticket. Policy controls the gate. Rights determine the destination. Guardrails inspect the cargo. Evidence records the journey. Operating model
Research and source register.
The architecture prioritizes official AWS documentation and recognized security or governance standards. Product availability and regional support must be revalidated during implementation.
Method
Synthesized service capabilities, security boundaries, policy design, evaluation practices and deployment trade-offs into an engineering reference architecture.
Evidence preference
Official AWS service documentation first. NIST and OWASP for risk and threat taxonomy. Edge-vendor documentation for edge-specific capabilities.
Freshness rule
Reconfirm model availability, regions, quotas, pricing, API limits and service-specific feature support before production approval.
| ID | Source | Supports |
|---|---|---|
| S01 | Amazon Verified Permissions overview | Externalized fine-grained authorization using Cedar |
| S02 | Verified Permissions policy store schema | Production schema validation and policy consistency |
| S03 | Bedrock ApplyGuardrail API | Independent input and output policy enforcement |
| S04 | Bedrock Knowledge Base retrieval | Retrieval behavior and guardrail boundary |
| S05 | Bedrock RetrievalFilter API | Metadata filtering before candidate return |
| S06 | Amazon Bedrock Knowledge Bases | Managed RAG and knowledge architecture |
| S07 | Amazon S3 Object Lock | WORM protection for governance evidence |
| S08 | CloudTrail log file integrity validation | Digitally signed log digests and integrity checks |
| S09 | Amazon Bedrock evaluations | Model, knowledge base and external RAG evaluation |
| S10 | NIST AI Risk Management Framework | AI risk governance lifecycle |
| S11 | OWASP Top 10 for LLM Applications | Threat model and prompt-injection test coverage |
| S12 | Amazon Titan Image Generator | Image generation, watermarking and C2PA metadata |
| S13 | Akamai EdgeWorkers JWT | Edge JWT verification capability |
| S14 | CloudFront geographic restrictions | Geographic enforcement characteristics and limits |
| S15 | Building Lambda functions with TypeScript | TypeScript Lambda implementation |
| S16 | Lambda response streaming | Streaming through API Gateway proxy integration |
| S17 | AWS AppConfig automatic rollback | CloudWatch-alarm-based configuration rollback |
| S18 | S3 CloudTrail data event logging | Explicit data-plane audit configuration |
Each major section declares source IDs in its header. The source registry maps those IDs to authoritative documentation and the specific architectural claim they support.