A security engineer is performing containment during an active incident in which an EC2 instance is suspected of cryptomining and exfiltrating data. The engineer must isolate the instance from all network traffic, including traffic to AWS service endpoints and other resources in the same VPC, while preserving volatile memory and disk state for later forensic analysis. The engineer does not want to stop or terminate the instance. Which action should the engineer take to meet these requirements?
A security group with no inbound or outbound rules blocks all traffic to and from the instance's ENI, including traffic to VPC endpoints and other resources in the same VPC. Because security groups are stateful and applied at the ENI level, replacing the existing groups provides immediate, reversible containment while the instance keeps running, preserving both memory contents and EBS volume state for forensic acquisition.
Why this answer
Isolation must block traffic at the instance's network interface without stopping the instance, so that volatile memory and disk state survive for forensics. Replacing the attached security groups with an empty group applies a stateful, interface-level deny of all inbound and outbound traffic, including traffic to VPC endpoints and peer resources. Identity-based controls, route-table edits, and subnet-level firewalls either do not filter packets or affect more than the compromised instance.
Exam trap
The trap here is assuming that removing an internet route or denying IAM permissions contains a compromised instance, when only an interface-level network control such as an empty security group blocks all traffic while the instance keeps running.