System Design - Cloud Pillars
Here is solutions for system design for cloud pillars
1. What cloud offers ?
-
Shared responsibility
-
Region + AZs (3 - 5 data centers = N connected virtual machines)
-
Compute: EC2, ECS, EKS, Lambda.
-
Storage: S3, EBS (MySQL,…), EFS (Config,…), Gracier (Hot and cold access)
-
Network: VPC (VPN), Internet Gateway (Public network), Direct Connect (Internal network), Global Accelerator + Cloud Front, Istio (Gateway + Load Balancer)
2. Design Compute Service
-
EC2.
-
ECS, EKS.
-
Fargate: serverless.
3. Design for Storage System
-
S3 standard, intelligent-tiering, standard-IA, gracier.
-
S3 Transfer Acceleration: download faster with CDN.
-
EBS (single-instance), EFS (multiple-instances), FSx (Window)
-
Data Life Cycle + Versioning
4. Design for Network
-
Hub-and-spoke architecture.
-
Route Table
-
Public subnet, inbound: user -> internet gateway -> svc.
-
Private subnet, outbound: svc -> NAT Gateway -> internet.
-
VPN: User access local internet: user -> VPN (IP) -> Internet GW -> LB -> internal svc.
-
VPC Peering: 2 private subnet together.
-
Route 53: DNS Resolution and hostname
-
Security Group: Instance firewall.
-
Network ACLs: subnet firewalls.
-
Istio: API Gateway + Load Balancer
-
ALB: route by path.
-
NLB: route by IP, mTLS resolution
-
Elastic IP: map to multiple EC2.
-
Static IP: IP not changed
5. Design for Availablity
-
Multi-AZs: multiple instances, consensus algorithm.
-
Multi-region: Amazon Route 53 and AWS Global Accelerator.
6. Design for Database
-
RDS: traditional sql database
-
DynamoDB: multi-region no-sql database.
-
Aurora: multi-region sql database.
7. Design for multi-AZs
-
Read replica: asynchronus, have lag time.
-
AWS RDS Proxy: Load balancers between read replicas.
8. Design for multi-region
-
Amazon Aurora Global Database
-
Amazon DynamoDB Global Tables
-
Cross-Region Replication (CRR)
-
Parititon: latency.
-
Relica: availability.
-
Clock database, e.g. Spanner
9. Design for Security
-
IAM.
-
Audit.
-
Data Protection: encryption with KMS + mTLS
-
Network.
10. Design for Monitoring
-
Monitoring
-
Tracing
-
Logging
11. Design for Event-driven
-
Queue
-
Pub/Sub.
-
SSE.
-
EventBridge.
-
Step Functions
12. Design for Recovery + Failover
-
RTO: maximum downtime.
-
RPO: maximum data loss downtime
-
Active-Passive
-
Active-Active
-
Read-only Replica Regions
13. Design for Backup
-
Snapshot
-
Zero-downtime database: Shadow tables (DDL) -> move traffic from main table to shadow tables.
-
Graceful shutdown.
14. Design for CI/CD
-
CodePipeline, CodeBuild, CodeDeploy
-
Blue-green Deploy, Canary Deploy.
15. Design for Cost Optimization
-
Storage Cost
-
Data transfer fees
-
Tagging strategies.
-
Cost Explorer, Budget.
-
EC2: Reversed Instance