saikommera/devops-automation-scripts
GitHub: saikommera/devops-automation-scripts
提供AWS和Terraform自动化脚本的DevOps工具
Stars: 0 | Forks: 0
# ⚙️ DevOps 自动化脚本
[](https://python.org)
[](https://aws.amazon.com)
[](LICENSE)
适用于 AWS 成本报告、EKS 集群健康监控、Terraform 状态漂移检测和事件响应自动化的生产级 Python 和 Bash 自动化脚本。
## 📁 脚本
| 脚本 | 语言 | 目的 |
|---|---|---|
| `aws/cost_report.py` | Python | 每周按服务拆分的 AWS 成本 + 邮件报告 |
| `aws/eks_health_check.py` | Python | EKS 集群健康、节点状态、不健康 pod 检测 |
| `aws/terraform_drift.py` | Python | 检测并报告 Terraform 状态漂移 |
| `aws/ec2_rightsizing.py` | Python | 识别过大的 EC2 实例以进行 FinOps |
| `bash/incident_response.sh` | Bash | 自动事件分类和 Slack 通知 |
| `bash/log_cleanup.sh` | Bash | 自动日志轮转和 S3 归档 |
## 🚀 设置
```
git clone https://github.com/saikommera/devops-automation-scripts.git
cd devops-automation-scripts
pip install -r requirements.txt
# Configure AWS credentials
export AWS_PROFILE=your-profile
export AWS_DEFAULT_REGION=us-east-1
```
## 💰 AWS 成本报告
```
# Generate weekly cost report and email to team
python aws/cost_report.py --days 7 --email team@company.com --threshold 1000
```
## 🏥 EKS 健康检查
```
# Check all clusters in account
python aws/eks_health_check.py --region us-east-1 --alert-slack
# Output example:
# ✅ prod-cluster: 15/15 nodes healthy, 0 pods crashing
# ⚠️ staging-cluster: 1 node not ready, 2 pods in CrashLoopBackOff
```
## 🔍 Terraform 状态漂移检测
```
# Detect drift and post to Slack
python aws/terraform_drift.py --workspace prod --slack-webhook $SLACK_WEBHOOK
```
## 🧑💻 作者
**Sai Babji Kommera** — 高级 DevOps / SRE 工程师
[LinkedIn](https://www.linkedin.com/in/sai-babji-kommera-a3b953396/) · saibabji1@gmail.com
标签:AWS, Bash, DPI, ECS, EKS, OISF, Python, Slack 通知, Terraform, 云服务管理, 健康检查, 应用安全, 开源框架, 性能监控, 成本报告, 成本效益分析, 持续部署, 持续集成, 故障排除, 数字取证, 无后门, 日志管理, 漂移检测, 漏洞利用检测, 自动化脚本, 自动化运维, 资源优化, 逆向工具