-
-
Notifications
You must be signed in to change notification settings - Fork 0
AWS Adapter Mapping
Khue Pham edited this page Jun 3, 2026
·
1 revision
Dựa trên kiến trúc hiện tại, đây là mapping sang AWS:
| Thành phần hiện tại | Cloudflare | Docker | AWS |
|---|---|---|---|
| Compute | Workers | Node.js/Docker | AWS Lambda + API Gateway hoặc ECS Fargate (nếu cần WebSocket liên tục) |
| Cache | KV | Redis | ElastiCache Redis hoặc DynamoDB (cho key-value đơn giản) |
| Storage | R2 | MinIO/S3 | S3 |
| Database | Hyperdrive | pg pool | RDS PostgreSQL hoặc Aurora Serverless v2 |
| Queue | CF Queues | BullMQ | SQS hoặc EventBridge |
| Search | MeiliSearch Cloud | MeiliSearch | OpenSearch hoặc giữ MeiliSearch trên EC2/ECS |
| Media Processing | CF Image Resizing | Imgproxy | Lambda@Edge hoặc AWS Elemental MediaConvert |
| Realtime | Durable Objects | host process | API Gateway WebSocket + ElastiCache hoặc AppSync |
| CDN | Cloudflare CDN | nginx/traefik | CloudFront |
| Secrets | Workers Secrets | env var | Secrets Manager hoặc Parameter Store |
┌─────────────────────────────────────────────────────────────────┐
│ Clients │
│ - Studio (React SPA) → CloudFront + S3 │
│ - Consumer (Next.js) → Amplify hoặc ECS/EC2 │
│ - Landing (Next.js) → Amplify │
└──────────────▲──────────────────────────────▲────────────────────┘
│ │
┌──────────────┴──────────────────────────────┴────────────────────┐
│ API Layer │
│ - API Gateway (HTTP + WebSocket routes) │
│ - Lambda: Hono handlers (tương tự Cloudflare Workers entry) │
│ HOẶC │
│ - ECS Fargate: Node.js container (tương tự Docker entry) │
│ → ALB cho HTTP, NLB cho WebSocket │
└──────────────▲──────────────────────────────▲────────────────────┘
│ │
┌──────────────┴──────────┐ ┌────────────┴───────────────────┐
│ RDS Aurora PostgreSQL │ │ AWS Services │
│ (thay Hyperdrive/pg) │ │ - ElastiCache Redis (cache) │
│ │ │ - S3 (storage) │
│ │ │ - SQS (queue) │
│ │ │ - OpenSearch (search) │
│ │ │ - Secrets Manager │
└─────────────────────────┘ └─────────────────────────────────┘
Thêm adapter mới @lumibase/runtime/src/adapters/aws/:
// packages/runtime/src/adapters/aws/index.ts
export class AWSCacheProvider implements CacheProvider {
// ElastiCache Redis implementation
}
export class AWSStorageProvider implements StorageProvider {
// S3 implementation (dùng @aws-sdk/client-s3)
}
export class AWSQueueProvider implements QueueProvider {
// SQS implementation
}
export class AWSRealtimeProvider {
// API Gateway WebSocket management + ElastiCache pub/sub
}Option 1: Lambda + API Gateway (Serverless, phù hợp CMS API)
- Triển khai Hono handlers lên Lambda
- API Gateway: HTTP API + WebSocket API routes
- Cold start có thể ảnh hưởng realtime
Option 2: ECS Fargate (Container-based, phù hợp WebSocket liên tục)
- Tương tự Docker deployment hiện tại
- Service Connect cho service mesh
- Auto-scaling dựa trên CPU/memory
Đề xuất: Dùng ECS Fargate cho apps/cms (tránh cold start, WebSocket ổn định), Lambda cho background jobs (queue consumers), và Amplify cho frontend apps.