EKM System Design for Writer Inc.
Interactive visualization of Enterprise Key Management approaches, third-party solutions, and architecture patterns for a multi-cloud LLM platform
Categories
Edge Types
1. What Is EKM and Why It Matters
Enterprise Key Management (EKM) gives each customer control over the encryption keys that protect their data inside a SaaS product. Slack popularised the model: the customer creates a CMK (Customer Master Key) in their own AWS account; Slack uses that key -- via cross-account IAM grants -- to wrap and unwrap per-tenant Data Encryption Keys (DEKs) at rest. If the customer revokes the IAM role, Slack loses the ability to decrypt and data becomes inaccessible within the DEK cache TTL.
For Writer Inc., a 100-person company building enterprise LLMs, the same semantics apply to prompts, completions, fine-tuning datasets, model artifacts, and conversation history.
2. EKM Design Options (A - D)
Option A: EKM-Lite (BYOK Wrapper)
Customer provides a CMK ARN or resource-ID. Writer uses it for envelope encryption. Simplest path -- no revoke semantics, key stays in cloud KMS.
- Fastest to ship
- SOC 2 checkbox satisfied
- No instant revoke -- customer must request key disable
Option B: Slack-Style EKM
Customer creates CMK in their own AWS/GCP account. Writer calls customer KMS via cross-account IAM to wrap/unwrap DEKs. Customer revokes IAM role to cut access instantly.
- True customer control with instant revoke
- Full audit trail in customer's CloudTrail / Cloud Audit Logs
- Requires DEK cache (TTL 5 - 15 min) + circuit-breaker
- Customer onboarding: Terraform/CloudFormation template for IAM role + CMK policy
Option C: HYOK / XKS / HSM
Customer hosts keys entirely outside the cloud. Uses AWS XKS proxy or GCP EKM endpoint. Keys never leave customer premises.
- Maximum possible control -- meets defence/intelligence bar
- Latency-sensitive (every unwrap is an external call)
- Customer must operate XKS proxy or CloudHSM (~$1,100/mo per HSM)
Option D: Vendor Control Plane (Baseline)
Writer manages all keys internally. Standard cloud encryption with Writer-owned KMS keys. No customer key control.
- Zero customer effort
- Cannot market as EKM / BYOK
- Suitable for SMB / self-serve plans
3. Recommended Architecture (Slack-Style EKM)
The recommended Slack-style EKM architecture consists of these components:
┌──────────────────────────────────────────────────────────────┐
│ Customer AWS / GCP Account │
│ ┌────────────┐ IAM role / service-account grant │
│ │ CMK (KMS) │ ◄──── Writer Crypto Service calls │
│ └────────────┘ GenerateDataKey / Decrypt │
│ CloudTrail / Cloud Audit Logs │
└──────────────────────────────────────────────────────────────┘
│
wrap/unwrap DEK│
▼
┌──────────────────────────────────────────────────────────────┐
│ Writer Infrastructure │
│ │
│ ┌─────────────────┐ ┌───────────────────────────┐ │
│ │ Writer App │──► │ Crypto Service │ │
│ │ (LLM Platform) │ │ • envelope encrypt/decrypt│ │
│ └─────────────────┘ │ • DEK cache (TTL 5-15 min)│ │
│ │ • circuit breaker │ │
│ │ • audit log │ │
│ └───────────┬───────────────┘ │
│ │ │
│ ┌───────────▼───────────────┐ │
│ │ Global Key Registry │ │
│ │ tenant → cloud, key_arn, │ │
│ │ status, rotation_schedule │ │
│ └───────────┬───────────────┘ │
│ │ │
│ ┌───────────▼───────────────┐ │
│ │ Encrypted Tenant Data │ │
│ │ S3/GCS, RDS/CloudSQL, │ │
│ │ prompts, completions, │ │
│ │ fine-tuning data │ │
│ └───────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
Envelope Encryption Flow
- Write path: Crypto Service calls customer KMS
GenerateDataKey→ receives plaintext DEK + wrapped DEK. Encrypt data with plaintext DEK (AES-256-GCM). Store wrapped DEK alongside ciphertext. Wipe plaintext DEK from memory. - Read path: Check DEK cache. On miss, call customer KMS
Decryptwith wrapped DEK → get plaintext DEK. Decrypt data. Cache plaintext DEK (TTL 5 - 15 min). - Revoke path: Customer removes IAM role → next cache miss fails → data inaccessible within cache TTL.
Implementation Milestones
| Week | Milestone |
|---|---|
| 1 - 2 | Crypto Service scaffold, envelope encrypt/decrypt, unit tests |
| 3 - 4 | Cross-account IAM integration (AWS), customer onboarding Terraform module |
| 5 - 6 | DEK cache + circuit breaker, GCP Cloud KMS integration, key registry |
| 7 - 8 | Key rotation automation, revoke testing, audit log pipeline |
| 9 - 10 | Admin dashboard, customer onboarding wizard, load testing, security review |
4. Multi-Cloud Strategy (AWS + GCP)
When Writer has tenant deployments in both GCP and AWS, EKM becomes a multi-cloud CMK problem. Three viable designs exist:
1. Per-Cloud EKM
AWS KMS for AWS tenants, GCP Cloud KMS for GCP tenants. A global key registry maps each tenant to cloud + key ARN/resource-ID. No cross-cloud key transport.
2. One External Root Key (HYOK)
Customer holds a single root key in an external HSM or Fortanix/Thales. Both clouds call out to the external key store for wrap/unwrap. Unified control but highest latency and complexity.
3. Canonical-Cloud Encryption
Pick one cloud as the encryption authority (e.g. AWS KMS for all). GCP workloads call out to AWS for key ops. Adds cross-cloud latency and a hard dependency. Generally avoid.
Product Changes for Multi-Cloud
- Global Key Registry -- central DB table:
tenant_id, cloud_provider, key_arn_or_resource_id, status, rotation_schedule, created_at - Unified Envelope Format -- ciphertext header includes
cloud_providerfield so any service can route to the correct KMS - Two Onboarding Packs -- Terraform module for AWS customers, gcloud / Terraform module for GCP customers
Pricing Reference (Multi-Cloud)
| Service | Key Cost | API Calls | Notes |
|---|---|---|---|
| AWS KMS | $1 / key / month | $0.03 per 10k | Customer-managed CMK; free tier: 20k requests/mo |
| GCP Cloud KMS | $0.06 / key-version / month | $0.03 per 10k ops | Cloud EKM pricing may differ for external keys |
| AWS CloudHSM | ~$1,100 / month per HSM | Included | FIPS 140-2 Level 3; minimum 2 for HA |
5. Top Third-Party Systems
Two third-party platforms stand out for providing multi-cloud EKM / HYOK posture without building everything in-house:
Fortanix Data Security Manager (DSM)
Cloud-native, multi-cloud KMS backed by Intel SGX confidential computing. Provides a unified REST API for envelope encryption across AWS, GCP, and Azure. Supports BYOK import, external key store, and automated key rotation.
System Design with Fortanix:
Thales CipherTrust Manager / CCKM
Enterprise-grade key lifecycle management with the strongest compliance pedigree in the HSM market. CipherTrust Cloud Key Manager (CCKM) syncs customer root keys into AWS/GCP KMS. Available as on-prem appliance or SaaS.
System Design with Thales:
6. Full Comparison: All Approaches
Beyond the two top third-party systems, several other approaches and tools were evaluated:
| Approach | Type | Build Time | Multi-Cloud | Customer Revoke | Cost Signal | Best For |
|---|---|---|---|---|---|---|
| Native Per-Cloud KMS EKM | Build | 6 - 10 wk | Yes (per-cloud) | Instant (IAM revoke) | $1/key/mo KMS | Recommended default |
| Fortanix DSM | Vendor | ~4 wk | Yes (unified API) | Instant (key disable) | $3-5k/mo | Speed + multi-cloud |
| Thales CipherTrust | Vendor | ~8 wk | Yes (CCKM sync) | Via CipherTrust console | $50-100k/yr | Strictest compliance |
| WorkOS Vault | SDK | Days | Yes | Via WorkOS dashboard | Usage-based | Fastest integration |
| Acra (DB Proxy) | Proxy | 4 - 6 wk | Limited (SQL only) | Via KMIP/Vault key | Open-source + support | Field-level SQL encryption |
| Homegrown DB-Proxy | Build | 3 - 6 mo | Custom | Custom | Eng cost only | Unique requirements |
| HashiCorp Vault Transit | Self-host | 4 - 8 wk | Yes | Via Vault policy | Open-source / Enterprise | Existing Vault users |
WorkOS Vault -- System Design
WorkOS Vault is a managed BYOK/EKM abstraction layer. Writer integrates via SDK; WorkOS stores wrapped DEKs; the customer CMK stays in their own AWS/GCP KMS.
- Customer configures CMK in WorkOS dashboard (points to their AWS/GCP key)
- Writer calls
workos.vault.encrypt(tenant_id, plaintext) - WorkOS generates DEK, wraps with customer CMK, returns ciphertext + wrapped DEK
- On read:
workos.vault.decrypt(tenant_id, ciphertext) - Customer disables key in WorkOS → decrypt calls fail
Acra -- System Design
Acra is a transparent database proxy (by Cossack Labs) that encrypts/decrypts at the column or field level. It sits between the application and PostgreSQL/MySQL. Customer CMK plugs in via KMIP or HashiCorp Vault.
- Deploy AcraServer as a sidecar or separate service
- Point Writer app DB connection to AcraServer (transparent proxy)
- Configure per-tenant encryption keys via KMIP or Vault
- Writes: AcraServer encrypts designated columns before INSERT
- Reads: AcraServer decrypts on SELECT transparently
- Revoke: remove key from KMIP/Vault → reads return encrypted blobs
7. Decision Guidance for Writer
Recommendation
- Default tier (self-serve / SMB): Writer-managed keys (Option D). No customer effort.
- Enterprise tier: Slack-style EKM (Option B) with per-cloud native KMS. 6 - 10 week build. Offer as a paid add-on.
- If time-to-market is critical: Start with WorkOS Vault (days of integration) while building native EKM in parallel.
- If a customer demands HYOK: Evaluate Fortanix DSM as the fastest path, or Thales CipherTrust for the strongest compliance story.
- Avoid homegrown DB-proxy and canonical-cloud encryption patterns.
Packaging Suggestions
| Plan | Encryption | Key Control | Revoke |
|---|---|---|---|
| Free / Pro | Writer-managed (AES-256) | None | N/A |
| Enterprise | Slack-style EKM | Customer CMK in their account | Instant (IAM revoke) |
| Enterprise+ | HYOK via Fortanix / Thales | Customer HSM / external KMS | Instant (key disable) |
8. Operational Considerations
- Key Rotation: Automate annual CMK rotation. DEKs re-wrapped with new CMK version; data re-encryption is not needed (envelope model).
- Availability: DEK cache (TTL 5 - 15 min) ensures continued operation during brief KMS outages. Circuit breaker prevents cascading failures.
- Audit: Every wrap/unwrap call logged in customer's CloudTrail / Cloud Audit Logs. Writer maintains internal audit log for compliance reporting.
- Onboarding: Provide IaC templates (Terraform / CloudFormation) that create IAM role + CMK policy. Target: customer completes setup in < 30 minutes.
- Incident Response: If customer revokes access, Writer surfaces a clear “data unavailable -- contact your admin” message. No data loss; re-grant IAM role restores access.
- Performance: Expect ~2-5ms overhead for KMS calls on cache miss. With 5 - 15 min TTL, 99%+ of operations served from cache.