blog-blueprint 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BlueprintTemplate/.editorconfig +17 -0
- package/BlueprintTemplate/.gitlab-ci.yml +34 -0
- package/BlueprintTemplate/DESIGN.txt +37 -0
- package/BlueprintTemplate/README.md +78 -0
- package/BlueprintTemplate/angular.json +101 -0
- package/BlueprintTemplate/gitignore +42 -0
- package/BlueprintTemplate/package.json +58 -0
- package/BlueprintTemplate/public/assets/lessons/aws/aws-overview.md +139 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-aurora-guide.md +181 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-dynamodb-guide.md +139 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-ec2-guide.md +152 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-eventbridge-guide.md +152 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-iam-guide.md +132 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-lambda-guide.md +129 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-rds-guide.md +193 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-s3-guide.md +158 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-sns-guide.md +163 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-sqs-guide.md +173 -0
- package/BlueprintTemplate/public/assets/lessons/core/aws-vpc-guide.md +145 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-application-integration-overview.md +194 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-compute-architecture-overview.md +187 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-database-architecture.md +104 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-networking-architecture.md +97 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-security-architecture.md +88 -0
- package/BlueprintTemplate/public/assets/lessons/groups/aws-storage-architecture.md +116 -0
- package/BlueprintTemplate/public/assets/lessons/index.json +202 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-caching-strategy.md +61 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-disaster-recovery-strategies.md +117 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-event-driven-architecture.md +77 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-ha-ft-scalability.md +98 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-hybrid-cloud.md +82 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-microservices-vs-monolithic.md +77 -0
- package/BlueprintTemplate/public/assets/lessons/theory/aws-well-architected-framework.md +174 -0
- package/BlueprintTemplate/public/favicon.ico +0 -0
- package/BlueprintTemplate/public/robots.txt +23 -0
- package/BlueprintTemplate/public/sitemap.xml +11 -0
- package/BlueprintTemplate/src/app/app.config.server.ts +12 -0
- package/BlueprintTemplate/src/app/app.config.ts +16 -0
- package/BlueprintTemplate/src/app/app.html +36 -0
- package/BlueprintTemplate/src/app/app.routes.server.ts +8 -0
- package/BlueprintTemplate/src/app/app.routes.ts +11 -0
- package/BlueprintTemplate/src/app/app.scss +71 -0
- package/BlueprintTemplate/src/app/app.ts +50 -0
- package/BlueprintTemplate/src/app/core/models/lesson.model.ts +8 -0
- package/BlueprintTemplate/src/app/core/services/lesson.service.ts +46 -0
- package/BlueprintTemplate/src/app/core/services/seo.service.ts +68 -0
- package/BlueprintTemplate/src/app/features/about/about.html +14 -0
- package/BlueprintTemplate/src/app/features/about/about.scss +4 -0
- package/BlueprintTemplate/src/app/features/about/about.ts +23 -0
- package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.html +4 -0
- package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.scss +0 -0
- package/BlueprintTemplate/src/app/features/lesson-detail/lesson-detail.ts +55 -0
- package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.html +13 -0
- package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.scss +0 -0
- package/BlueprintTemplate/src/app/features/lesson-list/lesson-list.ts +59 -0
- package/BlueprintTemplate/src/app/shared/facades/event-abstract.facade.ts +18 -0
- package/BlueprintTemplate/src/app/shared/facades/pages.facade.ts +55 -0
- package/BlueprintTemplate/src/app/shared/utils/common.utils.ts +3 -0
- package/BlueprintTemplate/src/index.html +35 -0
- package/BlueprintTemplate/src/main.server.ts.bak +7 -0
- package/BlueprintTemplate/src/main.ts +6 -0
- package/BlueprintTemplate/src/server.ts.bak +68 -0
- package/BlueprintTemplate/src/styles.scss +36 -0
- package/BlueprintTemplate/tsconfig.app.json +17 -0
- package/BlueprintTemplate/tsconfig.json +34 -0
- package/README.md +22 -0
- package/create.js +92 -0
- package/package.json +21 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Kiến trúc cơ sở dữ liệu trên AWS: Hướng dẫn từ cơ bản đến nâng cao
|
|
2
|
+
|
|
3
|
+
AWS cung cấp nhiều dịch vụ cơ sở dữ liệu, từ SQL truyền thống đến NoSQL, cache và data warehouse. Bài viết này giúp bạn hiểu cách chọn dịch vụ phù hợp, tối ưu hiệu năng và triển khai theo best practices.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Dịch vụ chính
|
|
8
|
+
|
|
9
|
+
### RDS – Managed SQL Database
|
|
10
|
+
- **Mô tả:** Chạy database truyền thống (MySQL, PostgreSQL, SQL Server…) nhưng AWS quản lý hạ tầng.
|
|
11
|
+
- **Đặc điểm:**
|
|
12
|
+
- Multi-AZ standby (High Availability)
|
|
13
|
+
- Read replicas để scale read
|
|
14
|
+
- Snapshot + point-in-time recovery
|
|
15
|
+
- Tự động patching và backup
|
|
16
|
+
- Quản lý instance size, không quản lý OS
|
|
17
|
+
|
|
18
|
+
### Aurora – SQL siêu tốc
|
|
19
|
+
- **Mô tả:** Phiên bản RDS hiệu năng cao, scale tốt hơn, nhanh hơn.
|
|
20
|
+
- **Đặc điểm:**
|
|
21
|
+
- MySQL/PostgreSQL compatible
|
|
22
|
+
- Storage shared cluster (6 copies, 3 AZ)
|
|
23
|
+
- Up to 15 read replicas
|
|
24
|
+
- Auto-healing storage
|
|
25
|
+
- Failover nhanh (vài chục giây)
|
|
26
|
+
|
|
27
|
+
### DynamoDB – NoSQL Database
|
|
28
|
+
- **Mô tả:** Bảng key-value / document, serverless, scale vô hạn.
|
|
29
|
+
- **Đặc điểm:**
|
|
30
|
+
- Millisecond latency
|
|
31
|
+
- Auto scaling (RCU/WCU)
|
|
32
|
+
- On-demand hoặc provisioned
|
|
33
|
+
- Global Tables
|
|
34
|
+
- TTL để tự xóa dữ liệu
|
|
35
|
+
- Streams để trigger Lambda
|
|
36
|
+
|
|
37
|
+
### ElastiCache – In-memory Cache
|
|
38
|
+
- **Mô tả:** Bộ nhớ đệm giúp giảm tải cho DB.
|
|
39
|
+
- **Đặc điểm:**
|
|
40
|
+
- Redis hoặc Memcached
|
|
41
|
+
- Giảm độ trễ đọc
|
|
42
|
+
- Dùng cho session store, caching, leaderboard
|
|
43
|
+
- Redis: persistence, pub/sub
|
|
44
|
+
- Memcached: simple, dễ scale-out
|
|
45
|
+
|
|
46
|
+
### Redshift – Data Warehouse
|
|
47
|
+
- **Mô tả:** Kho dữ liệu phân tích lớn, dùng cho truy vấn GB → TB dữ liệu.
|
|
48
|
+
- **Đặc điểm:**
|
|
49
|
+
- Columnar storage
|
|
50
|
+
- Dùng cho BI, OLAP
|
|
51
|
+
- RA3 node: tách compute & storage
|
|
52
|
+
- Spectrum đọc dữ liệu từ S3
|
|
53
|
+
- Concurrency scaling cho nhiều user
|
|
54
|
+
|
|
55
|
+
### DAX – DynamoDB Accelerator
|
|
56
|
+
- **Mô tả:** Cache in-memory dành riêng cho DynamoDB.
|
|
57
|
+
- **Đặc điểm:**
|
|
58
|
+
- Microsecond latency
|
|
59
|
+
- Không cần sửa code nhiều
|
|
60
|
+
- Giảm RCU và chi phí
|
|
61
|
+
- Tối ưu read-heavy workloads
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 2. Nhánh lý thuyết quan trọng
|
|
66
|
+
|
|
67
|
+
### SQL vs NoSQL
|
|
68
|
+
| Loại | Đặc điểm | Ví dụ |
|
|
69
|
+
|------|----------|-------|
|
|
70
|
+
| SQL | Bảng, hàng, cột, ACID, join phức tạp | RDS, Aurora |
|
|
71
|
+
| NoSQL | Key-value / document, không join, scale tốt | DynamoDB |
|
|
72
|
+
|
|
73
|
+
- SQL: dùng cho app truyền thống
|
|
74
|
+
- NoSQL: serverless, IoT, gaming, e-commerce
|
|
75
|
+
|
|
76
|
+
### Scaling Patterns
|
|
77
|
+
- **Scale-up:** tăng kích thước instance
|
|
78
|
+
- **Scale-out:** thêm nhiều instance / replica
|
|
79
|
+
- **Ví dụ:**
|
|
80
|
+
- RDS/Aurora: scale-out bằng read replicas, scale-up bằng instance class
|
|
81
|
+
- DynamoDB: true scale-out, RCU/WCU auto
|
|
82
|
+
- Redshift: thêm node, RA3 tách compute & storage
|
|
83
|
+
|
|
84
|
+
### Cache trước DB
|
|
85
|
+
- **Mô tả:** Lưu bản tạm thời gần client để giảm truy vấn DB liên tục
|
|
86
|
+
- **Ví dụ:**
|
|
87
|
+
- ElastiCache: tăng tốc đọc 10–100x, giảm tải DB
|
|
88
|
+
- DAX: cache trước DynamoDB
|
|
89
|
+
- **Patterns:** Cache-aside (most common), Write-through, Write-back
|
|
90
|
+
|
|
91
|
+
### DynamoDB Best Practices
|
|
92
|
+
- Chọn partition key có độ phân tán cao
|
|
93
|
+
- Tránh hot partition
|
|
94
|
+
- Dùng sort key cho truy vấn range
|
|
95
|
+
- On-demand khi traffic không đoán được
|
|
96
|
+
- Provisioned + auto scaling khi predictable
|
|
97
|
+
- TTL để tối ưu chi phí
|
|
98
|
+
- Streams để event-driven
|
|
99
|
+
|
|
100
|
+
### Aurora Serverless vs Provisioned
|
|
101
|
+
| Loại | Đặc điểm |
|
|
102
|
+
|------|----------|
|
|
103
|
+
| Provisioned | Workload ổn định, hiệu năng cao, nhiều replica, tốn chi phí |
|
|
104
|
+
| Serverless v2 | Auto scale theo load, trả tiền theo capacity unit, tốt cho workload unpredictable, gần như scale-to-zero khi idle |
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Kiến trúc mạng trên AWS: Hướng dẫn từ cơ bản đến nâng cao
|
|
2
|
+
|
|
3
|
+
Kiến trúc mạng là nền tảng cho mọi hạ tầng trên AWS. Hiểu rõ các dịch vụ mạng và nguyên tắc thiết kế giúp bạn xây dựng hệ thống ổn định, an toàn và dễ scale.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Dịch vụ chính
|
|
8
|
+
|
|
9
|
+
### VPC – Virtual Private Cloud
|
|
10
|
+
- **Mô tả:** Khu đất riêng trong AWS, bạn có thể chia subnet, đặt route, firewall và kiểm soát truy cập.
|
|
11
|
+
- **Đặc điểm:**
|
|
12
|
+
- Mạng riêng trong AWS
|
|
13
|
+
- Tự chọn CIDR
|
|
14
|
+
- Tự cấu hình router và firewall
|
|
15
|
+
- Cách ly với VPC khác
|
|
16
|
+
- VPC Peering: nối 2 VPC trực tiếp (không transitive)
|
|
17
|
+
|
|
18
|
+
### Subnet
|
|
19
|
+
- **Mô tả:** Khu nhỏ trong VPC, có thể public hoặc private.
|
|
20
|
+
- **Đặc điểm:**
|
|
21
|
+
- Public subnet → có route ra Internet (IGW)
|
|
22
|
+
- Private subnet → không có cổng Internet trực tiếp
|
|
23
|
+
- Isolated subnet → không ra ngoài
|
|
24
|
+
- Mỗi subnet nằm 100% trong 1 AZ
|
|
25
|
+
|
|
26
|
+
### NAT Gateway & Internet Gateway (IGW)
|
|
27
|
+
- **IGW:** cổng chính để VPC kết nối Internet
|
|
28
|
+
- **NAT Gateway:** cho private subnet đi ra Internet, inbound từ Internet không vào được
|
|
29
|
+
- **Routing rule:**
|
|
30
|
+
- Public subnet route: `0.0.0.0/0` → IGW
|
|
31
|
+
- Private subnet route: `0.0.0.0/0` → NAT
|
|
32
|
+
- **Lưu ý:** NAT phải đặt trong public subnet
|
|
33
|
+
|
|
34
|
+
### Route 53
|
|
35
|
+
- **Mô tả:** DNS service giúp người dùng tìm server qua tên miền.
|
|
36
|
+
- **Đặc điểm:**
|
|
37
|
+
- DNS + Health check
|
|
38
|
+
- Alias đến ALB/S3/CloudFront
|
|
39
|
+
- Failover Routing Policy: Primary/Secondary, tự điều hướng khi server lỗi
|
|
40
|
+
|
|
41
|
+
### Direct Connect
|
|
42
|
+
- **Mô tả:** Kết nối riêng từ on-prem đến AWS, không qua Internet.
|
|
43
|
+
- **Đặc điểm:**
|
|
44
|
+
- Low latency, high bandwidth
|
|
45
|
+
- Private VIF → vào VPC
|
|
46
|
+
- Public VIF → vào dịch vụ AWS công cộng
|
|
47
|
+
- Nên có VPN backup
|
|
48
|
+
|
|
49
|
+
### VPN (Site-to-Site / Client VPN)
|
|
50
|
+
- **Mô tả:** Đường hầm bí mật qua Internet vào AWS.
|
|
51
|
+
- **Đặc điểm:**
|
|
52
|
+
- Site-to-Site: kết nối on-prem ↔ VPC
|
|
53
|
+
- Client VPN: nhân viên truy cập AWS
|
|
54
|
+
- Dùng làm backup cho Direct Connect
|
|
55
|
+
|
|
56
|
+
### Transit Gateway (TGW)
|
|
57
|
+
- **Mô tả:** Bến trung tâm kết nối nhiều VPC với nhau.
|
|
58
|
+
- **Đặc điểm:**
|
|
59
|
+
- Hub-and-spoke
|
|
60
|
+
- Khắc phục nhược điểm của VPC Peering
|
|
61
|
+
- Dễ scale multi-VPC
|
|
62
|
+
- Có routing riêng cho từng attachment
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 2. Nhánh lý thuyết quan trọng
|
|
67
|
+
|
|
68
|
+
### Public vs Private Subnet
|
|
69
|
+
- Public: có cửa ra Internet → dùng cho load balancer, bastion, NAT
|
|
70
|
+
- Private: không có cửa Internet trực tiếp → dùng cho app tier, database tier
|
|
71
|
+
|
|
72
|
+
### Routing
|
|
73
|
+
- Route table gắn với subnet
|
|
74
|
+
- `0.0.0.0/0` → đường đi “tất cả mọi nơi”
|
|
75
|
+
- IGW cho public, NAT cho private, TGW cho multi-VPC
|
|
76
|
+
- Mỗi subnet chỉ dùng 1 route table tại một thời điểm
|
|
77
|
+
|
|
78
|
+
### Hybrid Cloud Patterns
|
|
79
|
+
- Kết nối on-prem với AWS
|
|
80
|
+
- Direct Connect: nhanh, ổn định
|
|
81
|
+
- VPN: tạm thời hoặc backup
|
|
82
|
+
- TGW: nối nhiều VPC + on-prem
|
|
83
|
+
- Dùng cho migration, DR, data center extension
|
|
84
|
+
|
|
85
|
+
### Failover Routing Policy
|
|
86
|
+
- Khi server chính chết, Route 53 tự chuyển sang server dự phòng
|
|
87
|
+
- Dùng health check để đảm bảo high availability
|
|
88
|
+
|
|
89
|
+
### Multi-VPC Design
|
|
90
|
+
- Nhiều VPC để chia hệ thống theo team, environment hoặc region
|
|
91
|
+
- Transit Gateway giúp mọi VPC giao tiếp
|
|
92
|
+
- Peering: tốt cho ít VPC, không scale
|
|
93
|
+
- TGW: scale tốt, routing rõ ràng
|
|
94
|
+
- Best practices:
|
|
95
|
+
- Mỗi environment 1 VPC
|
|
96
|
+
- Không share database qua VPC Peering (security risk)
|
|
97
|
+
- Dùng PrivateLink để expose service
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Kiến trúc bảo mật trên AWS: Hướng dẫn từ cơ bản đến nâng cao
|
|
2
|
+
|
|
3
|
+
Bảo mật là yếu tố quan trọng khi vận hành hạ tầng trên AWS. Bài viết này tổng hợp các dịch vụ, nguyên tắc và best practices giúp bạn thiết kế một kiến trúc bảo mật vững chắc.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Dịch vụ chính
|
|
8
|
+
|
|
9
|
+
### IAM (Identity & Access Management)
|
|
10
|
+
- **Mô tả:** Hệ thống quản lý quyền truy cập trên AWS. Quyết định ai được phép làm gì thông qua Users, Groups, Roles và Policies.
|
|
11
|
+
- **Đặc điểm:**
|
|
12
|
+
- Quản lý users, roles, policies
|
|
13
|
+
- Fine-grained permissions
|
|
14
|
+
- Deny > Allow
|
|
15
|
+
- Global service (không thuộc region)
|
|
16
|
+
|
|
17
|
+
### KMS (Key Management Service)
|
|
18
|
+
- **Mô tả:** Dịch vụ quản lý “chìa khóa” mã hóa dữ liệu.
|
|
19
|
+
- **Đặc điểm:**
|
|
20
|
+
- Quản lý CMK / KMS keys
|
|
21
|
+
- Hỗ trợ encrypt/decrypt dữ liệu
|
|
22
|
+
- Tích hợp với hầu hết các dịch vụ AWS
|
|
23
|
+
- Hỗ trợ encryption at rest
|
|
24
|
+
|
|
25
|
+
### Secrets Manager
|
|
26
|
+
- **Mô tả:** Nơi lưu trữ secrets như mật khẩu DB hoặc API keys, hỗ trợ tự động rotate.
|
|
27
|
+
- **Đặc điểm:**
|
|
28
|
+
- Lưu trữ credentials
|
|
29
|
+
- Auto rotation (có thể tích hợp Lambda)
|
|
30
|
+
- Encrypt bằng KMS
|
|
31
|
+
- Không hardcode secrets trong code
|
|
32
|
+
|
|
33
|
+
### IAM Roles / Policies / Permission Boundaries
|
|
34
|
+
- **Mô tả:**
|
|
35
|
+
- **Policies:** Luật mô tả ai được làm gì
|
|
36
|
+
- **Roles:** Quyền tạm thời mà service hoặc người dùng assume
|
|
37
|
+
- **Boundaries:** Giới hạn tối đa mà role/policy được phép cấp
|
|
38
|
+
- **Đặc điểm:**
|
|
39
|
+
- Policies = Allow/Deny
|
|
40
|
+
- Roles = Temporary credentials
|
|
41
|
+
- Boundaries = Max permission guardrail
|
|
42
|
+
- Dùng cho multi-account hoặc delegation
|
|
43
|
+
|
|
44
|
+
### Security Groups / NACL
|
|
45
|
+
- **Mô tả:** Firewall trong VPC
|
|
46
|
+
- Security Group: gắn vào instance, stateful, chỉ allow
|
|
47
|
+
- NACL: gắn vào subnet, stateless, allow + deny
|
|
48
|
+
- **Đặc điểm:**
|
|
49
|
+
- SG dễ quản lý hơn, dùng phổ biến
|
|
50
|
+
- NACL dùng để chặn IP cấp subnet
|
|
51
|
+
- Cần evaluate inbound/outbound rules
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 2. Nhánh quan trọng
|
|
56
|
+
|
|
57
|
+
### IAM Best Practices
|
|
58
|
+
- Không dùng root account
|
|
59
|
+
- Bật MFA cho tất cả
|
|
60
|
+
- Principle of least privilege
|
|
61
|
+
- Dùng IAM Roles thay vì Access Keys
|
|
62
|
+
- Rotate credentials
|
|
63
|
+
- Sử dụng permission boundaries & SCP trong multi-account
|
|
64
|
+
|
|
65
|
+
### Encryption at rest / in transit
|
|
66
|
+
- **At rest:** mã hóa dữ liệu khi lưu trên ổ đĩa (EBS, S3, RDS) → dùng KMS
|
|
67
|
+
- **In transit:** mã hóa dữ liệu khi truyền (TLS/HTTPS) → CloudFront + ACM cho HTTPS
|
|
68
|
+
- S3 default encryption, RDS encryption per instance
|
|
69
|
+
|
|
70
|
+
### KMS Key Rotation
|
|
71
|
+
- Tự động rotation mỗi năm cho AWS-managed keys
|
|
72
|
+
- Customer-managed keys: bật rotation thủ công
|
|
73
|
+
- Không đổi ARN → không break ứng dụng
|
|
74
|
+
- Quan trọng cho compliance
|
|
75
|
+
|
|
76
|
+
### SG vs NACL (So sánh)
|
|
77
|
+
| Đặc điểm | Security Group | NACL |
|
|
78
|
+
|----------|----------------|------|
|
|
79
|
+
| Gắn vào | EC2 instance | Subnet |
|
|
80
|
+
| Stateful? | Có | Không |
|
|
81
|
+
| Rule | Allow only | Allow + Deny |
|
|
82
|
+
| Quản lý | Dễ hơn, phổ biến | Chặn IP cấp subnet |
|
|
83
|
+
|
|
84
|
+
### Least Privilege
|
|
85
|
+
- Chỉ cấp quyền cần thiết
|
|
86
|
+
- Sử dụng policy theo resource
|
|
87
|
+
- Thường xuyên audit permissions
|
|
88
|
+
- Dùng IAM Access Analyzer, policy with conditions
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Kiến trúc lưu trữ trên AWS: Hướng dẫn từ cơ bản đến nâng cao
|
|
2
|
+
|
|
3
|
+
AWS cung cấp nhiều dịch vụ lưu trữ khác nhau, từ object storage, block storage đến file storage. Bài viết này sẽ giúp bạn hiểu rõ từng dịch vụ, cách chọn loại lưu trữ phù hợp và các chiến lược backup, DR, cũng như hybrid storage.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. S3 – Object Storage
|
|
8
|
+
|
|
9
|
+
- **Mô tả:** S3 là kho lưu trữ online, lưu file dưới dạng object, không phải ổ cứng.
|
|
10
|
+
- **Đặc điểm:**
|
|
11
|
+
- Object storage với dung lượng gần như vô hạn
|
|
12
|
+
- Durability: 11 số 9
|
|
13
|
+
- Hỗ trợ versioning, lifecycle rule
|
|
14
|
+
- Hỗ trợ static website hosting
|
|
15
|
+
- **Các lớp lưu trữ:** Standard, IA, OneZone, Glacier
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2. Glacier – Lưu trữ lạnh
|
|
20
|
+
|
|
21
|
+
- **Mô tả:** Kho lưu trữ giá rẻ nhưng truy xuất chậm, dùng cho backup hoặc archive.
|
|
22
|
+
- **Đặc điểm:**
|
|
23
|
+
- Retrieval từ vài phút đến vài giờ
|
|
24
|
+
- 3 cấp: Instant / Flexible / Deep Archive
|
|
25
|
+
- Tích hợp với S3 Lifecycle
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 3. EBS – Block Storage cho EC2
|
|
30
|
+
|
|
31
|
+
- **Mô tả:** Ổ cứng gắn cho EC2, persistent, giống SSD/HDD vật lý.
|
|
32
|
+
- **Đặc điểm:**
|
|
33
|
+
- Block storage
|
|
34
|
+
- Snapshot để backup qua S3
|
|
35
|
+
- **Các loại:**
|
|
36
|
+
- gp3: đa dụng, giá rẻ (mặc định)
|
|
37
|
+
- io1/io2: hiệu năng cao, IOPS cao
|
|
38
|
+
- st1: throughput cao
|
|
39
|
+
- sc1: cold HDD, rẻ nhất
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 4. EFS – File Storage chia sẻ
|
|
44
|
+
|
|
45
|
+
- **Mô tả:** Ổ file share, nhiều server mount cùng lúc như một ổ NAS.
|
|
46
|
+
- **Đặc điểm:**
|
|
47
|
+
- File storage qua NFS
|
|
48
|
+
- Multi-AZ, tự động scale
|
|
49
|
+
- Thích hợp cho web app, big data nhẹ
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 5. FSx – File System cao cấp
|
|
54
|
+
|
|
55
|
+
- **Mô tả:** Hệ thống file cho workload đặc biệt (Windows, HPC, enterprise NAS).
|
|
56
|
+
- **Đặc điểm:**
|
|
57
|
+
- FSx for Windows → SMB, chạy app Windows
|
|
58
|
+
- FSx for Lustre → super-fast file system cho HPC
|
|
59
|
+
- FSx for NetApp → enterprise NAS
|
|
60
|
+
- Công suất cực cao (Lustre: hàng trăm GB/s)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 6. Storage Gateway – Kết nối on-prem với AWS
|
|
65
|
+
|
|
66
|
+
- **Mô tả:** Cầu nối giữa hệ thống tại công ty và AWS. Dữ liệu thật lưu trên cloud, nhưng on-prem vẫn dùng bình thường.
|
|
67
|
+
- **Các loại:**
|
|
68
|
+
- File Gateway: NFS/SMB ↔ S3
|
|
69
|
+
- Volume Gateway: iSCSI → EBS snapshot
|
|
70
|
+
- Tape Gateway: thay băng từ bằng S3/Glacier
|
|
71
|
+
- **Dùng cho:** hybrid workloads, backup, migrate file server
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 7. Các khái niệm lý thuyết quan trọng
|
|
76
|
+
|
|
77
|
+
### A. Object vs Block vs File Storage
|
|
78
|
+
|
|
79
|
+
| Loại | Ví dụ | Dùng khi |
|
|
80
|
+
|---------|-------|----------|
|
|
81
|
+
| Object | S3 | Lưu trữ file, log, backup, static website |
|
|
82
|
+
| Block | EBS | Database, ứng dụng cần latency thấp |
|
|
83
|
+
| File | EFS/FSx | App cần mount chung, HPC, Windows apps |
|
|
84
|
+
|
|
85
|
+
### B. Cách chọn loại EBS
|
|
86
|
+
|
|
87
|
+
- SSD (gp3) → dùng cho 80% use cases (web app, DB nhỏ)
|
|
88
|
+
- SSD cao cấp (io1/io2) → DB lớn, IOPS cao
|
|
89
|
+
- HDD throughput (st1) → Big data, streaming, log processing
|
|
90
|
+
- HDD rẻ (sc1) → Cold workload, scan ít, không dùng cho DB
|
|
91
|
+
|
|
92
|
+
### C. EFS vs FSx cho HPC
|
|
93
|
+
|
|
94
|
+
- EFS → general file share, không tối ưu HPC
|
|
95
|
+
- FSx for Lustre → siêu nhanh, throughput hàng trăm GB/s, tích hợp S3
|
|
96
|
+
|
|
97
|
+
### D. Backup / DR với S3 + Glacier
|
|
98
|
+
|
|
99
|
+
- EBS Snapshot → S3
|
|
100
|
+
- Lifecycle: S3 Standard → IA → Glacier → Deep Archive
|
|
101
|
+
- Cross-region replication (CRR) cho DR
|
|
102
|
+
- Object Lock để chống xoá nhầm (WORM)
|
|
103
|
+
|
|
104
|
+
### E. Hybrid với Storage Gateway
|
|
105
|
+
|
|
106
|
+
- On-prem vẫn xài bình thường, dữ liệu lưu ở AWS
|
|
107
|
+
- File Gateway → S3
|
|
108
|
+
- Volume Gateway → backup EC2-like
|
|
109
|
+
- Tape Gateway → archive về Glacier
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 8. Tóm tắt nhanh
|
|
114
|
+
|
|
115
|
+
**Dịch vụ:** S3 | Glacier | EBS | EFS | FSx | Storage Gateway
|
|
116
|
+
**Lý thuyết:** Object vs Block vs File
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "aws-overview",
|
|
4
|
+
"title": "AWS Overview",
|
|
5
|
+
"category": "aws",
|
|
6
|
+
"service": "General",
|
|
7
|
+
"level": "beginner",
|
|
8
|
+
"file": "aws-overview.md"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "aws-aurora-guide",
|
|
12
|
+
"title": "AWS Aurora Guide",
|
|
13
|
+
"category": "core",
|
|
14
|
+
"service": "Aurora",
|
|
15
|
+
"level": "beginner",
|
|
16
|
+
"file": "aws-aurora-guide.md"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "aws-dynamodb-guide",
|
|
20
|
+
"title": "AWS DynamoDB Guide",
|
|
21
|
+
"category": "core",
|
|
22
|
+
"service": "DynamoDB",
|
|
23
|
+
"level": "beginner",
|
|
24
|
+
"file": "aws-dynamodb-guide.md"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "aws-ec2-guide",
|
|
28
|
+
"title": "AWS EC2 Guide",
|
|
29
|
+
"category": "core",
|
|
30
|
+
"service": "EC2",
|
|
31
|
+
"level": "beginner",
|
|
32
|
+
"file": "aws-ec2-guide.md"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "aws-eventbridge-guide",
|
|
36
|
+
"title": "AWS EventBridge Guide",
|
|
37
|
+
"category": "core",
|
|
38
|
+
"service": "EventBridge",
|
|
39
|
+
"level": "beginner",
|
|
40
|
+
"file": "aws-eventbridge-guide.md"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "aws-iam-guide",
|
|
44
|
+
"title": "AWS IAM Guide",
|
|
45
|
+
"category": "core",
|
|
46
|
+
"service": "IAM",
|
|
47
|
+
"level": "beginner",
|
|
48
|
+
"file": "aws-iam-guide.md"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "aws-lambda-guide",
|
|
52
|
+
"title": "AWS Lambda Guide",
|
|
53
|
+
"category": "core",
|
|
54
|
+
"service": "Lambda",
|
|
55
|
+
"level": "beginner",
|
|
56
|
+
"file": "aws-lambda-guide.md"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "aws-rds-guide",
|
|
60
|
+
"title": "AWS RDS Guide",
|
|
61
|
+
"category": "core",
|
|
62
|
+
"service": "RDS",
|
|
63
|
+
"level": "beginner",
|
|
64
|
+
"file": "aws-rds-guide.md"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "aws-s3-guide",
|
|
68
|
+
"title": "AWS S3 Guide",
|
|
69
|
+
"category": "core",
|
|
70
|
+
"service": "S3",
|
|
71
|
+
"level": "beginner",
|
|
72
|
+
"file": "aws-s3-guide.md"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "aws-sns-guide",
|
|
76
|
+
"title": "AWS SNS Guide",
|
|
77
|
+
"category": "core",
|
|
78
|
+
"service": "SNS",
|
|
79
|
+
"level": "beginner",
|
|
80
|
+
"file": "aws-sns-guide.md"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "aws-sqs-guide",
|
|
84
|
+
"title": "AWS SQS Guide",
|
|
85
|
+
"category": "core",
|
|
86
|
+
"service": "SQS",
|
|
87
|
+
"level": "beginner",
|
|
88
|
+
"file": "aws-sqs-guide.md"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "aws-vpc-guide",
|
|
92
|
+
"title": "AWS VPC Guide",
|
|
93
|
+
"category": "core",
|
|
94
|
+
"service": "VPC",
|
|
95
|
+
"level": "beginner",
|
|
96
|
+
"file": "aws-vpc-guide.md"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "aws-application-integration-overview",
|
|
100
|
+
"title": "Application Integration Overview",
|
|
101
|
+
"category": "groups",
|
|
102
|
+
"service": "General",
|
|
103
|
+
"level": "intermediate",
|
|
104
|
+
"file": "aws-application-integration-overview.md"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "aws-compute-architecture-overview",
|
|
108
|
+
"title": "Compute Architecture Overview",
|
|
109
|
+
"category": "groups",
|
|
110
|
+
"service": "Compute",
|
|
111
|
+
"level": "intermediate",
|
|
112
|
+
"file": "aws-compute-architecture-overview.md"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "aws-database-architecture",
|
|
116
|
+
"title": "Database Architecture",
|
|
117
|
+
"category": "groups",
|
|
118
|
+
"service": "Database",
|
|
119
|
+
"level": "intermediate",
|
|
120
|
+
"file": "aws-database-architecture.md"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "aws-networking-architecture",
|
|
124
|
+
"title": "Networking Architecture",
|
|
125
|
+
"category": "groups",
|
|
126
|
+
"service": "Networking",
|
|
127
|
+
"level": "intermediate",
|
|
128
|
+
"file": "aws-networking-architecture.md"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "aws-security-architecture",
|
|
132
|
+
"title": "Security Architecture",
|
|
133
|
+
"category": "groups",
|
|
134
|
+
"service": "Security",
|
|
135
|
+
"level": "intermediate",
|
|
136
|
+
"file": "aws-security-architecture.md"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "aws-storage-architecture",
|
|
140
|
+
"title": "Storage Architecture",
|
|
141
|
+
"category": "groups",
|
|
142
|
+
"service": "Storage",
|
|
143
|
+
"level": "intermediate",
|
|
144
|
+
"file": "aws-storage-architecture.md"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "aws-caching-strategy",
|
|
148
|
+
"title": "Caching Strategy",
|
|
149
|
+
"category": "theory",
|
|
150
|
+
"service": "General",
|
|
151
|
+
"level": "intermediate",
|
|
152
|
+
"file": "aws-caching-strategy.md"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"id": "aws-disaster-recovery-strategies",
|
|
156
|
+
"title": "Disaster Recovery Strategies",
|
|
157
|
+
"category": "theory",
|
|
158
|
+
"service": "General",
|
|
159
|
+
"level": "intermediate",
|
|
160
|
+
"file": "aws-disaster-recovery-strategies.md"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "aws-event-driven-architecture",
|
|
164
|
+
"title": "Event-Driven Architecture",
|
|
165
|
+
"category": "theory",
|
|
166
|
+
"service": "General",
|
|
167
|
+
"level": "intermediate",
|
|
168
|
+
"file": "aws-event-driven-architecture.md"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"id": "aws-ha-ft-scalability",
|
|
172
|
+
"title": "High Availability, Fault Tolerance & Scalability",
|
|
173
|
+
"category": "theory",
|
|
174
|
+
"service": "General",
|
|
175
|
+
"level": "intermediate",
|
|
176
|
+
"file": "aws-ha-ft-scalability.md"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": "aws-hybrid-cloud",
|
|
180
|
+
"title": "Hybrid Cloud",
|
|
181
|
+
"category": "theory",
|
|
182
|
+
"service": "General",
|
|
183
|
+
"level": "intermediate",
|
|
184
|
+
"file": "aws-hybrid-cloud.md"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "aws-microservices-vs-monolithic",
|
|
188
|
+
"title": "Microservices vs Monolithic",
|
|
189
|
+
"category": "theory",
|
|
190
|
+
"service": "General",
|
|
191
|
+
"level": "intermediate",
|
|
192
|
+
"file": "aws-microservices-vs-monolithic.md"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"id": "aws-well-architected-framework",
|
|
196
|
+
"title": "AWS Well-Architected Framework",
|
|
197
|
+
"category": "theory",
|
|
198
|
+
"service": "General",
|
|
199
|
+
"level": "intermediate",
|
|
200
|
+
"file": "aws-well-architected-framework.md"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Chiến lược Caching trên AWS: Hướng dẫn toàn diện cho SAA
|
|
2
|
+
|
|
3
|
+
Caching là thành phần quan trọng trong kiến trúc hệ thống để giảm độ trễ, tăng hiệu năng và tối ưu chi phí. Bài viết này sẽ trình bày chi tiết các loại caching, các tình huống cần lưu ý và best practices khi triển khai trên AWS.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 3 Nhánh chính: Core Caching Types
|
|
8
|
+
|
|
9
|
+
### 1.1 Application-Level Caching
|
|
10
|
+
Caching trong tầng ứng dụng giúp giảm việc đọc trực tiếp từ database.
|
|
11
|
+
- **DynamoDB DAX:** Giảm độ trễ từ milliseconds xuống microseconds, tối ưu read-heavy workloads.
|
|
12
|
+
- **ElastiCache (Redis / Memcached):**
|
|
13
|
+
- Redis: TTL, pub/sub, persistence
|
|
14
|
+
- Memcached: simple, distributed, no persistence
|
|
15
|
+
- Thường dùng cho session store, leaderboard, real-time analytics
|
|
16
|
+
- **TTL (Time To Live):** Tự động hết hạn, giảm vấn đề invalidation
|
|
17
|
+
- **Write-through vs Lazy Loading:**
|
|
18
|
+
- Write-through: cập nhật cache trước → dữ liệu nhất quán
|
|
19
|
+
- Lazy Loading: cache chỉ khi đọc → nhanh nhưng có thể có cache miss
|
|
20
|
+
|
|
21
|
+
### 1.2 Edge Caching
|
|
22
|
+
Caching ở biên mạng, gần người dùng nhất giúp giảm độ trễ truy cập.
|
|
23
|
+
- **CloudFront:** Global edge locations, cache static content, signed URLs
|
|
24
|
+
- **Lambda@Edge:** Thay đổi request/response trước khi đến origin, custom authentication, header rewrite
|
|
25
|
+
- **S3 Signed URLs / Signed Cookies:** Kiểm soát truy cập file, URL có expiration
|
|
26
|
+
|
|
27
|
+
### 1.3 Database Caching
|
|
28
|
+
Caching trong hoặc gần database giúp giảm truy vấn nặng.
|
|
29
|
+
- **Query caching:** Cache kết quả truy vấn, giảm đọc lại cùng query
|
|
30
|
+
- **Read Replicas (Aurora/MySQL/Postgres):** Tăng read throughput, chuyển tải đọc sang replica
|
|
31
|
+
- **Aurora Global Database:** Cross-region read scaling, millisecond replication
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. 3 Nhánh phụ: Best Practices và các tình huống quan trọng
|
|
36
|
+
|
|
37
|
+
### 2.1 Khi nào nên dùng cache / khi nào không
|
|
38
|
+
- **Cache tốt khi:**
|
|
39
|
+
- Nhiều truy vấn lặp lại, read-heavy
|
|
40
|
+
- Dữ liệu ít thay đổi
|
|
41
|
+
- Truy cập global
|
|
42
|
+
- Tối ưu chi phí và scaling
|
|
43
|
+
- **Không nên dùng cache khi:**
|
|
44
|
+
- Dữ liệu thay đổi liên tục (write-heavy)
|
|
45
|
+
- Yêu cầu consistency cao (ví dụ banking)
|
|
46
|
+
- Cache miss cost > DB query cost
|
|
47
|
+
- TTL quá ngắn → cache không hiệu quả
|
|
48
|
+
|
|
49
|
+
### 2.2 Failure Scenarios
|
|
50
|
+
- Cache miss → DB overload
|
|
51
|
+
- Eviction quá nhiều → tăng latency
|
|
52
|
+
- Redis cluster node failure → dùng Multi-AZ + auto failover
|
|
53
|
+
- Stale data → dữ liệu cache không còn đúng
|
|
54
|
+
- Thundering herd problem → hàng ngàn request cùng truy vấn DB khi cache hết hạn
|
|
55
|
+
|
|
56
|
+
### 2.3 Cache Invalidation Patterns
|
|
57
|
+
- **TTL expiration:** tự hết hạn
|
|
58
|
+
- **On Write Invalidate:** khi ghi vào DB → xóa hoặc cập nhật cache
|
|
59
|
+
- **Write-through:** cập nhật cache + DB cùng lúc
|
|
60
|
+
- **Write-around:** ghi vào DB, bỏ qua cache → cache chỉ cập nhật khi đọc
|
|
61
|
+
- **Event-driven invalidation:** SQS / SNS thông báo khi dữ liệu thay đổi
|