Whitepaper - Architecting for the Cloud (AWS Best Practices)
Architecting for the Cloud (AWS Best Practices) (2016/02) 是 AWS 針對設計雲端架構的最佳實踐原則,描述了很多架構設計要知道的原則。
對於要設計 PaaS 或 SaaS 是非常有參考價值的。另外一篇也是很有參考價值的是 AWS Well Architected Framework.
Updated: 2018/01 我在公司內部教育訓練導讀了此篇,整理 Slide 分享 - Study Notes - Architecting for the cloud (AWS Best Practices, Feb 2016)
雲端運算和傳統的差異
- IT 資產變成可以程式化 (Programmable) 的資源: 傳統的機房設備,要面對硬體資源、資產、使用狀況等問題,牽涉層面廣泛且難以做成本估量。
- 全球、高可用性、且沒有限制的容量 (Capacity)
- 更高程度的管理服務
- 資安是本來就有的
設計的原則
Scalability (可擴展性): 包含橫向跟縱向的擴展
- Scaling Vertically (垂直擴展): 針對機器的等級垂直升降,像是增加 CPU / Memory / IO / Network 等。
- Scaling Horizontally (水平擴展): 針對使用狀況,水平增加機器數.
- Stateless Applications: 像是 AWS Lambda functions
- Stateless Components
- Distributed Processing: 離線的批次作業. 可以利用像是 hadoop 這樣的方式實現. 更多可以參考 “Big Data Analytics Options on AWS“
Stateless Applications 裡提到 “How to distribute load to multiple nodes” 的方式有以下兩種:
- Push mode:
- 利用 ELB 這樣的方式,平均分擔 request 到 backends.
- 利用 DNS (e.g., Route53) 的 RR (round robin) or TTL (latency) 方式分擔 request
- Pull mode: 非同步模式, 這種方式就不需要 load balance. 執行工作會先被放到一個地方, 通常是 queue, 像是 SQS, 或者資料蒐集 Kinesis. 然後有很多 node 會去
pull
然後 consume / processing 這些訊息.
Disposable Resources Instead of Fixed Servers: 可拋棄型資源取代固定的伺服器
- Instantiating Compute Resources
- Bootstrapping
- Golden Images
- Hybrid
- Infrastructure as Code: infrastructure reusable, maintainable, extensible, and testable.
相關文章:
- Immutable infrastructure
- Overview of Deployment Options on AWS
- Managing Your AWS Infrastructure at Scale
Automation (自動化)
- AWS Elastic Beanstalk
- Amazon EC2 Auto recovery
- Auto Scaling
- Amazon CloudWatch Alarms
- Amazon CloudWatch Events
- AWS OpsWorks Lifecycle events
- AWS Lambda Scheduled events
Loose Coupling (鬆散耦合)
- Well-Defined Interfaces: REST API, AWS API Gateway
- Service Discovery
- Asynchronous Integration
- Graceful Failure
Services, Not Servers
- Managed Services
- Serverless Architectures: Lambda
Databases
重點在於 RMDBS, NoSQL, dW, Search 的選擇策略。
- Relational Databases
- Scalability
- High Availability
- Anti-Patterns:
- 資料都沒有 join, index 的問題,建議使用 NoSQL
- 如果是存 media / file / image 的 meta 在 DB, 然後檔案存在像 S3 的地方,那建議使用 NoSQL
- NoSQL Databases
- Scalability
- High Availability
- Anti-Patterns: 跟 RMDBS 相反.
- Data Warehouse
- Scalability: massively parallel processing (MPP)
- High Availability
- Anti-Patterns: 不適合 OLTP (Online Transaction Processing)
- Search
- Scalability
- High Availability
Removing Single Points of Failure (SPOF)
- Introducing Redundancy
- Detect Failure
- Durable Data Storage
- Automated Multi-Data Center Resilience
- Fault Isolation and Traditional Horizontal Scaling
Designing good health checks
- health check by ELB tcp
- deep health check: check each nodes. 適合用在 route53 的參考依據, 但不適合用在 ELB 檢查.
相關文章:
Optimize for Cost
- Right Sizing
- Elasticity
- Take Advantage of the Variety of Purchasing Options
- Reserved Capacity
- Spot Instances
- Caching
- Application Data Caching
- Edge Caching
Security
- Utilize AWS Features for Defense in Depth
- Offload Security Responsibility to AWS
- Reduce Privileged Access
- Security as Code
- Real-Time Auditing
參考資料
- Architecting for the Cloud (AWS Best Practices) (PDF)
- AWS Well Architected Framework (PDF)
- Cloud First: New Architecture for New Infrastructure
- New Whitepaper: Architecting for the Cloud: Best Practices (AWS Blog)
- January 2010: Architecting for the Cloud: Best Practices
- Overview of Deployment Options on AWS
- Managing Your AWS Infrastructure at Scale