SCS-C03 · Domain 2 · Incident Response (14%) · Day 3 of 3
Responding to security events
Day 2 automated the response and captured forensic evidence. Today is the response itself: searching and correlating logs, checking whether a finding is real and how big it is, containing stolen credentials, hacked instances, buckets, functions and containers, recovering from clean backups and images, and finding the root cause with Amazon Detective. It ends with a review quiz across all three Incident Response days.
Skill 2.2.2 search and correlate logsSkill 2.2.3 validate findingsSkill 2.2.4 contain, eradicate, recoverSkill 2.2.5 root cause analysisDomain 2 review~95 min read + 30 min lab
01
Searching logs: CloudTrail Lake, Athena and Logs Insights
When an alert fires, the first question is always “what exactly happened?”. Skill 2.2.2 asks you to search and correlate logs across services. In practice that means asking the same questions of CloudTrail (who called which API), VPC Flow Logs (which IPs talked), application logs and service logs, and lining the answers up by time, user and IP address.
AWS gives you three main query tools. Which one is right depends mostly on where the logs already live. The exam likes the cheapest tool that works without moving data.
Concept profile
Amazon Athena on CloudTrail logs
often confused with CloudTrail Lake
?What is it?
Serverless SQL over log files stored in Amazon S3. You create a table that describes the CloudTrail JSON format (the CloudTrail console can create it for you), then query months of API history with standard SQL.
⚙How does it work?
Point a table at the trail’s S3 prefix. Use partition projection on Region and date so queries scan only the days you ask for.
You pay for the data scanned, so always filter on the date partition.
The same approach works for VPC Flow Logs, ALB access logs, S3 server access logs and WAF logs, so you can join them on IP address and time.
Results go to an S3 output location, which is useful as evidence.
{ }Structure
Three query tools and how to choose between them.
⇄Athena vs CloudTrail Lake
Athena on S3 logs
CloudTrail Lake
Data location
Your S3 bucket (trail files)
Managed event data store
Format
JSON files you describe with a table
ORC, already queryable
Retention
As long as you keep the S3 objects
Up to about 10 years (one-year extendable pricing) or 7 years
Non-AWS events
Any file you put in S3
PutAuditEvents integrations
New customers
Open
Closed from 31 May 2026; existing customers continue
!Common mistakes the exam tests
Querying CloudTrail with Athena without date partitions: slow and expensive.
Expecting data events (S3 object reads, Lambda invokes) in a trail that only logs management events: they must be enabled before the incident.
Choosing CloudTrail Event history for a 6-month search: it covers only 90 days of management events.
Picking CloudTrail Lake for a brand-new account in a 2026 scenario: AWS closed it to new customers on 31 May 2026.
Forgetting that Logs Insights can only search what was sent to CloudWatch Logs; a trail that goes only to S3 needs Athena.
✓Benefits and use cases
Find every API call made with a leaked access key.
List all actions from one source IP across accounts (organization trail).
Join CloudTrail with VPC Flow Logs to follow an attacker from login to data transfer.
CloudTrail Lake and CloudWatch Logs Insights
CloudTrail Lake stores events in event data stores that you query with SQL (Trino SELECT statements), and it has a query generator that writes SQL from an English prompt. It can also hold AWS Config items and events from outside AWS. Important for 2026: CloudTrail Lake is no longer open to new customers from 31 May 2026; existing customers keep using it, and AWS recommends migrating to Amazon CloudWatch (organization-wide CloudTrail ingestion, OCSF pipelines, S3 Tables for Athena). CloudWatch Logs Insights queries log groups with the Logs Insights query language, OpenSearch PPL or OpenSearch SQL. Queries time out after 60 minutes, results stay available for 7 days, and you pay per GB of data scanned. It is the natural choice for application logs, Lambda logs, VPC Flow Logs sent to CloudWatch, and a trail delivered to CloudWatch Logs.
Think of it like · a library after a theft
Different ways to search the records.
AWS concept
Familiar thing
CloudTrail
≈
The visitor book: who came in, when, and what they asked for
Athena on S3
≈
Reading old visitor books from the archive room with a good index
Partition projection
≈
Shelves labelled by year and month so you only open the right box
CloudTrail Lake
≈
A ready-made searchable database of the visitor book, now only for existing members
Logs Insights
≈
Searching today’s CCTV notes and staff reports quickly
Correlation
≈
Matching the visitor book with the CCTV time stamps
Real AWS example · follow a leaked key in Athena and Logs Insights
First Athena over the S3 trail, then Logs Insights over the trail’s log group.
-- Athena (table created from the CloudTrail console)
SELECT eventtime, eventsource, eventname, sourceipaddress, errorcode
FROM cloudtrail_logs_org_trail
WHERE useridentity.accesskeyid = 'AKIAIOSFODNN7EXAMPLE'
AND timestamp >= '2026/10/08'
ORDER BY eventtime;
# CloudWatch Logs Insights (log group: aws-cloudtrail-logs-org)
fields @timestamp, eventName, sourceIPAddress, errorCode
| filter userIdentity.accessKeyId = "AKIAIOSFODNN7EXAMPLE"
| stats count(*) as calls by eventName, sourceIPAddress
| sort calls desc
Look for CreateUser, CreateAccessKey, AttachUserPolicy and RunInstances: attackers create persistence and crypto miners first.
Many AccessDenied errors from one IP usually mean the attacker was exploring permissions.
Exam-style scenario
A security engineer must find every API call made with a compromised access key over the last 8 months. The organization trail delivers logs only to an S3 bucket. The company has never used CloudTrail Lake. What is the most cost-effective approach?
A. Use CloudTrail Event history in the console.
B. Create an Athena table with partition projection over the trail’s S3 prefix and query by access key ID and date.
C. Create a CloudTrail Lake event data store and import the logs.
D. Stream the S3 logs to CloudWatch Logs and use Logs Insights.
Show the worked answer
Answer: B
Athena queries the logs where they already are, and partitions keep the cost low.
Why not the others
A: Event history covers only the last 90 days of management events.
C: CloudTrail Lake is closed to new customers since 31 May 2026, and importing costs more.
D: Moving months of logs into CloudWatch is slow and expensive.
How the exam tests this
“Query CloudTrail logs stored in S3 with SQL”→ Athena (partition projection).
“Search Lambda or app logs in CloudWatch”→ Logs Insights.
“Last 90 days of management events, no setup”→ CloudTrail Event history.
“Who read objects in a bucket?”→ CloudTrail data events (must be enabled first).
“SQL over existing event data stores”→ CloudTrail Lake (existing customers).
Must remember
Pick the tool by where the logs are.
Athena: filter on date partitions.
Event history = 90 days, management events.
Logs Insights: 60 min timeout, results 7 days.
CloudTrail Lake: closed to new customers from 31 May 2026.
Correlating across sources: Security Lake and OpenSearch
A real attack crosses many log types: a phishing login (identity logs), API calls (CloudTrail), DNS lookups (Route 53 Resolver), network traffic (VPC Flow Logs) and maybe a firewall outside AWS. Each tool writes its own format. To correlate them you want one schema and one place to query.
Concept profile
Amazon Security Lake
often confused with CloudTrail Lake
?What is it?
A managed security data lake in your own account. It collects logs and findings from AWS services and third parties, converts them to the Open Cybersecurity Schema Framework (OCSF), and stores them as Apache Parquet in S3.
⚙How does it work?
Native AWS sources: CloudTrail management and data events, VPC Flow Logs, Route 53 Resolver query logs, Security Hub CSPM findings, EKS audit logs and AWS WAF logs.
Custom sources (on-premises, SaaS, partner tools) write OCSF Parquet into the lake.
Rollup Regions combine data from many Regions into one, which also helps with data residency rules.
Subscribers: query access through Lake Formation tables (Athena, Redshift, OpenSearch) or data access where a tool is notified of new objects and reads the files.
{ }Structure
Many sources in, one schema out, controlled subscribers.
⇄Security Lake vs CloudTrail Lake
Security Lake
CloudTrail Lake
Scope
Many log types and findings
CloudTrail events (plus Config and audit events)
Schema
OCSF, Parquet
CloudTrail event format, ORC
Storage
S3 buckets you own
Managed by CloudTrail
Query with
Athena, Redshift, OpenSearch, partner SIEMs
CloudTrail Lake SQL, or Athena via federation
Exam hint
“normalize”, “OCSF”, “third-party SIEM”
“SQL on CloudTrail events, existing store”
!Common mistakes the exam tests
Thinking Security Lake replaces GuardDuty: it stores data; it does not detect threats by itself.
Forgetting that the data stays in your S3 buckets, so bucket and Lake Formation permissions matter.
Giving a SIEM subscriber all sources in all Regions when it needs only some: subscribers are scoped to sources and Regions.
Expecting custom sources to be converted for you: custom data must already be in OCSF.
Confusing OCSF (open schema) with ASFF (the older Security Hub CSPM finding format).
✓Benefits and use cases
One SQL query across CloudTrail, DNS and flow logs during an investigation.
Feeding a partner SIEM without building many pipelines.
Keeping long-term security data under your own retention rules.
Amazon OpenSearch Service for investigations
Amazon OpenSearch Service is a search and dashboard engine. Security teams use it as a log analytics platform: near real-time search, dashboards, alerting, and the Security Analytics plugin with detection rules. It can ingest logs (for example through OpenSearch Ingestion) or query data in place, including Security Lake data, through direct query integrations. Choose it when the question says interactive dashboards, full-text search or near real-time alerting over large log volumes. Choose Athena for occasional SQL over S3 at the lowest cost.
Think of it like · an international airport’s control room
Many feeds, one big screen.
AWS concept
Familiar thing
Different log formats
≈
Reports from airlines in different languages
OCSF
≈
Translating every report into one shared language
Security Lake
≈
A central archive where all translated reports are filed
Rollup Region
≈
Regional airports send copies to the main hub
Subscriber
≈
A visiting inspector allowed to read only certain folders
OpenSearch dashboards
≈
The live wall of screens in the control room
Real AWS example · one IP across all sources in Security Lake
Athena query on the OCSF CloudTrail table. Table names include the Region and source version.
SELECT time_dt, api.service.name, api.operation,
actor.user.uid, src_endpoint.ip
FROM amazon_security_lake_glue_db_us_east_1
.amazon_security_lake_table_us_east_1_cloud_trail_mgmt_2_0
WHERE src_endpoint.ip = '203.0.113.9'
AND time_dt > TIMESTAMP '2026-10-08 00:00:00'
ORDER BY time_dt;
Run the same src_endpoint.ip filter on the VPC flow and Route 53 tables: OCSF uses the same field names, so the queries look alike.
Exam-style scenario
A company has 30 accounts in 4 Regions and an on-premises firewall. Investigators need one schema to query CloudTrail, VPC Flow Logs, DNS logs and firewall logs together, and a third-party SIEM must receive only CloudTrail data from two Regions. What should they use?
A. CloudTrail Lake with event data stores in each account.
B. Amazon Security Lake with a rollup Region, the firewall as an OCSF custom source, and a subscriber limited to CloudTrail in two Regions.
C. CloudWatch Logs cross-account sharing.
D. Amazon Detective.
Show the worked answer
Answer: B
Security Lake normalizes all sources to OCSF and scopes each subscriber to sources and Regions.
Why not the others
A: Does not cover flow, DNS or firewall logs in one schema, and is closed to new customers.
C: No common schema and no source-level subscriber control.
D: Detective visualizes for investigation; it is not a data lake for a SIEM.
How the exam tests this
“Normalize security logs into one open schema”→ Security Lake (OCSF).
“Combine data from many Regions”→ Rollup Region.
“SIEM may read only some sources”→ Subscriber scoped to sources and Regions.
“Dashboards and near real-time log search”→ OpenSearch Service.
“Bring on-premises firewall logs”→ Custom source in OCSF.
Must remember
Security Lake = OCSF + Parquet in your S3.
Query access (Lake Formation) vs data access (notifications).
A finding is a claim, not a proof. Skill 2.2.3 asks you to validate findings from AWS security services and work out scope (which accounts, identities and resources are involved) and impact (what data, money or availability was affected). Only then do you choose how hard to contain. A false positive treated as a real attack can cause an outage; a real attack treated as noise can cause a breach.
Concept profile
A GuardDuty finding
often confused with A Security Hub finding
?What is it?
A record that GuardDuty detected possibly malicious or unauthorized activity. The finding type tells you the threat purpose, the resource type and the behavior, for example UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS.
⚙How does it work?
Severity runs from 1.0 to 10.0: Low 1.0–3.9, Medium 4.0–6.9, High 7.0–8.9, Critical 9.0–10.0.
Resource shows the affected entity (access key, user type, instance, bucket); Action shows the API or connection and the remote IP.
Count and first/last seen: if Updated at differs from Created at, the activity is repeating and still going on.
GuardDuty keeps findings for 90 days; export them (to S3 or Security Hub) to keep them longer.
Extended Threat Detection raises attack sequence findings that link many signals into one story with MITRE tactics.
{ }Structure
Read, check, scope, measure impact. Then contain.
⇄GuardDuty finding vs A Security Hub finding
GuardDuty finding
Security Hub finding
Produced by
GuardDuty threat detection
Aggregated from GuardDuty, Inspector, Macie, Access Analyzer, CSPM controls
Answers
“Something suspicious happened”
“What matters most across everything?”
Format
GuardDuty format (also sent on as OCSF)
OCSF; CSPM findings in ASFF
Extra context
Actor, IP, API, count
Exposure findings, attack path graph, correlation
Response
EventBridge, suppression rules
Automation rules, tickets, EventBridge
!Common mistakes the exam tests
Containing without checking: a finding from a known vulnerability scanner or pentest may be expected. Ask the resource owner first, but quickly.
Deleting findings you think are false: archive them, or create a suppression rule for that exact pattern. Suppressed findings are not sent to Security Hub CSPM, S3, Detective or EventBridge, and they do not count as signals for attack sequences.
Using a broad suppression rule (for example a whole finding type) that hides real attacks.
Adding a public IP to a trusted IP list without care: GuardDuty does not create findings for those IPs.
Judging impact without data context: use Macie to learn whether the touched bucket really held sensitive data.
✓Benefits and use cases
Decide between “close as benign” and “start the incident runbook”.
List all resources and accounts touched by one stolen key.
Report impact (data types, records, cost) to management and legal.
IAM Access Analyzer and Macie help measure scope
IAM Access Analyzer answers “who could reach this?”. External access findings show buckets, roles, keys and other resources shared outside your account or organization; unused access findings show idle roles, keys and permissions; and policy generation can build a least-privilege policy from CloudTrail activity after the incident. The new AWS Security Hub correlates findings from GuardDuty, Inspector, Macie and CSPM checks into exposure findings with an attack path graph, which helps you see how far an attacker could go. Amazon Macie answers “was the data sensitive?”: run a sensitive data discovery job on the buckets the attacker read to see if they held personal or financial data.
Think of it like · a smoke alarm in an apartment block
What a building manager does when an alarm rings.
AWS concept
Familiar thing
GuardDuty finding
≈
The alarm in flat 4B goes off
Validation
≈
Checking: is it real smoke or just toast?
Suppression rule
≈
Telling the system that the bakery’s oven always sets off sensor 7
Scope
≈
Checking which other flats share the same air vent
Access Analyzer
≈
A list of every door that opens from outside
Macie
≈
Checking whether the burnt room held the important papers
Severity 8 is High. An ASIA key is temporary: the instance role’s credentials are being used outside AWS. Count 14 over two hours means it is ongoing, so revoke the role’s sessions now.
Exam-style scenario
GuardDuty reports Recon:EC2/PortProbeUnprotectedPort on dozens of instances every week. Investigation shows the source is the company’s approved external vulnerability scanner with a fixed IP. The team wants to stop the noise in Security Hub without hiding real attacks. What should it do?
A. Disable GuardDuty in the affected Regions.
B. Create a suppression rule that matches this finding type AND the scanner’s IP address.
C. Create a suppression rule for all Recon findings.
D. Ignore the findings in Security Hub.
Show the worked answer
Answer: B
A narrow suppression rule archives only this known benign pattern, and suppressed findings are not forwarded to Security Hub.
Why not the others
A: Removes all detection.
C: Too broad: real reconnaissance would be hidden.
D: Leaves the noise and trains people to ignore alerts.
How the exam tests this
“Benign, repeating finding from a known source”→ Narrow suppression rule.
“Is the activity still happening?”→ Count, first/last seen, Updated at.
“Which resources are shared outside the org?”→ IAM Access Analyzer external access.
“Did the attacker touch sensitive data?”→ Macie discovery job.
“Linked multi-stage attack across signals”→ GuardDuty attack sequence finding.
Must remember
Severity: Low 1–3.9, Med 4–6.9, High 7–8.9, Critical 9–10.
Stolen credentials are the most common AWS incident. Skill 2.2.4 asks you to contain, eradicate and recover. For credentials the order is: stop the credentials working, then remove anything the attacker created, then give the real owner new, safer credentials. The exam tests one detail again and again: long-term keys and temporary sessions are stopped in different ways.
Concept profile
Revoke active sessions (AWSRevokeOlderSessions)
often confused with Deactivating an access key
?What is it?
An IAM console action on a role that attaches an inline policy named AWSRevokeOlderSessions. The policy denies every action for any session whose credentials were issued before that moment.
⚙How does it work?
The policy is Deny* on * with DateLessThan on aws:TokenIssueTime; the console adds about 30 seconds to allow for propagation.
Everyone using the role must assume it again. New sessions work normally, so fix the role’s trust policy first if the attacker can still assume it.
It affects temporary credentials only. aws:TokenIssueTime is not present for long-term IAM user keys.
You cannot use it on service-linked roles. For IAM Identity Center, revoke the user’s permission set session in Identity Center instead.
Pressing the button again later just refreshes the time in the policy.
{ }Structure
Contain, eradicate, review. Two kinds of credentials, two kinds of stop.
⇄Revoke sessions vs Deactivating an access key
Revoke sessions
Deactivate access key
Works on
Role sessions (temporary, ASIA… keys)
IAM user long-term keys (AKIA…)
Effect
Old sessions denied, new ones allowed
Key stops working at once
Reversible
Remove the inline policy
Set status back to Active
Evidence kept
Yes
Yes (better than deleting)
Exam hint
“instance credentials used outside AWS”
“access key found in a public repo”
!Common mistakes the exam tests
Deleting the role or user first: you lose evidence and may break production. Deactivate and revoke first, delete later.
Revoking sessions for a leaked IAM user key: it does nothing to long-term keys.
Rotating a key without checking CloudTrail for new users, keys, roles, trust policy changes or Lambda functions the attacker created for persistence.
Forgetting STS tokens already issued with GetSessionToken or AssumeRole from the stolen key: also add a deny policy (or revoke) for those sessions.
Ignoring the root cause: a key in a public Git repo, or an SSRF bug that reads instance metadata (use IMDSv2).
✓Benefits and use cases
Leaked access key found on GitHub (AWS may also attach a quarantine policy).
Instance role credentials used from an IP outside AWS.
A departing admin’s live console session must end now.
The full credential runbook
1. Identify the entity from the finding (user type, user name, access key ID) and the API calls. 2. Contain: set the IAM user’s key to Inactive; for a role, revoke active sessions; for a console user, also reset the password and attach a deny-all policy if needed. 3. Eradicate: search CloudTrail for everything that identity did, then delete attacker-created users, keys, roles, EC2 instances and Lambda functions; delete the old key; issue a new one (or better, move the workload to a role). 4. Recover and learn: check the billing for crypto mining, use Access Analyzer’s unused access and Access Advisor to tighten permissions, and add Secrets Manager or roles so long-term keys are not needed. If AWS detects your key in public, it may attach the AWSCompromisedKeyQuarantineV3 managed policy to the user; do not simply remove it, finish the runbook first.
Think of it like · lost office keys and visitor badges
How a company handles a lost key.
AWS concept
Familiar thing
IAM user access key
≈
A permanent metal key to the office
Deactivate the key
≈
Change the lock so that key stops turning, but keep it as evidence
Role session
≈
A visitor badge that works until it expires
Revoke sessions
≈
Security says: every badge printed before 10:00 no longer opens doors
Assume role again
≈
Real visitors go back to reception for a new badge
Persistence check
≈
Looking for spare keys the thief cut while inside
Real AWS example · contain a user key and a role in two commands
Deactivate the key, then add the same deny policy the console button creates.
The instance will get fresh role credentials automatically, so the app keeps working while the stolen copies fail.
Exam-style scenario
GuardDuty raises UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS for credentials of the role attached to a web server. The application must keep running. What is the BEST immediate containment step?
A. Delete the IAM role.
B. Revoke active sessions on the role (AWSRevokeOlderSessions), then investigate how the credentials were stolen, for example SSRF with IMDSv1.
C. Deactivate all IAM user access keys in the account.
D. Stop the instance.
Show the worked answer
Answer: B
Revoking older sessions kills the stolen temporary credentials, while the instance gets new ones and the app keeps working.
Why not the others
A: Breaks the application and destroys evidence.
C: The leaked credentials are role credentials, not user keys.
D: Causes an outage and loses memory evidence; the stolen credentials would still work until they expire.
How the exam tests this
“Access key exposed in a public repository”→ Deactivate the key, then rotate and review CloudTrail.
“Role credentials used from outside AWS”→ Revoke active sessions.
“Deny all sessions issued before a time”→ aws:TokenIssueTime + DateLessThan.
“Revoke does not stop the attacker”→ Stolen long-term key, or attacker can assume the role again.
Containing a compromised EC2 instance and the network
For a compromised instance the goal is to stop the damage but keep the evidence. Do not terminate first. Take it out of service, cut its network, capture its memory and disks, and only then decide whether to analyze or rebuild. The exam’s favorite trap is connection tracking: changing security groups does not end sessions that are already open.
Concept profile
Isolation security group
often confused with Network ACL deny rule
?What is it?
A dedicated security group with no rules that allow 0.0.0.0/0, usually with only access from a forensic workstation IP, that becomes the instance’s only security group during an incident.
⚙How does it work?
Create the Isolation group ahead of time (part of preparation, Day 1).
Attach it and remove all other security groups from the instance.
Tracked connections are not ended by the change; only new traffic is blocked. Existing sessions keep going until they time out.
Flows allowed by a 0.0.0.0/0 rule in both directions are untracked and are cut immediately when that rule is removed; most real sessions are tracked.
To stop existing traffic at once, add a network ACL deny for the attacker’s IPs (or the instance) on the subnet.
{ }Structure
Six steps. Evidence first, network second, decision last.
⇄Isolation SG vs Network ACL deny rule
Isolation SG
NACL deny
Level
Instance (ENI)
Subnet
State
Stateful: tracked connections survive
Stateless: breaks existing connections
Blast radius
Only this instance
Every instance in the subnet
Rule types
Allow only
Allow and deny, numbered
Best use
Isolate one instance cleanly
Block a bad IP now, or cut live sessions
!Common mistakes the exam tests
Thinking the new security group cut the attacker’s live reverse shell: tracked connections survive.
Terminating the instance first: memory, running processes and network connections are lost.
Stopping the instance before a memory capture: RAM is lost on stop.
Leaving the instance in its Auto Scaling group: a failed health check may terminate it, destroying evidence. Use Standby or detach it, and turn on termination protection.
Leaving it behind the load balancer: real users keep reaching a compromised host. Standby deregisters it automatically.
✓Benefits and use cases
Crypto mining or bot activity from one instance.
A web server with a confirmed web shell.
Malware found by GuardDuty Malware Protection for EC2.
Auto Scaling, load balancers and evidence
Putting an instance into Standby deregisters it from attached target groups (after connection draining) and stops Auto Scaling health checks on it. If you do not decrement desired capacity, Auto Scaling launches a clean replacement, so the service stays up. You can also detach the instance from the group, or suspend the health check and replace processes. Then capture volatile data first (memory, process list, network connections) with a tool run through Systems Manager, take EBS snapshots of every volume, tag everything with the case ID, and copy the snapshots to the forensic account (share with a KMS key the forensic account can use). This is the work the Day 2 automated forensics tools do for you.
Think of it like · a sick passenger on a cruise ship
Keep others safe, keep the facts.
AWS concept
Familiar thing
Termination protection
≈
Nobody may throw the passenger overboard
ASG Standby
≈
Take the cook off the kitchen rota; a replacement cook starts
Isolation SG
≈
Lock the cabin door so no new visitors come in
Tracked connections
≈
People already inside the cabin are still talking to the patient
NACL deny
≈
Close the whole corridor so even people already inside are cut off
Memory capture first
≈
Ask the patient questions before they fall asleep
Real AWS example · contain one instance from the CLI
Order matters: protect, remove from service, isolate, snapshot.
--groups replaces all security groups on the primary interface with the isolation group.
Add a matching egress NACL deny too: NACLs are stateless.
Exam-style scenario
A security engineer replaces all security groups on a compromised EC2 instance with an isolation security group that has no rules. Network monitoring shows the attacker’s existing SSH session to the instance is still active. What should the engineer do to stop this traffic immediately while keeping the instance running for forensics?
A. Wait; the security group change takes up to 24 hours.
B. Add network ACL deny rules for the attacker’s IP (inbound and outbound) on the instance’s subnet.
C. Detach the instance’s IAM role.
D. Stop the instance.
Show the worked answer
Answer: B
Security groups do not end tracked connections; a stateless NACL deny breaks existing connections at once.
Why not the others
A: The change is fast; the session survives because it is tracked.
C: Does not affect network sessions.
D: Loses memory evidence.
How the exam tests this
“Isolate one instance”→ Isolation security group, remove others.
“Existing sessions survive the SG change”→ Tracked connections: add a NACL deny.
“Keep the instance from being terminated by Auto Scaling”→ Standby or detach + termination protection.
“Stop users reaching the bad host”→ Deregister from the target group.
“Preserve disk evidence”→ EBS snapshots, copied to a forensic account.
The same contain, eradicate, recover pattern applies to every resource type, but the buttons are different. For S3 you close access; for Lambda you stop invocations; for containers you isolate the pod or task and the node. Then you recover: restore clean data from backups and rebuild compute from known-good images instead of trying to clean a hacked server.
Concept profile
Rebuild from a golden AMI
often confused with Cleaning the instance in place
?What is it?
Replacing a compromised server with a new one launched from a hardened, patched, scanned image (a golden AMI, often built by EC2 Image Builder), with data restored from a backup taken before the compromise.
⚙How does it work?
Keep the old instance or its snapshots for forensics; do not reuse them for production.
Fix the root cause in the image or code first (patch, close the port, remove the bad dependency).
Launch replacements from the golden AMI through the launch template and Auto Scaling group.
Restore data with AWS Backup or snapshots to a new resource, and check it before switching traffic.
Rotate every secret the old server could read.
{ }Structure
Different resources, same three phases.
⇄Rebuild vs Cleaning the instance in place
Rebuild
Clean in place
Confidence attacker is gone
High
Low: hidden backdoors may remain
Evidence
Old host kept intact
Changed by the cleanup
Speed
Fast if images are automated
Slow, manual
Needs
Golden AMI, IaC, backups
Admin access to the hacked host
Exam hint
“ensure the threat is removed”
Rarely correct
!Common mistakes the exam tests
Restoring the latest backup when the attacker was already inside then: pick a recovery point from before the compromise.
Restoring over the original resource and destroying evidence: restore to a new resource.
Backups in the same account the attacker controls: use AWS Backup Vault Lock or a logically air-gapped vault and cross-account copies.
Making a bucket public again while “fixing” access: keep Block Public Access on.
Throttling a Lambda function but leaving its role’s credentials usable: also revoke the role’s sessions.
✓Benefits and use cases
Ransomware or a wiper attack on EC2 or EBS.
Web server with an unknown backdoor.
Corrupted or encrypted S3 objects (restore earlier versions).
S3, Lambda and containers
S3: turn on Block Public Access (account and bucket level), add a bucket policy that denies the compromised principal or allows only your VPC endpoint, revoke the principal’s credentials, then use versioning to restore overwritten or deleted objects (Object Lock prevents deletion if it was set up earlier). Use CloudTrail data events or server access logs to see which objects were read, and Macie to judge sensitivity. Lambda: set reserved concurrency to 0 to stop every invocation, remove or narrow triggers, revoke the execution role’s sessions, rotate secrets in its environment, and redeploy a known-good version or alias. Containers: on EKS, isolate the pod with a deny-all network policy, label it for forensics, cordon the node so nothing new is scheduled there, and revoke the pod or node role credentials; on ECS, attach an isolation security group to the task’s ENI. GuardDuty Runtime Monitoring and EKS Protection give the findings; Inspector scans the rebuilt image.
Think of it like · a flooded house
What you do after a pipe bursts.
AWS concept
Familiar thing
Block Public Access
≈
Close the front door so passers-by stop walking in
Lambda concurrency 0
≈
Turn off the water at the main valve
Cordon the node
≈
Put tape across the flooded room so nobody new goes in
AWS Backup restore
≈
Bring furniture back from the storage unit, from before the flood
Vault Lock
≈
A storage unit even the house owner can’t empty early
Golden AMI rebuild
≈
Replace the soaked walls with new boards instead of drying them
Real AWS example · contain S3 and Lambda, then restore
Choose a recovery point from before the first malicious event you found in the logs.
Exam-style scenario
Ransomware encrypted the data volumes of several EC2 instances. The company uses AWS Backup with daily backups copied to a locked vault in another account. The first malicious activity in CloudTrail was 3 days ago. What is the best recovery plan?
A. Restore yesterday’s backups over the existing volumes.
B. Keep the encrypted instances for forensics, rebuild instances from a patched golden AMI, and restore volumes from a recovery point older than 3 days to new resources.
C. Pay the ransom.
D. Run antivirus on the encrypted instances and reuse them.
Show the worked answer
Answer: B
Rebuild from clean images, restore pre-compromise data to new resources, and keep the evidence.
Why not the others
A: Yesterday’s backup may already include the attacker’s changes, and overwriting destroys evidence.
C: Never the exam answer.
D: Cleaning in place leaves possible backdoors.
How the exam tests this
“Stop a Lambda function now”→ Reserved concurrency 0.
“Bucket made public by attacker”→ Block Public Access + deny policy.
“Recover deleted or overwritten objects”→ S3 versioning.
After the fire is out, you must know how it started so it does not happen again. Skill 2.2.5 asks you to describe methods for root cause analysis, and it names Amazon Detective. Root cause means the first weakness: a leaked key, an unpatched app, an open security group, a too-wide trust policy. You find it by building a timeline backwards from the first finding.
Concept profile
Amazon Detective behavior graph
often confused with Amazon GuardDuty
?What is it?
A managed investigation service. It builds a behavior graph, a linked set of data about accounts, roles, users, IP addresses, instances and their interactions over time, and shows it as visual profiles and timelines.
⚙How does it work?
Core source packages: CloudTrail logs, VPC Flow Logs, GuardDuty findings. Optional: EKS audit logs and Security Hub CSPM findings. It can also search raw logs in Security Lake.
Keeps up to 1 year of history for visualizations, so you can compare normal and unusual activity.
Finding groups join related findings and entities (same role session, same IP, close in time, similar tactics); a group is built within 48 hours.
Investigations check an IAM user or role for indicators of compromise using machine learning and threat intelligence.
One administrator account per Region, with member accounts or AWS Organizations; 30-day free trial the first time.
{ }Structure
Logs and findings in, a linked graph and timelines out.
⇄Detective vs Amazon GuardDuty
Detective
GuardDuty
Job
Investigate and explain
Detect
Output
Graphs, profiles, finding groups
Findings
Needs GuardDuty?
Uses GuardDuty findings (and is best with it)
No
History
Up to 1 year of activity
Findings kept 90 days
Exam hint
“root cause”, “visualize”, “related activity”
“detect”, “threat”, “alert”
!Common mistakes the exam tests
Choosing Detective to detect threats or to block anything: it neither detects nor responds; it helps you investigate.
Choosing GuardDuty for “visualize the related activity and find the root cause”: that is Detective.
Expecting Detective to show data from before it was enabled: the graph starts collecting when you turn it on (plus whatever it can read from Security Lake).
Thinking Detective needs you to build log pipelines: it pulls CloudTrail and flow data itself.
Forgetting the human steps of root cause analysis: a timeline, the “5 whys”, and fixes added to runbooks and preventive controls.
✓Benefits and use cases
Explain a High GuardDuty finding: which role, from where, what else it did.
See every account and resource one malicious IP touched.
Prepare a post-incident report with a clear timeline.
Integrations and the timeline method
From a GuardDuty finding or a Security Hub finding, choose Investigate in Detective to open the right entity profile with the time window already set. In the profile, look at new behavior: first-time API calls, new geolocations, new user agents, unusual data volume. Then build the timeline: initial access (for example the first call from a new IP with the leaked key) → persistence (new user or key) → actions on objectives (data read, instances launched). The earliest step tells you the root cause. Finish with lessons learned: fix the weakness, add a detection, update the runbook and test it (Day 1).
Think of it like · a detective’s wall of photos and string
Joining clues into a story.
AWS concept
Familiar thing
Behavior graph
≈
The wall with photos of people, places and cars, joined by string
Finding group
≈
A cluster of clues that all point to the same suspect
Entity profile
≈
The suspect’s file with their normal routine
New behavior
≈
The suspect visited a town they have never been to
Timeline
≈
Putting the events in order to find the first break-in
GuardDuty
≈
The burglar alarm that called the detective
Real AWS example · start a Detective investigation on a role
Ask Detective to check one role for indicators of compromise over two days.
Then open the role’s profile in the console to see the indicators: new geolocations, unusual API calls and related findings.
Exam-style scenario
A company has GuardDuty in all accounts. After a High finding on an IAM role, the security lead wants to see all related findings and entities, how the role behaved compared with normal over the past months, and where the activity started, with the least setup. What should the team use?
A. Write Athena queries joining CloudTrail and VPC Flow Logs.
B. Amazon Detective: open the finding group and the role’s profile from the GuardDuty finding.
C. AWS Config timeline.
D. Amazon Inspector.
Show the worked answer
Answer: B
Detective already links GuardDuty findings, CloudTrail and flow data into finding groups and profiles with history.
Why not the others
A: Possible but needs much more effort and gives no baseline.
C: Config tracks resource configuration changes, not API behavior of a role.
D: Inspector finds vulnerabilities; it does not investigate activity.
How the exam tests this
“Visualize related activity, find root cause”→ Amazon Detective.
“Group related findings into one event”→ Detective finding groups.
“Compare behavior with the normal baseline”→ Detective entity profiles.
“Pivot from a finding to investigation”→ Investigate in Detective from GuardDuty / Security Hub.
Cheatsheet extras: account-compromise checklist and KMS key emergencies
Two cheat-sheet lists are worth knowing by heart: what to do when the whole account may be compromised, and what to do with a KMS key during an incident. One old list needs updating too.
Older material says “EC2 hacked: stop the instance immediately, snapshot, terminate”. Today’s AWS guidance is different: don’t stop or terminate first. Isolate it (isolation security group, detach from the ASG, deregister from the load balancer), turn on termination protection, capture memory while it runs, snapshot the volumes, then investigate copies in the forensics account. Stopping throws away memory evidence.
The account-compromise checklist
When AWS Support or Trust & Safety says your account may be compromised, AWS’s own checklist is: change the root user password and turn on MFA for root and console users; rotate and delete all root and IAM access keys; delete IAM users (and roles) you didn’t create and change the passwords of the others; check your bill and every Region for resources you didn’t create (EC2 instances, Spot requests, Lambda functions, snapshots, AMIs, S3 buckets) and delete them after you have kept evidence; check your account contact details; and reply to the notice in the Support Center. With an organization, also check for new accounts or SCP changes the attacker made.
Concept profile
Disabling a KMS key
often confused with Scheduling key deletion
?What is it?
DisableKey stops a KMS key from being used in any cryptographic operation at once. It is reversible with EnableKey. Deletion (ScheduleKeyDeletion) is permanent after a waiting period.
⚙How does it work?
Disable: key state Disabled; Encrypt, Decrypt and GenerateDataKey fail. Use it to cut off a key you think is being misused, or to test what depends on a key.
Schedule deletion: waiting period 7 to 30 days (default 30). State PendingDeletion: the key can’t be used. CancelKeyDeletion brings it back as Disabled (enable it again yourself).
After deletion, every ciphertext under that key is lost for ever.
Imported key material: DeleteImportedKeyMaterial makes the key unusable immediately, with no waiting period; it works again only if you re-import the same material.
Detect: an EventBridge rule (or CloudTrail metric filter) on DisableKey and ScheduleKeyDeletion; KMS also warns when a key pending deletion is used.
{ }Structure
Disable is the brake; deletion is the scrapyard with a 7–30 day grace period.
⇄Disable key vs Schedule key deletion
DisableKey
ScheduleKeyDeletion
Takes effect
Immediately
Key unusable now; deleted after 7–30 days
Reversible?
Yes, EnableKey any time
Only during the waiting period (CancelKeyDeletion)
Data
Safe, readable again after enable
Lost for ever once deleted
Incident use
Contain misuse of a key
Rarely; crypto-shredding when data must be destroyed
After cancelling, the state is Disabled; enable-key makes it usable again. An SCP that denies kms:ScheduleKeyDeletion to everyone except a break-glass role prevents a repeat.
Exam-style scenario
CloudTrail shows that a compromised administrator role called ScheduleKeyDeletion on the customer managed key that encrypts the company’s production RDS database, with a 7-day waiting period, two days ago. The database now fails to read data. What should the security engineer do first to restore service with the least data loss?
A. Restore the database from a snapshot encrypted with a new key.
B. Call CancelKeyDeletion, then EnableKey, and revoke the compromised role’s sessions.
C. Create a new key with the same key ID.
D. Ask AWS Support to recover the key after it is deleted.
Show the worked answer
Answer: B
The key is still in its waiting period, so it can be recovered. Cancelling leaves it disabled; enabling it restores service. Then contain the role.
Why not the others
A: Snapshots are encrypted with the same key, and you would lose recent data.
C: Key IDs and key material can’t be recreated.
D: After deletion, no one, including AWS, can recover the key.
How the exam tests this
“AWS says the account may be compromised”→ Root password + MFA, rotate/delete keys, remove unknown users and resources, check the bill, reply.
“Stop a KMS key being used, may need it later”→ DisableKey.
“Key was scheduled for deletion by mistake or by an attacker”→ CancelKeyDeletion (then EnableKey).
“Make data unreadable immediately”→ DeleteImportedKeyMaterial (imported material only).
“EC2 hacked: what first?”→ Isolate and capture, not stop or terminate.
Check the basics first. Pick an answer, then press Check.
12
Hard quiz
Harder than most real exam questions on purpose, with one “choose two” and one matching question. Aim for 9 out of 12.
13
Domain 2 review quiz (Days 1–3)
Questions from every Incident Response day. If you miss one, reopen that day’s lecture and its “Must remember” boxes.
14
Practice test questions (from your mock exams)
8 questions taken from your own SCS-003 mock exams and matched to today’s topics. Each answer was checked against current AWS behaviour; where a mock’s answer was outdated or wrong, the explanation says so. The source is shown at the end of each explanation.
15
Hands-on lab (30 minutes, low cost)
In the CloudTrail console, choose Create Athena table for your trail’s bucket. Run a query that lists your own eventname and sourceipaddress for today (filter on the date to keep the scan tiny).
In GuardDuty, choose Generate sample findings. Open a sample UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS finding and note the severity, Count, resource and remote IP. Then create a suppression rule for one sample type and see it move to Archived.
Create a test IAM user with an access key. Deactivate the key with update-access-key --status Inactive and confirm a call with it fails. Create a test role, assume it, then press Revoke active sessions and confirm the old session gets AccessDenied while a fresh assume works.
Launch a t3.micro (Free Tier eligible) and SSH in. Replace its security group with an empty isolation group and notice the SSH session stays up; then add a NACL deny for your IP and watch it drop. Take an EBS snapshot with a Case tag.
Optional: enable Amazon Detective (30-day free trial in a Region) and open a sample finding with Investigate in Detective. Real data appears only after it has collected some activity.
Clean up: terminate the instance, delete the snapshot, the NACL entry and isolation group, the test user, key and role, the suppression rule and archived samples. Disable Detective before the trial ends, and drop the Athena table (the query results bucket keeps costing a little).