Chebis26/site-reliability-engineering

GitHub: Chebis26/site-reliability-engineering

面向 AWS 工作负载的生产级 SRE 框架,通过 Terraform 落地 SLO/SLA 管理、错误预算跟踪、混沌工程与可观测性体系。

Stars: 1 | Forks: 0

# AWS 上的站点可靠性工程 [![AWS](https://img.shields.io/badge/AWS-SRE-FF9900?logo=amazon-aws)](https://aws.amazon.com/) [![Terraform](https://img.shields.io/badge/Terraform-1.7+-623CE4?logo=terraform)](https://www.terraform.io/) [![许可证](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) 针对 AWS 工作负载的生产级 SRE 框架:SLO/SLA 定义与跟踪、错误预算管理、事件响应手册、结合 AWS Fault Injection Simulator 的混沌工程,以及完整的可观测性技术栈。 ## SRE 支柱 | 支柱 | 实现方式 | |--------|---------------| | 服务级别目标 (SLO) | CloudWatch 指标 + 复合告警 | | 错误预算 | 带有每周报告的 Lambda SLO 跟踪器 | | 事件响应 | PagerDuty + runbook + 自动化诊断 | | 减少琐事 | 用于重复性运维任务的 Lambda 自动化 | | 容量规划 | Compute Optimizer + Auto Scaling 策略 | | 混沌工程 | AWS Fault Injection Simulator 实验 | | 可观测性 | CloudWatch + X-Ray + OpenTelemetry | ## SLO 定义 ``` Service: payment-api Availability SLO: 99.95% (error budget: 21.9 min/month) Latency SLO p99: < 500ms Latency SLO p50: < 50ms Service: user-service Availability SLO: 99.9% (error budget: 43.8 min/month) Latency SLO p99: < 1000ms ``` ## 事件严重性级别 | SEV | 定义 | 响应时间 | 解决目标 | |-----|------------|---------------|-------------------| | SEV-1 | 完全服务中断 | 5 分钟 | 4 小时 | | SEV-2 | 主要功能严重降级 | 15 分钟 | 8 小时 | | SEV-3 | 轻微影响,存在权宜之计 | 1 小时 | 3 天 | | SEV-4 | 表面问题 / 无用户影响 | 下一个工作日 | 2 周 | ## 混沌工程 AWS Fault Injection Simulator 实验: - `chaos/az-failure.json` — 模拟可用区 (AZ) 故障 - `chaos/instance-termination.json` — 随机终止 EC2 实例 - `chaos/latency-injection.json` — 注入网络延迟 - `chaos/cpu-stress.json` — 对 ECS 任务施加 CPU 压力 ## 快速开始 ``` # 部署监控 stack cd terraform/environments/prod terraform init && terraform apply # 运行 chaos experiment(仅限 staging!) aws fis start-experiment --experiment-template-id # 生成 SLO 报告 python3 scripts/python/slo_report.py --service payment-api --days 30 ``` ## 许可证 MIT 许可证
标签:API集成, AWS, DPI, ECS, SLO, SRE, Terraform, 偏差过滤, 可观测性, 混沌工程, 用户代理, 运维自动化, 逆向工具