Cloud
AWS incident response starts with these questions
A practical guide to AWS incident response. Identify the acting identity, sweep CloudTrail in every region, contain keys and instances, and keep evidence.
Something is wrong in your AWS account: a GuardDuty alert, a bill that jumped overnight, or an email from AWS about an exposed key. AWS incident response goes faster when you answer a handful of questions in the right order, and this is that order.
Where AWS incident response starts: which identity is acting?
Every API call in CloudTrail carries a userIdentity block. Before you contain anything, work out whose actions you’re looking at.
- type tells you whether it was an IAM user, an assumed role, the root user or a federated session.
- accessKeyId tells you what kind of credential. Keys starting with
AKIAare long-term IAM user keys. Keys starting withASIAare temporary STS credentials from a role, an SSO session or an instance profile. - sourceIPAddress and userAgent show where the call came from and with what. A role that normally runs on EC2, suddenly making calls from a residential IP with a command-line user agent, means the instance credentials were stolen, usually through the metadata service.
Any root user activity you can’t explain is its own emergency. So is an IAM user nobody on the team recognizes. If you haven’t yet opened a decision log and agreed who is running the response, our piece on the first hour of a cyber incident covers that part.
Is CloudTrail actually covering every region?
CloudTrail event history gives you 90 days of management events at no cost, but it’s per region and covers management events only. Attackers know most companies use one or two regions, and they’re happy to launch GPU instances for mining in the ones you never open.
Run aws cloudtrail describe-trails and look for IsMultiRegionTrail and IsOrganizationTrail, then aws cloudtrail get-trail-status to confirm nobody stopped logging. Data events, such as S3 object reads, aren’t recorded unless someone turned them on. That one setting usually decides whether you can say which files were taken.
When you have a suspect key, sweep every region rather than the one your console happens to be showing:
for r in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text); do
echo "== $r"
aws cloudtrail lookup-events --region "$r" \
--lookup-attributes AttributeKey=AccessKeyId,AttributeValue=AKIAEXAMPLEKEY \
--query "Events[].[EventTime,EventName]" --output text
done
For anything beyond a quick look, query the trail’s logs in S3 with Athena or use CloudTrail Lake; the CloudTrail user guide covers both. Search specifically for StopLogging, DeleteTrail, PutEventSelectors and DeleteDetector. An attacker who tried to blind you has told you something about their plans.
What did the access key do?
Leaked access keys are a very common way in, and what happens after a leak tends to follow a recognizable pattern:
GetCallerIdentityfirst, to see whose key it is- Enumeration:
ListBuckets,ListUsers,GetAccountSummary,DescribeInstancesregion after region - Persistence:
CreateUser,CreateAccessKeyon an existing user,CreateLoginProfile,AttachUserPolicyorPutUserPolicy, or a new role whose trust policy names an outside account - Monetization:
RunInstancesin unused regions, service quota increase requests, SES send-quota checks before a spam run - Data theft:
GetObjectif data events exist, orModifySnapshotAttributeandModifyImageAttributeto share snapshots or AMIs with another account
Before you rotate, find out where the key leaked from: a public Git commit, CI/CD variables, an .env file on a web server, a developer’s laptop. If you don’t close the source, the replacement key leaks the same way, and you get to do this again next month.
What is GuardDuty already telling you?
If GuardDuty was enabled, read its findings before you settle on a theory. Look for types like UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS, CryptoCurrency:EC2/BitcoinTool.B!DNS, Stealth:IAMUser/CloudTrailLoggingDisabled and the Discovery:S3 family. Findings are regional, so check every region, or use the delegated administrator account if you run GuardDuty across an organization.
If it wasn’t enabled, turn it on now. It analyzes activity from the point you enable it, so it won’t explain the past. It will tell you whether the attacker is still active while you work.
Is anything in S3 exposed?
Check account-level Block Public Access first (aws s3control get-public-access-block --account-id 111122223333), then bucket policies with a wildcard principal, then ACLs. IAM Access Analyzer lists buckets shared outside your account or organization, which beats reading policies one at a time.
Whether you can prove what was downloaded depends on S3 server access logs or CloudTrail data events. If neither was on, you can show that a bucket was exposed and for how long, but not who read it. That distinction carries a lot of weight in the breach decision that follows.
How do you contain an instance without destroying evidence?
Collect first, then cut off.
- Snapshot every attached EBS volume.
aws ec2 create-snapshot --volume-id vol-0abc123 --description "IR web-03 2026-11-02T08:15Z". Tag the snapshots and share or copy them to a separate forensics account. If the volumes use a customer managed KMS key, that account needs permission to use the key. - Capture memory if it matters, with a tool already on the instance or pushed through Systems Manager. Stopping the instance loses memory and anything on instance store volumes.
- Turn on termination protection and detach the instance from its Auto Scaling group and load balancer, so it isn’t replaced and stops serving traffic.
- Isolate it with a security group that has no inbound and no outbound rules, replacing every group on the network interface. One caveat: changing security groups doesn’t necessarily drop connections that are already being tracked. A network ACL deny on the subnet cuts them immediately, at the cost of affecting everything else in that subnet.
- Deal with the instance role. Credentials taken from the metadata service stay valid until they expire. Use Revoke active sessions on the role in the IAM console, which adds a policy denying any session issued before that moment.
The AWS Security Incident Response Guide goes further into isolation patterns and forensic accounts, and our note on preserving evidence without slowing recovery covers hashing and chain of custody.
Rotating keys without breaking production
In an emergency, deactivate rather than delete. aws iam update-access-key --user-name svc-build --access-key-id AKIAEXAMPLEKEY --status Inactive stops the key at once and can be reversed if you’ve just broken the nightly billing run. Delete it once the replacement is deployed and the incident is understood.
Generate a credential report (aws iam generate-credential-report, then aws iam get-credential-report) to see every user, key and last-used date. Rotate every secret that lived wherever the leaked key lived. Document, then remove, everything the attacker created: users, keys, roles, policies, Lambda functions, instances. Confirm the root user has MFA and a changed password.
Which organization guardrails help mid-incident?
If you use AWS Organizations, service control policies give you containment the attacker can’t undo from inside a member account. Three are worth having written before you need them:
- A quarantine SCP that denies everything except an incident response role, for moving a compromised account into a locked-down OU
- A region deny using the
aws:RequestedRegioncondition key, so unused regions stay unused - A protect-the-logs policy denying
cloudtrail:StopLogging,cloudtrail:DeleteTrail,guardduty:DeleteDetectorandorganizations:LeaveOrganization
Two caveats. SCPs don’t apply to the management account, which is one more reason to keep workloads out of it. And a deny-all SCP on a production account stops production too. That may be the right call, but make it deliberately, with the business owner on the call.
If you’re looking at a leaked key right now: deactivate it, sweep CloudTrail in every region for what it did, and snapshot anything it touched before you start cleaning up. For investigations that span several accounts or an identity provider, our cloud and identity incident response starts with exactly these questions. Report an active AWS incident here, or email [email protected]; every report is acknowledged within 15 minutes, day or night.
Dealing with this right now?
A responder will acknowledge your report within 15 minutes, 24/7.
Related service: Cloud & Identity Incidents