How vishnugovindu23-cmd/aws-ec2-auto-isolation works
This repository automates EC2 containment: GuardDuty, Security Hub, or an analyst request enters a Lambda handler, is normalized and checked, then the isolator preserves evidence before applying quarantine and incident tags. The handler publishes the result to an optional SNS topic. A separate release entry point restores recorded security groups and marks the instance released. The README documents Terraform deployment and trigger wiring; Terraform source was not sampled, so those deployment relationships are based on the README rather than inspected configuration.
Main entry points: isolate.py Isolation workflow · handler.py Lambda handlers · main.tf Terraform deployment · notify.py SOC message builder
Components 19
Finding intake
- Lambda handlers
handler.py - Finding parser
finding.py
Containment and release
- Isolation workflow
isolate.py - EC2 instance state
- Termination protection
isolate.py - EBS evidence snapshots
isolate.py - Quarantine security group
isolate.py - Network interface groups
isolate.py - Incident tags
isolate.py - Release restoration
isolate.py
SOC notification
- SOC message builder
notify.py - SNS topic
AWS deployment
- Terraform deployment
main.tf - IAM role
main.tf - CloudWatch logs
Other components
- GuardDuty
- Security Hub
- Analyst request
- EventBridge rule
Connections 23
- GuardDuty → EventBridge rule: raises finding
README.md - EventBridge rule → Lambda handlers: triggers
README.md - Security Hub → Lambda handlers: raises finding
README.md - Analyst request → Lambda handlers: requests isolation
README.md - Lambda handlers → Finding parser: parses event
handler.py - Lambda handlers → Isolation workflow: isolates instance
handler.py - Lambda handlers → SOC message builder: publishes result
handler.py - Lambda handlers → Isolation workflow: releases instance
handler.py - Isolation workflow → EC2 instance state: describes
isolate.py - Isolation workflow → Termination protection: enables
isolate.py - Isolation workflow → EBS evidence snapshots: creates
isolate.py - Isolation workflow → Quarantine security group: gets or creates
isolate.py - Isolation workflow → Network interface groups: swaps groups
isolate.py - Isolation workflow → Incident tags: records incident
isolate.py - Isolation workflow → Release restoration: restores groups
isolate.py - Release restoration → Network interface groups: restores groups
isolate.py - Release restoration → Incident tags: marks released
isolate.py - SOC message builder → SNS topic: publishes alert
notify.py - Terraform deployment → Lambda handlers: deploys functions
README.md - Terraform deployment → EventBridge rule: configures trigger
README.md - Terraform deployment → SNS topic: creates topic
README.md - Terraform deployment → IAM role: creates role
README.md - Terraform deployment → CloudWatch logs: creates log group
README.md