rushikesh-0015/Automated-Incident-Response-System-using-AWS

GitHub: rushikesh-0015/Automated-Incident-Response-System-using-AWS

基于 AWS CloudWatch 和 Lambda 的自动化扩容系统,在 CPU 负载超过阈值时自动增加 EC2 实例以保障服务可用性。

Stars: 0 | Forks: 0

# 自动化事件响应系统 (AWS) ## 概述 本项目通过 AWS CloudWatch、Lambda 和 Auto Scaling 监控 CPU 使用率,并自动扩展 EC2 实例。 ## 流程 CloudWatch → Alarm → Lambda → Auto Scaling → 新 EC2 ## 步骤 ### 启动模板 * 创建 EC2 模板 (Amazon Linux, t2.micro) 📸 ![Launch](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/launch-template.png) ### 2. Auto Scaling Group * 最小:1 | 期望:1 | 最大:3 📸 ![ASG](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/asg.png) ### 3. Lambda 函数 ``` import boto3 asg = boto3.client('autoscaling') def lambda_handler(event, context): asg.set_desired_capacity( AutoScalingGroupName='My-ASG', DesiredCapacity=2, HonorCooldown=False ) ``` 📸 ![Lambda](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/lambda.png) ### 4. CloudWatch Alarm * CPU > 50% * 操作 → Lambda 📸 ![Alarm](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/alarm-config.png) ### 5. 测试 ``` stress --cpu 4 --timeout 300 ``` 📸 ![Test](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/testing.png) ## 验证 ### Alarm 配置 ![Alarm](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/alarm-config.png) ### Lambda 代码 ![Lambda](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/lambda.png) ### 触发器 ![Trigger](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/alarm-trigger.png) ### 扩展 ![Scaling](https://raw.githubusercontent.com/rushikesh-0015/Automated-Incident-Response-System-using-AWS/master/screenshots/scaling.png) ## 结构 ``` project/ ├── README.md ├── lambda-code/ ├── screenshots/ └── architecture/ ``` ## 总结 系统在负载增加时自动扩展 → 高可用性
标签:Auto Scaling, AWS, CloudWatch, DPI, EC2, IaC, Lambda, Python, 云计算, 弹性伸缩, 无后门, 无服务器, 无线安全, 监控告警, 自动化运维, 规则引擎, 负载均衡, 资源调度, 逆向工具, 高可用架构