Interview Prep/DevSecOps/Incident Response and Governance

An EC2 instance is confirmed compromised. A colleague wants to terminate it immediately. What do you do instead?

IntermediateScenarioIncident Response and Governance
Answer

Situation read → Terminating destroys memory and disk evidence. We need to contain without losing forensics.

What I'd do →

  1. Isolate: replace its security groups with an empty "quarantine" group and detach it from the load balancer and Auto Scaling group.
    aws autoscaling detach-instances --instance-ids i-0abc --auto-scaling-group-name web --should-decrement-desired-capacity
    aws ec2 modify-instance-attribute --instance-id i-0abc --groups sg-0quarantine
    
  2. Enable termination protection and tag it incident=IR-2026-014.
  3. Capture memory (if tooling is available, e.g. AVML) and snapshot all EBS volumes.
  4. Detach or revoke the instance profile credentials (revoke older sessions on the role).
  5. Analyse snapshots in a separate forensics account, never on the live host.

Why → Evidence tells us how they got in and what they touched; without it we cannot be sure the fix is complete.

Interview tip → Note that changing security groups does not cut already-tracked connections; NACLs do.

All DevSecOps questions

More on Incident Response and Governance