Skip to content

Incident response on AWS: first steps and critical precautions

The first minutes shape the investigation. See how to contain an AWS incident without destroying evidence.

Reading time
9 min
Published

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.

Preserve the disk state before acting
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:

Deactivate a suspicious access key (identity containment)
aws iam update-access-key \  --access-key-id AKIAEXAMPLE \  --status Inactive \  --user-name affected-user

Once 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.

Frequently asked questions

Should I shut down the compromised instance immediately?
In general, no. Terminating the instance can erase evidence from memory and disk. The recommended approach is to isolate the instance by restricting its network access while it keeps running, and to take a snapshot of the volume before any destructive action. That way you contain the damage and preserve the evidence at the same time.
An access key leaked. What is the first step?
Revoke or rotate the credential to contain the access and, at the same time, use CloudTrail to rebuild everything that identity did. Look for signs of persistence, such as new users, new keys and permission changes. In the first moments, containment and investigation go hand in hand.
Do I need a response plan even as a small company?
Yes. It does not need to be long, but it needs to exist and say who gets called, how to isolate, where the logs are and how to communicate. With that defined beforehand, you avoid bad decisions under pressure. A simple, rehearsed plan is worth far more than improvising in the middle of a real incident.
Why document the incident timeline?
Because the timeline is part of the evidence and of the learning. With every action recorded with its time, it becomes easier to understand the sequence of the attack, assess whether the response worked and back up the decisions made afterward. It is also the basis for the root cause analysis and for any notification obligations.
What is break-glass access and why prepare it in advance?
Break-glass access is an emergency credential or path, stored securely, that lets you act when the normal identities are compromised or unavailable. It has to be prepared in advance because, in the middle of an incident, you may not be able to trust the everyday credentials. Any use of this access should be audited and raise an alert, since it exists only for emergencies and never for routine work.
What is the difference between containment, eradication and recovery?
Containment cuts off the attacker's reach without destroying evidence, for example by isolating the instance's network and deactivating the suspicious credentials. Eradication removes the attacker's presence and the cause that let them in. Recovery restores the service from a trusted baseline and confirms that the environment is back to normal. They are different phases, and teams that jump straight from containment to recovery often leave persistence behind.
What is a tabletop exercise and why run one?
It is a simulation in which the team walks through a hypothetical incident scenario and discusses the decisions, without touching the real environment. The goal is to test the plan before you need it, and this rehearsal is where outdated contacts, logs nobody can locate and missing permissions show up. Finding these gaps in a rehearsal costs much less than finding them during a real incident.

When to bring in specialist help

A real incident calls for experience and a cool head. In its monitoring and response service, GUARDIASEC helps structure detection and response and gets the playbooks and containment workflows defined before an incident happens.