Faced with a suspected compromise on AWS, the first reaction is usually to shut everything down. The problem is that this reflex can destroy exactly the evidence that would explain what happened. Incident response means balancing two needs that seem opposed, containing the damage and preserving the evidence, and the first steps, taken calmly and methodically, determine the quality of the entire investigation.
The guidance below covers those first steps in AWS environments, with a defensive focus and an emphasis on preserving evidence. It does not replace a formal response plan or a specialized team, but it helps you avoid the most common mistakes of the opening minutes.
Preparation: decisions that can't wait for the incident
The quality of the response is decided before the incident begins. Under pressure, there's no time to figure out who calls whom, where the logs are or how to isolate a resource without bringing operations down. A simple written plan that the team already knows does more than the best improvisation done in a hurry.
- A written response plan, with a call-out and escalation flow
- Defined roles: who coordinates, who investigates, who communicates
- Break-glass access to act when the normal credentials are under suspicion
- A forensic path, such as an account or VPC dedicated to isolated analysis
- Up-to-date contacts, including legal and communications when applicable
A plan that was never rehearsed tends to fail the first time it is used. In tabletop exercises, the team walks through a hypothetical scenario and tests its decisions, and the gaps show up in advance: an outdated contact, a log nobody knows where to find, a missing permission. Finding this out in a rehearsal costs far less than finding it out during a real incident.
Isolate without destroying
With a suspicious instance, prefer isolating it to terminating it. Isolating means applying a restrictive Security Group that cuts communication with the outside but keeps the instance running for analysis. If you terminate the instance, you may erase data in memory and on disk that would explain how the attack happened.
Before any destructive change, take a snapshot of the volume to preserve the state of the disk. And write down each action with its time, because the response timeline is also part of the evidence.
Credentials and identity
If the suspicion involves credentials (a leaked access key, for example), containment means revoking or rotating the credential and reviewing everything it may have done. CloudTrail is where you rebuild that identity's activity: where it came from, what it accessed and what it changed. Look for newly created users and keys and for permission changes, which are common persistence tactics, that is, ways of keeping access even after the original credential is replaced.
- Revoke or rotate the suspicious credentials
- Review the identity's activity in CloudTrail
- Look for unexpected users, keys and roles being created
- Check for changes to policies and security settings
- Check for activity in regions that are not normally used
Response phases and technical containment
Reference models split the response into phases: preparation, detection and analysis, containment, eradication, recovery and lessons learned. The sequence is not rigid, but it helps you know where you are in the work and what cannot be skipped. The most expensive mistakes happen in the first three, because that is where haste destroys evidence.
Preserve before you contain
Before any action that changes the resource, capture its current state. A volume snapshot, created with the command below, preserves the disk for later analysis, even if the instance has to be isolated right afterward. Write down the time of each command, because the order of actions is also evidence.
aws ec2 create-snapshot \ --volume-id vol-0example \ --description "incident-response preservation 2026-07-24"Isolate identity and network
Containment cuts off the attacker's reach without erasing the traces. On the network side, swap the instance's security group for an isolation group that removes communication with the outside and keeps the resource running. On the identity side, deactivate the suspicious credential to stop its use while the investigation continues. For an access key, the command is:
aws iam update-access-key \ --access-key-id AKIAEXAMPLE \ --status Inactive \ --user-name affected-userOnce the spread is contained, eradication removes the attacker's presence and recovery restores the service from a trusted baseline. Rebuilding from a clean image is safer than trying to clean up a compromised system. And every secret that may have been exposed must be rotated before the system goes back into operation.
Containment, communication and lessons
The goal of containment is to stop the incident from spreading while the investigation runs. Notify the right people early, following the defined plan, without going silent and without spreading panic. And keep the record of the timeline, the decisions and the collected evidence in one place.
After containment and recovery, analyze what happened and what allowed the incident. Looking for someone to blame does not help at all. What reduces the chance of a repeat is fixing the root cause and strengthening the controls.
Practical checklist
- Isolate suspicious resources with restrictive networking instead of terminating them right away
- Snapshot the volumes before any destructive change
- Revoke or rotate the suspicious credentials
- Rebuild the identity's activity in CloudTrail
- Look for persistence: new users, keys and roles
- Check for policy changes and activity in unusual regions
- Document the timeline and the decisions, with timestamps
- Notify the right people, according to the plan
- Contain the spread before moving on to recovery
- Run a root cause analysis and strengthen the controls
- Have the plan, roles and contacts defined before the incident
- Prepare break-glass access and an isolated forensic path
- Rehearse the response with tabletop exercises
- Rebuild from a trusted image and rotate exposed secrets
Best practices
- Have a response plan defined before the incident
- Prefer isolating to destroying, to preserve the evidence
- Take snapshots before any destructive action
- Use CloudTrail as the basis for the timeline
- Record everything in one place, with timestamps
- Finish with a root cause analysis, without looking for someone to blame
- Rehearse the plan with tabletop exercises before you need it
- In recovery, rebuild from a trusted baseline instead of patching
Common mistakes
- Terminating the suspicious instance immediately
- It destroys the evidence in memory and on disk that would explain the attack.
- Not taking a snapshot before acting
- The disk state is lost and the forensic analysis is compromised.
- Forgetting to look for persistence
- The attacker keeps access through users or keys created during the incident.
- Not documenting the timeline
- The reconstruction becomes shaky and important decisions get lost.
- Responding with no plan and no communication
- Everyone acts on their own, and panic or silence makes the damage worse.
- Not preparing break-glass access
- When the normal credentials are under suspicion, the team has no safe way to act.
- Patching up the compromised system during recovery
- Leftover persistence survives, and the attacker regains access later.
Authorship and review
Cesar Gargiulo
CEO and founder of GUARDIASEC. Technical and editorial lead for the content published in this library.
Published on . Found a technical error? Write to [email protected] and we will correct it and keep a record of the change.