← 返回
未分类 Key 中文

AWS Patrol

Automated AWS infrastructure patrol — collects EC2/RDS/ELB metrics, security posture (IAM MFA, SG, EBS encryption, S3), cost analysis (SP/RI coverage & utili...
自动化 AWS 基础设施巡检 — 采集 EC2/RDS/ELB 指标,检查安全态势(IAM MFA、安全组、EBS 加密、S3),进行成本分析(预留实例覆盖率和利用率)
chengcecho
未分类 clawhub v1.0.1 1 版本 99583.3 Key: 需要
★ 0
Stars
📥 239
下载
💾 0
安装
1
版本
#latest

概述

AWS Patrol

Automated AWS infrastructure monitoring, security audit, and cost analysis with visual report generation.

Prerequisites

  • Python 3.8+ with boto3
  • AWS credentials configured (profile or env vars)
  • Node.js + Puppeteer (for screenshot generation)
  • Required AWS permissions: ReadOnlyAccess (EC2, RDS, ELB, CloudWatch, IAM, S3, Cost Explorer, Savings Plans, Health, Pinpoint SMS)

Configuration (Environment Variables)

VariableDefaultDescription
--------------------------------
AWS_PATROL_PROFILEAWS_PROFILE or defaultAWS profile name
AWS_PATROL_REGIONSus-west-2,eu-west-2,ap-southeast-1Comma-separated regions
AWS_PATROL_OUTPUTCurrent directoryOutput directory for JSON/HTML/PNG

Workflow

1. Collect Resource Metrics

python3 scripts/patrol.py

Outputs aws-patrol-detail.json with:

  • EC2: CPU, network, status checks (alerts if CPU>80% or status check failed)
  • RDS: CPU, memory, connections, storage, IOPS (alerts if CPU>80%, low memory, low storage)
  • ELB: target group health, unhealthy targets
  • CloudWatch alarms in ALARM state
  • AWS Health events (last 7 days)
  • SMS/Pinpoint sender registration status

2. Collect Security & Cost Data

python3 scripts/patrol-security-cost.py

Outputs aws-security-cost.json with:

  • Security: IAM users without MFA, old access keys (>90d), open security groups (0.0.0.0/0 on sensitive ports), unencrypted EBS, public S3 buckets
  • Cost: 30-day total & daily trend, SP utilization & coverage (7-day daily), RDS/ElastiCache RI coverage, active SPs & RIs, waste detection (stopped instances, unattached volumes, unused EIPs, old snapshots, low-CPU instances)

3. Generate Visual Report

python3 scripts/gen-report.py '<JSON>'

Accepts a JSON argument with fields:

  • date, weekday, ec2Count, rdsCount, elbCount
  • costTotal, costDaily, unattachedVol, unusedEip, lowCpu, oldSnap
  • spUtilPct, spCovPct, rdsRiPct, ecRiPct
  • noMfa, unencEbs, openSg, oldKeys, s3Risk
  • highCpu (array: {name, cpu, type, level})
  • spRiDetails (string summary)
  • health (array: {type, title, desc})
  • sms (array: {name, status, level})
  • actions (array: {date, level, title, desc, daysLeft, daysLevel})

Outputs daily-report.html.

4. Screenshot & Deliver

# Start HTTP server
python3 -m http.server 18923 &
# Screenshot
node -e "const p=require('puppeteer');(async()=>{const b=await p.launch({headless:'new',args:['--no-sandbox']});const pg=await b.newPage();await pg.setViewport({width:520,height:800,deviceScaleFactor:2});await pg.goto('http://localhost:18923/daily-report.html',{waitUntil:'networkidle0'});await pg.screenshot({path:'daily-report.png',fullPage:true});await b.close()})()"
# Stop server
kill %1

Send daily-report.png via messaging with a brief summary.

Scheduling (Cron Example)

Set up a daily 9:00 AM patrol via OpenClaw cron (systemEvent → main session):

每天 9:00 运行 aws-patrol 巡检流程,采集数据 → 生成报告 → 截图推送

Anomaly Investigation

When high CPU, Health alerts, or SMS issues are detected, don't just report numbers — investigate root cause (check CloudWatch trends, recent deployments, process-level metrics) and include analysis in the report.

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-21 23:50 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,374 📥 319,826
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 673 📥 325,032
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,073 📥 805,944