GuardDuty Finding Automator
Mindset
One-line takeaway: every GuardDuty automation workflow is a five-stage
pipeline — detect (GuardDuty finding) → route (EventBridge severity
filter) → respond (Lambda remediation) → notify (SNS with finding
context) → correlate (Security Hub + CloudTrail TTP chaining). A gap
in ANY stage produces a silent failure: the finding fires but nothing is
contained, or containment fires on a false positive and takes down a
production service.
- Detection without automated routing is noise — alert fatigue
sets in within weeks of enablement.
- Severity-based auto-response is the core design decision:
Critical/High findings trigger automatic containment, Medium notifies
the security team, Low findings are logged for trend analysis.
- Finding ID deduplication is non-negotiable. GuardDuty updates the
same finding ID when new evidence arrives. Without dedup, the Lambda
re-isolates the same instance on every update.
- TTP correlation across findings reveals the attack chain. A Recon
finding followed by UnauthorizedAccess followed by Exfiltration is a
kill-chain, not three isolated events. Security Hub is the correlation
layer.
Quick navigation
| You want to... |
Go to |
| Route findings by severity via EventBridge |
Step 2 + Appendix A |
| Pick the right Lambda remediation action |
Step 3 (action matrix) |
| Wire EC2 isolation (SG swap) |
Step 4 |
| Revoke IAM credentials safely |
Step 5 |
| Block source IPs in WAF |
Step 6 |
| Send SNS notifications with finding context |
Step 7 |
| Ingest as Security Hub custom finding |
Step 8 |
| Set up multi-account via Organizations |
Step 9 |
| Suppress known false positives |
Step 10 |
| Correlate TTPs across findings via CloudTrail |
Step 11 |
| Auto-enable GuardDuty in new accounts |
Step 12 |
| Upload custom threat intel |
Step 13 |
| Avoid common automation pitfalls |
Anti-Patterns |
Critical rules at a glance (do NOT bury these)
EventBridge fires on finding occurrence AND finding update.
GuardDuty emits an event when a finding is first created AND on every
subsequent update. The Lambda MUST deduplicate on finding ID.
EC2 isolation via security group swap is the safest containment.
Replacing SGs with an isolation SG (no ingress, restricted egress) is
reversible. Terminating destroys forensic evidence. Stopping may
trigger auto-scaling replacement.
IAM key revocation must check AccessKeyLastUsed first for Medium
severity. Revoking an active application key causes an outage. For
Critical findings (CryptoCurrency, Backdoor), revoke regardless.
create-filter with FindingCriteria suppresses silently. An
over-broad filter hides real threats. Always scope to specific
resource or IP and set an expiry review date.
Security Hub BatchImportFindings requires the ASFF format.
Schema mismatches produce silent drops — Security Hub does not error
on malformed findings.
Pre-flight: data requirements
Pre-flight data-gathering commands (findings statistics, sample JSON, rule status, filters, WAF ACLs, SNS topics) moved verbatim to references/diagnostic-commands.md.
Load on demand to populate the required inputs before designing automation.
If the input is malformed (missing finding type, ambiguous severity),
emit:
AUTOMATION: <reference>
FINDING_TYPE: <type or UNKNOWN>
VERDICT: ERROR
REASON: Cannot design automation — finding type and desired remediation action are required.
GAP: Re-supply get-findings output for the finding type and the severity-routing requirement.
Process — Workflow design (apply in order)
Step 0: Expert knowledge — non-obvious GuardDuty + EventBridge behaviors
Eight non-obvious behaviors (severity serialization, finding-ID stability, archive semantics, Security Hub dups, WAF IP-set limits, Region-specific admin, Lambda timeouts, cross-account bus) moved verbatim to references/advanced-patterns.md.
Load on demand before finalizing rule or Lambda design.
Step 1: Classify the finding family and severity tier
| Finding family |
Example types |
Default severity |
Response tier |
UnauthorizedAccess:EC2 |
SSHBruteForce, RDPBruteForce |
Medium-High |
High → isolate; Medium → notify |
Backdoor:EC2 |
BackdoorAtTask, DriveThroughSource |
High-Critical |
Auto-isolate |
CryptoCurrency:EC2 |
CryptoDomain, BitcoinTool |
High-Critical |
Auto-isolate + snapshot |
Recon:EC2 |
PortProbe, PortProbeUnprotectedPort |
Low-Medium |
Log + trend |
Persistence:IAMUser |
IAMUserBackdoor, NewUserCreation |
High |
Auto-revoke if credential-based |
Exfiltration |
S3, EC2 outbound anomalies |
High-Critical |
Auto-isolate + snapshot |
Trojan:EC2 |
Trojan, DrivingLicense domain |
High |
Auto-isolate + Malware Protection |
Policy:IAMUser |
RootAccess, AssumeRole anomaly |
Medium-High |
Notify + CloudTrail correlate |
Severity routing matrix (the core design):
| Severity |
Auto-action |
Notification |
Security Hub |
| Critical (9.0-10.0) |
Isolate EC2, revoke IAM keys, WAF block, snapshot |
SNS + Page on-call |
Custom finding + correlation |
| High (7.0-8.9) |
Isolate EC2, revoke IAM keys (conditional) |
SNS + Email security |
Custom finding |
| Medium (4.0-6.9) |
No auto-action |
SNS email |
Forwarded (native) |
| Low (0.1-3.9) |
No action |
Log only (CloudWatch) |
Forwarded (native) |
Step 2: Wire the EventBridge rule for severity-based routing
aws events put-rule \
--name guardduty-critical-high-routing \
--event-pattern '{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"],
"detail": {
"severity": [{"numeric": [">=", 7.0]}]
}
}'
aws events put-targets \
--rule guardduty-critical-high-routing \
--targets '[{
"Id": "guardduty-remediation-lambda",
"Arn": "arn:aws:lambda:us-east-1:111111111111:function:guardduty-auto-remediation",
"DeadLetterConfig": {"Arn": "arn:aws:sqs:us-east-1:111111111111:guardduty-remediation-dlq"}
}]'
IMPORTANT: test the numeric severity match. If it fails (string
serialization), route all findings to Lambda and branch internally:
severity = float(event['detail']['finding']['severity'])
if severity >= 7.0: # Critical/High — auto-respond
elif severity >= 4.0: # Medium — notify only
else: # Low — log only
Step 3: Map finding type to remediation action (the action matrix)
| Finding type |
Action |
Lambda |
Reversible |
UnauthorizedAccess:EC2/SSHBruteForce |
Isolate EC2 (SG swap) |
gd-isolate-ec2 |
Yes |
UnauthorizedAccess:EC2/RDPBruteForce |
Isolate EC2 + WAF block |
gd-isolate-ec2 + gd-waf-block-ip |
Yes |
Backdoor:EC2/* |
Isolate + snapshot |
gd-isolate-ec2 + gd-snapshot-ebs |
Partial |
CryptoCurrency:EC2/* |
Isolate immediately + snapshot |
gd-isolate-ec2 + gd-snapshot-ebs |
Partial |
Persistence:IAMUser/* |
Revoke IAM access keys |
gd-revoke-iam-keys |
Yes |
Exfiltration:* |
Isolate/revoke + snapshot |
Combination |
Partial |
Trojan:EC2/* |
Isolate + Malware Protection scan |
gd-isolate-ec2 + gd-malware-scan |
Yes |
Recon:* |
No auto-action — log + correlate |
N/A |
N/A |
For the full parameter-level mapping, see
references/finding-types-and-remediation-actions.md.
Step 4: EC2 isolation via security group swap
ec2 = boto3.client('ec2')
ISOLATION_SG = 'sg-isolation-forensics'
def isolate_instance(instance_id, original_sgs):
"""Swap instance SGs to isolation SG. Store originals for rollback."""
eni = get_eni(instance_id)
ec2.modify_network_interface_attribute(NetworkInterfaceId=eni, Groups=[ISOLATION_SG])
store_in_dynamodb(instance_id, original_sgs) # For rollback
Isolation SG (CloudFormation):
IsolationSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: GuardDuty isolation SG — no ingress, restricted egress
SecurityGroupIngress: []
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 10.0.0.0/8 # Forensics VPC endpoint only
Rollback: store original SGs in DynamoDB. Always include a rollback
Lambda — an isolated production instance is an outage until released.
Step 5: IAM credential revocation
iam = boto3.client('iam')
def revoke_access_key(user_name, access_key_id, finding_type):
last_used = iam.get_access_key_last_used(AccessKeyId=access_key_id)
last_used_time = last_used['AccessKeyLastUsed'].get('LastUsedDate')
if finding_type.startswith(('CryptoCurrency', 'Backdoor')):
iam.update_access_key(UserName=user_name, AccessKeyId=access_key_id, Status='Inactive')
return {'action': 'revoked', 'reason': 'critical_finding'}
elif last_used_time and (now - last_used_time).seconds < 3600:
notify_sns(f'Key active in last hour — manual review required for {user_name}')
return {'action': 'notified', 'reason': 'key_in_use'}
else:
iam.update_access_key(UserName=user_name, AccessKeyId=access_key_id, Status='Inactive')
return {'action': 'revoked', 'reason': 'key_inactive'}
Step 6: WAF / NACL IP blocking
boto3 WAF update_ip_set snippet and IP-set limit management moved verbatim to references/finding-types-and-remediation-actions.md.
Load on demand when blocking source IPs.
Step 7: SNS notification with finding context
sns = boto3.client('sns')
def notify_finding(finding, topic_arn, page_on_call=False):
subject = f"[GuardDuty {finding['severity']}] {finding['type']}"
message = json.dumps({
'FindingId': finding['id'], 'Type': finding['type'],
'Severity': finding['severity'], 'Resource': finding['resource']['resourceType'],
'Action': finding.get('remediation_action', 'N/A'),
'Count': finding['service']['eventCount']
}, indent=2)
sns.publish(TopicArn=topic_arn, Subject=subject, Message=message,
MessageAttributes={'page': {'DataType': 'String',
'StringValue': 'true' if page_on_call else 'false'}})
Step 8: Security Hub integration via BatchImportFindings
GuardDuty natively forwards to Security Hub. For custom enrichment (TTP
annotation, blast-radius, correlation), create a custom finding:
securityhub = boto3.client('securityhub')
def ingest_custom_finding(gd_finding, correlation_note=None):
custom_finding = {
'SchemaVersion': '2018-10-08',
'Id': f"gd-custom-{gd_finding['id']}",
'ProductArn': f'arn:aws:securityhub:us-east-1:111111111111:product/111111111111/default',
'GeneratorId': 'guardduty-auto-remediation',
'AwsAccountId': gd_finding['accountId'],
'Types': ['TTPs/' + gd_finding['type'].split('/')[0]],
'FirstObservedAt': gd_finding['service']['eventFirstSeen'],
'LastObservedAt': gd_finding['service']['eventLastSeen'],
'CreatedAt': now, 'UpdatedAt': now,
'Severity': {'Label': severity_label(gd_finding['severity'])},
'Title': f"GuardDuty Enriched: {gd_finding['type']}",
'Description': gd_finding['description'],
'ProductFields': {'Correlation': correlation_note or 'standalone'}
}
securityhub.batch_import_findings(Findings=[custom_finding])
Step 9: Multi-account via Organizations delegated administrator
Delegated-admin enablement, auto-enable, and cross-account forwarding rules moved verbatim to references/eventbridge-and-lambda-patterns.md.
Load on demand for multi-account rollout.
Step 10: Suppression filters for known false positives
create-filter command, false-positive criteria table, and review-date rule moved verbatim to references/finding-types-and-remediation-actions.md.
Load on demand when suppressing known false positives.
Step 11: CloudTrail correlation for TTPs
MITRE chain table and correlate_ttps() DynamoDB query moved verbatim to references/advanced-patterns.md.
Load on demand when correlating findings into attack chains.
Step 12: Auto-enable GuardDuty in new accounts
CreateAccount EventBridge rule pattern and Lambda responsibilities moved verbatim to references/eventbridge-and-lambda-patterns.md.
Load on demand for new-account auto-enablement.
Step 13: Custom threat intel upload
create-threat-intel-set / create-ip-set commands and activation check moved verbatim to references/finding-types-and-remediation-actions.md.
Load on demand for custom threat intel.
Output format
AUTOMATION: <reference>
FINDING_TYPE: <GuardDuty finding type>
SEVERITY: <numeric> (<label>)
ROUTING:
- EventBridge rule: <rule-name>
- Filter: severity >= <threshold>
- Target: Lambda <function-name> with DLQ
REMEDIATION:
- Action: <isolate EC2 | revoke IAM keys | WAF block | snapshot | notify only>
- Lambda: <function name + ARN>
- Rollback: <how to reverse the action>
NOTIFICATION:
- SNS topic: <arn>
- Content: finding context (type, severity, resource, action taken)
- Paging: <on-call for Critical | email for Medium | none for Low>
INTEGRATION:
- Security Hub: <native forwarding | custom enriched finding>
- CloudTrail correlation: <enabled | disabled>
SAFETY:
- Finding ID deduplication: <DynamoDB | Step Functions | none>
- False-positive suppression: <filter name + criteria>
- Rate limiting: <Lambda concurrency cap>
AUDIT:
- CloudTrail: ec2:ModifyNetworkInterfaceAttribute, iam:UpdateAccessKey
- CloudWatch: Lambda invocation logs + errors
VERDICT: AUTOMATION_DEPLOYED | REVIEW_REQUIRED
GAP: <if REVIEW_REQUIRED, the specific missing piece>
TEMPLATE: <CLI snippet or YAML for the pipeline>
Worked example — AUTOMATION_DEPLOYED, EC2 SSH brute force
AUTOMATION_DEPLOYED: prod-guardduty-auto-response
FINDING_TYPE: UnauthorizedAccess:EC2/SSHBruteForce
SEVERITY: 7.5 (HIGH)
ROUTING:
- EventBridge rule: guardduty-critical-high-routing
- Filter: severity >= 7.0
- Target: Lambda guardduty-auto-remediation (DLQ: guardduty-remediation-dlq)
REMEDIATION:
- Action: isolate EC2 via SG swap to sg-isolation-forensics
- Lambda: guardduty-auto-remediation
- Rollback: restore original SGs from DynamoDB (key: instance-id)
NOTIFICATION:
- SNS topic: arn:aws:sns:us-east-1:111111111111:guardduty-alerts
- Content: finding type, severity, instance ID, action taken, rollback
- Paging: on-call (Critical/High only)
INTEGRATION:
- Security Hub: custom enriched finding (TTP: Initial Access)
- CloudTrail correlation: enabled (60-min window)
SAFETY:
- Finding ID deduplication: DynamoDB table guardduty-processed-findings
- False-positive suppression: suppress-authorized-scanner (CI/CD NAT)
- Rate limiting: Lambda concurrency cap = 10
AUDIT:
- CloudTrail: ec2:ModifyNetworkInterfaceAttribute, lambda:InvokeFunction
- CloudWatch: /aws/lambda/guardduty-auto-remediation
VERDICT: AUTOMATION_DEPLOYED
GAP: None
TEMPLATE:
aws events put-rule --name guardduty-critical-high-routing --event-pattern '{"source":["aws.guardduty"],"detail-type":["GuardDuty Finding"],"detail":{"severity":[{"numeric":[">=",7.0]}]}}'
Worked example — REVIEW_REQUIRED, low-severity recon
Secondary worked example (REVIEW_REQUIRED, low-severity recon) moved verbatim to references/worked-examples.md.
Load on demand when formatting a REVIEW_REQUIRED response; the primary AUTOMATION_DEPLOYED example stays in this file.
Anti-Patterns — NEVER do these things
NEVER auto-isolate EC2 without a rollback path. The SG swap is
reversible ONLY if original SGs are stored in DynamoDB. Without
persistence, the instance is permanently quarantined — an outage.
NEVER revoke an IAM key without checking AccessKeyLastUsed for
Medium severity. The key may be the application's active credential.
For Critical (CryptoCurrency, Backdoor), revoke unconditionally.
NEVER set Lambda timeout to the default 3 seconds. EC2 SG swap, IAM
API calls, and WAF updates take 5-30 seconds. Set timeout >= 60s.
NEVER skip finding ID deduplication. GuardDuty updates the same ID as
evidence arrives. Without dedup, the Lambda re-remediates N times.
NEVER rely solely on EventBridge numeric severity matching. The field
serialization is inconsistent. Route to Lambda and filter internally.
NEVER suppress findings without an expiry review. An "authorized
scanner" that is later compromised silently hides threats.
NEVER block IPs in WAF without an eviction policy. WAF sets cap at
10,000 entries. Use rotating sets or NACL-based blocking.
NEVER configure multi-account without cross-account EventBridge
forwarding. The delegated admin does not auto-receive member findings.
NEVER assume BatchImportFindings validates schema. Malformed ASFF
findings are silently dropped. Test with the ASFF validator first.
NEVER terminate an EC2 instance as auto-remediation. Termination
destroys forensic evidence. Use isolation (SG swap) + EBS snapshot.
NEVER set Lambda concurrency to unbounded for remediation. A burst of
findings triggers hundreds of concurrent invocations, exhausting API
throttling. Set reserved concurrency (10-20) and use SQS as buffer.
NEVER deploy GuardDuty automation to a single Region. Deploy via
StackSets to every Region where GuardDuty is enabled.
NEVER confuse archive-findings with deletion. Archived findings
remain queryable for 90 days. There is no delete API.
NEVER skip CloudTrail correlation for Medium findings. A single Recon
at severity 2.0 is noise. The same finding followed by Credential
Abuse at severity 8.0 within 60 min is a kill-chain.
Pre-flight safety checks
MANDATORY CONFIRMATION GATE. Before any state-changing operation:
CONFIRM: About to <action> for finding type <type> in account <account>. Proceed? (yes/no)
Test the remediation Lambda against a non-production instance.
Use guardduty create-sample-findings to generate test findings.
Verify the isolation SG exists in every VPC. An SG from VPC-A
cannot apply to an instance in VPC-B.
Verify SNS topic subscription is confirmed. Unconfirmed email
subscriptions silently drop notifications. Use Lambda/HTTPS for
critical alerts.
For multi-account, verify delegated admin in every target Region
before deploying the StackSet.
Appendix A — EventBridge rule patterns
| Pattern |
Use case |
| All findings |
"source":["aws.guardduty"],"detail-type":["GuardDuty Finding"] |
| Critical/High only |
Add "detail":{"severity":[{"numeric":[">=",7.0]}]} |
| Medium only |
Add "detail":{"severity":[{"numeric":[">=",4.0,"<",7.0]}]} |
| Specific type |
Add "detail":{"type":["UnauthorizedAccess:EC2/SSHBruteForce"]} |
| Specific resource |
Add "detail":{"resource":{"resourceType":["Instance"]}} |
Appendix B — Lambda remediation decision tree
Severity >= 7.0?
├─ Yes → Resource is EC2?
│ ├─ Yes → Isolate via SG swap + snapshot for forensics
│ └─ No → IAM user? → Revoke keys (Critical: unconditional; High: check last-used)
├─ Medium → Notify via SNS + Security Hub custom finding
└─ Low → Log to CloudWatch + background CloudTrail correlation
Recent AWS features (2024-2026)
2024-2026 feature notes (Runtime Monitoring, Malware Protection for EBS, EKS Protection, Security Hub custom actions, global endpoints, auto-enable enhancements) moved verbatim to references/advanced-patterns.md.
Load on demand when a request mentions recent detections.
Expert heuristic: severity-based auto-response blast radius
Blast-radius scoping table, 3-phase validation, dedup snippet, and post-deploy alarms moved verbatim to references/advanced-patterns.md.
Load on demand before enabling containment.
References (load on demand)
- references/finding-types-and-remediation-actions.md — finding-type to action matrix, WAF IP blocking, suppression filters, threat intel sets
- references/eventbridge-and-lambda-patterns.md — event structure, rule patterns, Lambda templates, multi-account forwarding
- references/worked-examples.md — secondary worked example (REVIEW_REQUIRED, low-severity recon)
- references/diagnostic-commands.md — pre-flight data-gathering commands
- references/advanced-patterns.md — Step-0 expert behaviors, TTP correlation, blast-radius validation, 2024-2026 features
Domain
AWS CloudOps / Security Automation — GuardDuty-driven detection and response.
AWS documentation
1---2name: guardduty-finding-automator3description: Designs and implements automated response workflows for Amazon GuardDuty findings. Wires EventBridge rules to severity-based routing (Critical/High auto-isolate, Medium notify, Low log), Lambda remediation functions (isolate EC2 via security group swap, revoke IAM access keys, block source IPs in WAF, update security groups), SNS notifications with full finding context, Security Hub integration via BatchImportFindings, and multi-account coverage through Organizations delegated administrator. Covers suppression rules (create-filter) for known false positives, finding archive workflows, CloudTrail correlation for TTP chaining, auto-enable GuardDuty in new accounts via Lambda on CreateAccount, and custom threat intel upload (ThreatIntelSet / IPSet). Emits AUTOMATION_DEPLOYED with the full EventBridge+Lambda+SNS pipeline or REVIEW_REQUIRED with the specific gap. Use when building automated GuardDuty response, severity-based auto-remediation, multi-account GuardDuty automation, or integrating GuardDuty with...4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline workflow design. Live deployment uses aws guardduty create-filter, list-findings, get-findings, archive-findings, create-threat-intel-set, create-ip-set, aws events put-rule, put-targets, aws lambda create-function, aws sns create-topic, subscribe, aws securityhub batch-import-findings, aws organizations enable-aws-service-access, and aws cloudformation deploy (for multi-account...6metadata:7 source: https://skillmd.com/skills/jhkchan/guardduty-finding-automator8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '4'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Security15 task_type: automate16 skill_class: capability17 lifecycle_status: active18 verdict_shape: AUTOMATION_DEPLOYED | REVIEW_REQUIRED19 when_to_use: Building automated response workflows for GuardDuty findings, wiring EventBridge to Lambda remediation functions, designing severity-based auto-response (Critical/High auto-isolate, Medium notify, Low log), configuring GuardDuty with Security Hub integration, setting up multi-account GuardDuty via Organizations delegated administrator, creating suppression filters for known false positives, uploading custom threat intel, or auto-enabling GuardDuty in new accounts.20 when_not_to_use: Investigating a single GuardDuty finding for root cause (use guardduty-finding-investigator). Triaging finding severity numerically without automation (use guardduty-finding-severity-triage). Config posture audits of GuardDuty detector enablement (use the auditor family). Forensic chain of custody and disk imaging belong to incident-response-automator. Non-GuardDuty detections (Inspector, Macie, Detective) use their own skills.21 activation_triggers: automate GuardDuty response, GuardDuty EventBridge Lambda, severity-based auto-remediation, isolate EC2 on GuardDuty finding, revoke IAM keys on detection, block IP in WAF from GuardDuty, GuardDuty Security Hub integration, GuardDuty suppression filter, GuardDuty multi-account automation, auto-enable GuardDuty new account, GuardDuty custom threat intel, archive GuardDuty findings22 invocation_schema: 'Input: either (a) a GuardDuty finding type or family (e.g., UnauthorizedAccess:EC2/SSHBruteForce) plus desired remediation actions, OR (b) an automation requirement ("auto-isolate EC2 on Critical findings", "revoke IAM keys on credential-abuse detection"). Output: deterministic AUTOMATION block per finding family — ROUTING/REMEDIATION/ NOTIFICATION/INTEGRATION/SAFETY/VERDICT — where VERDICT is AUTOMATION_DEPLOYED (pipeline template ready) or REVIEW_REQUIRED (specific gap cited).'23 version: 0.1.024 author: Jacky Chan — AWS Community Builder25 keywords: Amazon GuardDuty, EventBridge, Lambda remediation, severity-based routing, EC2 isolation, IAM credential revocation, WAF IP blocking, SNS notification, AWS Security Hub, BatchImportFindings, Organizations delegated admin, suppression filter, finding archive, CloudTrail correlation, TTP chaining, ThreatIntelSet, IPSet, auto-enable GuardDuty, incident response automation26 tags: guardduty, security, eventbridge, lambda, security-hub, incident-response, automate, threat-detection27---2829# GuardDuty Finding Automator3031## Mindset3233**One-line takeaway:** every GuardDuty automation workflow is a five-stage34pipeline — **detect** (GuardDuty finding) → **route** (EventBridge severity35filter) → **respond** (Lambda remediation) → **notify** (SNS with finding36context) → **correlate** (Security Hub + CloudTrail TTP chaining). A gap37in ANY stage produces a silent failure: the finding fires but nothing is38contained, or containment fires on a false positive and takes down a39production service.4041- **Detection** without **automated routing** is noise — alert fatigue42 sets in within weeks of enablement.43- **Severity-based auto-response** is the core design decision:44 Critical/High findings trigger automatic containment, Medium notifies45 the security team, Low findings are logged for trend analysis.46- **Finding ID deduplication is non-negotiable.** GuardDuty updates the47 same finding ID when new evidence arrives. Without dedup, the Lambda48 re-isolates the same instance on every update.49- **TTP correlation across findings reveals the attack chain.** A Recon50 finding followed by UnauthorizedAccess followed by Exfiltration is a51 kill-chain, not three isolated events. Security Hub is the correlation52 layer.5354## Quick navigation5556| You want to... | Go to |57|---|---|58| Route findings by severity via EventBridge | Step 2 + Appendix A |59| Pick the right Lambda remediation action | Step 3 (action matrix) |60| Wire EC2 isolation (SG swap) | Step 4 |61| Revoke IAM credentials safely | Step 5 |62| Block source IPs in WAF | Step 6 |63| Send SNS notifications with finding context | Step 7 |64| Ingest as Security Hub custom finding | Step 8 |65| Set up multi-account via Organizations | Step 9 |66| Suppress known false positives | Step 10 |67| Correlate TTPs across findings via CloudTrail | Step 11 |68| Auto-enable GuardDuty in new accounts | Step 12 |69| Upload custom threat intel | Step 13 |70| Avoid common automation pitfalls | Anti-Patterns |7172## Critical rules at a glance (do NOT bury these)73741. **EventBridge fires on finding occurrence AND finding update.**75 GuardDuty emits an event when a finding is first created AND on every76 subsequent update. The Lambda MUST deduplicate on finding ID.77782. **EC2 isolation via security group swap is the safest containment.**79 Replacing SGs with an isolation SG (no ingress, restricted egress) is80 reversible. Terminating destroys forensic evidence. Stopping may81 trigger auto-scaling replacement.82833. **IAM key revocation must check `AccessKeyLastUsed` first** for Medium84 severity. Revoking an active application key causes an outage. For85 Critical findings (CryptoCurrency, Backdoor), revoke regardless.86874. **`create-filter` with `FindingCriteria` suppresses silently.** An88 over-broad filter hides real threats. Always scope to specific89 resource or IP and set an expiry review date.90915. **Security Hub `BatchImportFindings` requires the ASFF format.**92 Schema mismatches produce silent drops — Security Hub does not error93 on malformed findings.9495## Pre-flight: data requirements9697Pre-flight data-gathering commands (findings statistics, sample JSON, rule status, filters, WAF ACLs, SNS topics) moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md).98Load on demand to populate the required inputs before designing automation.99100**If the input is malformed** (missing finding type, ambiguous severity),101emit:102103```text104AUTOMATION: <reference>105FINDING_TYPE: <type or UNKNOWN>106VERDICT: ERROR107REASON: Cannot design automation — finding type and desired remediation action are required.108GAP: Re-supply get-findings output for the finding type and the severity-routing requirement.109```110111## Process — Workflow design (apply in order)112113### Step 0: Expert knowledge — non-obvious GuardDuty + EventBridge behaviors114115Eight non-obvious behaviors (severity serialization, finding-ID stability, archive semantics, Security Hub dups, WAF IP-set limits, Region-specific admin, Lambda timeouts, cross-account bus) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).116Load on demand before finalizing rule or Lambda design.117118### Step 1: Classify the finding family and severity tier119120| Finding family | Example types | Default severity | Response tier |121|---|---|---|---|122| `UnauthorizedAccess:EC2` | SSHBruteForce, RDPBruteForce | Medium-High | High → isolate; Medium → notify |123| `Backdoor:EC2` | BackdoorAtTask, DriveThroughSource | High-Critical | Auto-isolate |124| `CryptoCurrency:EC2` | CryptoDomain, BitcoinTool | High-Critical | Auto-isolate + snapshot |125| `Recon:EC2` | PortProbe, PortProbeUnprotectedPort | Low-Medium | Log + trend |126| `Persistence:IAMUser` | IAMUserBackdoor, NewUserCreation | High | Auto-revoke if credential-based |127| `Exfiltration` | S3, EC2 outbound anomalies | High-Critical | Auto-isolate + snapshot |128| `Trojan:EC2` | Trojan, DrivingLicense domain | High | Auto-isolate + Malware Protection |129| `Policy:IAMUser` | RootAccess, AssumeRole anomaly | Medium-High | Notify + CloudTrail correlate |130131**Severity routing matrix (the core design):**132133| Severity | Auto-action | Notification | Security Hub |134|---|---|---|---|135| Critical (9.0-10.0) | Isolate EC2, revoke IAM keys, WAF block, snapshot | SNS + Page on-call | Custom finding + correlation |136| High (7.0-8.9) | Isolate EC2, revoke IAM keys (conditional) | SNS + Email security | Custom finding |137| Medium (4.0-6.9) | No auto-action | SNS email | Forwarded (native) |138| Low (0.1-3.9) | No action | Log only (CloudWatch) | Forwarded (native) |139140### Step 2: Wire the EventBridge rule for severity-based routing141142```bash143aws events put-rule \144 --name guardduty-critical-high-routing \145 --event-pattern '{146 "source": ["aws.guardduty"],147 "detail-type": ["GuardDuty Finding"],148 "detail": {149 "severity": [{"numeric": [">=", 7.0]}]150 }151 }'152153aws events put-targets \154 --rule guardduty-critical-high-routing \155 --targets '[{156 "Id": "guardduty-remediation-lambda",157 "Arn": "arn:aws:lambda:us-east-1:111111111111:function:guardduty-auto-remediation",158 "DeadLetterConfig": {"Arn": "arn:aws:sqs:us-east-1:111111111111:guardduty-remediation-dlq"}159 }]'160```161162**IMPORTANT:** test the numeric severity match. If it fails (string163serialization), route all findings to Lambda and branch internally:164165```python166severity = float(event['detail']['finding']['severity'])167if severity >= 7.0: # Critical/High — auto-respond168elif severity >= 4.0: # Medium — notify only169else: # Low — log only170```171172### Step 3: Map finding type to remediation action (the action matrix)173174| Finding type | Action | Lambda | Reversible |175|---|---|---|---|176| `UnauthorizedAccess:EC2/SSHBruteForce` | Isolate EC2 (SG swap) | `gd-isolate-ec2` | Yes |177| `UnauthorizedAccess:EC2/RDPBruteForce` | Isolate EC2 + WAF block | `gd-isolate-ec2` + `gd-waf-block-ip` | Yes |178| `Backdoor:EC2/*` | Isolate + snapshot | `gd-isolate-ec2` + `gd-snapshot-ebs` | Partial |179| `CryptoCurrency:EC2/*` | Isolate immediately + snapshot | `gd-isolate-ec2` + `gd-snapshot-ebs` | Partial |180| `Persistence:IAMUser/*` | Revoke IAM access keys | `gd-revoke-iam-keys` | Yes |181| `Exfiltration:*` | Isolate/revoke + snapshot | Combination | Partial |182| `Trojan:EC2/*` | Isolate + Malware Protection scan | `gd-isolate-ec2` + `gd-malware-scan` | Yes |183| `Recon:*` | No auto-action — log + correlate | N/A | N/A |184185For the full parameter-level mapping, see186**references/finding-types-and-remediation-actions.md**.187188### Step 4: EC2 isolation via security group swap189190```python191ec2 = boto3.client('ec2')192ISOLATION_SG = 'sg-isolation-forensics'193194def isolate_instance(instance_id, original_sgs):195 """Swap instance SGs to isolation SG. Store originals for rollback."""196 eni = get_eni(instance_id)197 ec2.modify_network_interface_attribute(NetworkInterfaceId=eni, Groups=[ISOLATION_SG])198 store_in_dynamodb(instance_id, original_sgs) # For rollback199```200201Isolation SG (CloudFormation):202203```yaml204IsolationSecurityGroup:205 Type: AWS::EC2::SecurityGroup206 Properties:207 GroupDescription: GuardDuty isolation SG — no ingress, restricted egress208 SecurityGroupIngress: []209 SecurityGroupEgress:210 - IpProtocol: tcp211 FromPort: 443212 ToPort: 443213 CidrIp: 10.0.0.0/8 # Forensics VPC endpoint only214```215216**Rollback:** store original SGs in DynamoDB. Always include a rollback217Lambda — an isolated production instance is an outage until released.218219### Step 5: IAM credential revocation220221```python222iam = boto3.client('iam')223224def revoke_access_key(user_name, access_key_id, finding_type):225 last_used = iam.get_access_key_last_used(AccessKeyId=access_key_id)226 last_used_time = last_used['AccessKeyLastUsed'].get('LastUsedDate')227228 if finding_type.startswith(('CryptoCurrency', 'Backdoor')):229 iam.update_access_key(UserName=user_name, AccessKeyId=access_key_id, Status='Inactive')230 return {'action': 'revoked', 'reason': 'critical_finding'}231 elif last_used_time and (now - last_used_time).seconds < 3600:232 notify_sns(f'Key active in last hour — manual review required for {user_name}')233 return {'action': 'notified', 'reason': 'key_in_use'}234 else:235 iam.update_access_key(UserName=user_name, AccessKeyId=access_key_id, Status='Inactive')236 return {'action': 'revoked', 'reason': 'key_inactive'}237```238239### Step 6: WAF / NACL IP blocking240241boto3 WAF update_ip_set snippet and IP-set limit management moved verbatim to [references/finding-types-and-remediation-actions.md](references/finding-types-and-remediation-actions.md).242Load on demand when blocking source IPs.243244### Step 7: SNS notification with finding context245246```python247sns = boto3.client('sns')248249def notify_finding(finding, topic_arn, page_on_call=False):250 subject = f"[GuardDuty {finding['severity']}] {finding['type']}"251 message = json.dumps({252 'FindingId': finding['id'], 'Type': finding['type'],253 'Severity': finding['severity'], 'Resource': finding['resource']['resourceType'],254 'Action': finding.get('remediation_action', 'N/A'),255 'Count': finding['service']['eventCount']256 }, indent=2)257 sns.publish(TopicArn=topic_arn, Subject=subject, Message=message,258 MessageAttributes={'page': {'DataType': 'String',259 'StringValue': 'true' if page_on_call else 'false'}})260```261262### Step 8: Security Hub integration via BatchImportFindings263264GuardDuty natively forwards to Security Hub. For custom enrichment (TTP265annotation, blast-radius, correlation), create a custom finding:266267```python268securityhub = boto3.client('securityhub')269270def ingest_custom_finding(gd_finding, correlation_note=None):271 custom_finding = {272 'SchemaVersion': '2018-10-08',273 'Id': f"gd-custom-{gd_finding['id']}",274 'ProductArn': f'arn:aws:securityhub:us-east-1:111111111111:product/111111111111/default',275 'GeneratorId': 'guardduty-auto-remediation',276 'AwsAccountId': gd_finding['accountId'],277 'Types': ['TTPs/' + gd_finding['type'].split('/')[0]],278 'FirstObservedAt': gd_finding['service']['eventFirstSeen'],279 'LastObservedAt': gd_finding['service']['eventLastSeen'],280 'CreatedAt': now, 'UpdatedAt': now,281 'Severity': {'Label': severity_label(gd_finding['severity'])},282 'Title': f"GuardDuty Enriched: {gd_finding['type']}",283 'Description': gd_finding['description'],284 'ProductFields': {'Correlation': correlation_note or 'standalone'}285 }286 securityhub.batch_import_findings(Findings=[custom_finding])287```288289### Step 9: Multi-account via Organizations delegated administrator290291Delegated-admin enablement, auto-enable, and cross-account forwarding rules moved verbatim to [references/eventbridge-and-lambda-patterns.md](references/eventbridge-and-lambda-patterns.md).292Load on demand for multi-account rollout.293294### Step 10: Suppression filters for known false positives295296create-filter command, false-positive criteria table, and review-date rule moved verbatim to [references/finding-types-and-remediation-actions.md](references/finding-types-and-remediation-actions.md).297Load on demand when suppressing known false positives.298299### Step 11: CloudTrail correlation for TTPs300301MITRE chain table and correlate_ttps() DynamoDB query moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).302Load on demand when correlating findings into attack chains.303304### Step 12: Auto-enable GuardDuty in new accounts305306CreateAccount EventBridge rule pattern and Lambda responsibilities moved verbatim to [references/eventbridge-and-lambda-patterns.md](references/eventbridge-and-lambda-patterns.md).307Load on demand for new-account auto-enablement.308309### Step 13: Custom threat intel upload310311create-threat-intel-set / create-ip-set commands and activation check moved verbatim to [references/finding-types-and-remediation-actions.md](references/finding-types-and-remediation-actions.md).312Load on demand for custom threat intel.313314## Output format315316```text317AUTOMATION: <reference>318FINDING_TYPE: <GuardDuty finding type>319SEVERITY: <numeric> (<label>)320ROUTING:321 - EventBridge rule: <rule-name>322 - Filter: severity >= <threshold>323 - Target: Lambda <function-name> with DLQ324REMEDIATION:325 - Action: <isolate EC2 | revoke IAM keys | WAF block | snapshot | notify only>326 - Lambda: <function name + ARN>327 - Rollback: <how to reverse the action>328NOTIFICATION:329 - SNS topic: <arn>330 - Content: finding context (type, severity, resource, action taken)331 - Paging: <on-call for Critical | email for Medium | none for Low>332INTEGRATION:333 - Security Hub: <native forwarding | custom enriched finding>334 - CloudTrail correlation: <enabled | disabled>335SAFETY:336 - Finding ID deduplication: <DynamoDB | Step Functions | none>337 - False-positive suppression: <filter name + criteria>338 - Rate limiting: <Lambda concurrency cap>339AUDIT:340 - CloudTrail: ec2:ModifyNetworkInterfaceAttribute, iam:UpdateAccessKey341 - CloudWatch: Lambda invocation logs + errors342VERDICT: AUTOMATION_DEPLOYED | REVIEW_REQUIRED343GAP: <if REVIEW_REQUIRED, the specific missing piece>344TEMPLATE: <CLI snippet or YAML for the pipeline>345```346347### Worked example — AUTOMATION_DEPLOYED, EC2 SSH brute force348349```text350AUTOMATION_DEPLOYED: prod-guardduty-auto-response351FINDING_TYPE: UnauthorizedAccess:EC2/SSHBruteForce352SEVERITY: 7.5 (HIGH)353ROUTING:354 - EventBridge rule: guardduty-critical-high-routing355 - Filter: severity >= 7.0356 - Target: Lambda guardduty-auto-remediation (DLQ: guardduty-remediation-dlq)357REMEDIATION:358 - Action: isolate EC2 via SG swap to sg-isolation-forensics359 - Lambda: guardduty-auto-remediation360 - Rollback: restore original SGs from DynamoDB (key: instance-id)361NOTIFICATION:362 - SNS topic: arn:aws:sns:us-east-1:111111111111:guardduty-alerts363 - Content: finding type, severity, instance ID, action taken, rollback364 - Paging: on-call (Critical/High only)365INTEGRATION:366 - Security Hub: custom enriched finding (TTP: Initial Access)367 - CloudTrail correlation: enabled (60-min window)368SAFETY:369 - Finding ID deduplication: DynamoDB table guardduty-processed-findings370 - False-positive suppression: suppress-authorized-scanner (CI/CD NAT)371 - Rate limiting: Lambda concurrency cap = 10372AUDIT:373 - CloudTrail: ec2:ModifyNetworkInterfaceAttribute, lambda:InvokeFunction374 - CloudWatch: /aws/lambda/guardduty-auto-remediation375VERDICT: AUTOMATION_DEPLOYED376GAP: None377TEMPLATE:378 aws events put-rule --name guardduty-critical-high-routing --event-pattern '{"source":["aws.guardduty"],"detail-type":["GuardDuty Finding"],"detail":{"severity":[{"numeric":[">=",7.0]}]}}'379```380381### Worked example — REVIEW_REQUIRED, low-severity recon382383Secondary worked example (REVIEW_REQUIRED, low-severity recon) moved verbatim to [references/worked-examples.md](references/worked-examples.md).384Load on demand when formatting a REVIEW_REQUIRED response; the primary AUTOMATION_DEPLOYED example stays in this file.385386## Anti-Patterns — NEVER do these things387388- NEVER auto-isolate EC2 without a rollback path. The SG swap is389 reversible ONLY if original SGs are stored in DynamoDB. Without390 persistence, the instance is permanently quarantined — an outage.391392- NEVER revoke an IAM key without checking `AccessKeyLastUsed` for393 Medium severity. The key may be the application's active credential.394 For Critical (CryptoCurrency, Backdoor), revoke unconditionally.395396- NEVER set Lambda timeout to the default 3 seconds. EC2 SG swap, IAM397 API calls, and WAF updates take 5-30 seconds. Set timeout >= 60s.398399- NEVER skip finding ID deduplication. GuardDuty updates the same ID as400 evidence arrives. Without dedup, the Lambda re-remediates N times.401402- NEVER rely solely on EventBridge numeric severity matching. The field403 serialization is inconsistent. Route to Lambda and filter internally.404405- NEVER suppress findings without an expiry review. An "authorized406 scanner" that is later compromised silently hides threats.407408- NEVER block IPs in WAF without an eviction policy. WAF sets cap at409 10,000 entries. Use rotating sets or NACL-based blocking.410411- NEVER configure multi-account without cross-account EventBridge412 forwarding. The delegated admin does not auto-receive member findings.413414- NEVER assume `BatchImportFindings` validates schema. Malformed ASFF415 findings are silently dropped. Test with the ASFF validator first.416417- NEVER terminate an EC2 instance as auto-remediation. Termination418 destroys forensic evidence. Use isolation (SG swap) + EBS snapshot.419420- NEVER set Lambda concurrency to unbounded for remediation. A burst of421 findings triggers hundreds of concurrent invocations, exhausting API422 throttling. Set reserved concurrency (10-20) and use SQS as buffer.423424- NEVER deploy GuardDuty automation to a single Region. Deploy via425 StackSets to every Region where GuardDuty is enabled.426427- NEVER confuse `archive-findings` with deletion. Archived findings428 remain queryable for 90 days. There is no delete API.429430- NEVER skip CloudTrail correlation for Medium findings. A single Recon431 at severity 2.0 is noise. The same finding followed by Credential432 Abuse at severity 8.0 within 60 min is a kill-chain.433434## Pre-flight safety checks435436- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation:437 `CONFIRM: About to <action> for finding type <type> in account438 <account>. Proceed? (yes/no)`439440- **Test the remediation Lambda against a non-production instance.**441 Use `guardduty create-sample-findings` to generate test findings.442443- **Verify the isolation SG exists in every VPC.** An SG from VPC-A444 cannot apply to an instance in VPC-B.445446- **Verify SNS topic subscription is confirmed.** Unconfirmed email447 subscriptions silently drop notifications. Use Lambda/HTTPS for448 critical alerts.449450- **For multi-account, verify delegated admin in every target Region**451 before deploying the StackSet.452453## Appendix A — EventBridge rule patterns454455| Pattern | Use case |456|---|---|457| All findings | `"source":["aws.guardduty"],"detail-type":["GuardDuty Finding"]` |458| Critical/High only | Add `"detail":{"severity":[{"numeric":[">=",7.0]}]}` |459| Medium only | Add `"detail":{"severity":[{"numeric":[">=",4.0,"<",7.0]}]}` |460| Specific type | Add `"detail":{"type":["UnauthorizedAccess:EC2/SSHBruteForce"]}` |461| Specific resource | Add `"detail":{"resource":{"resourceType":["Instance"]}}` |462463## Appendix B — Lambda remediation decision tree464465```466Severity >= 7.0?467├─ Yes → Resource is EC2?468│ ├─ Yes → Isolate via SG swap + snapshot for forensics469│ └─ No → IAM user? → Revoke keys (Critical: unconditional; High: check last-used)470├─ Medium → Notify via SNS + Security Hub custom finding471└─ Low → Log to CloudWatch + background CloudTrail correlation472```473474## Recent AWS features (2024-2026)4754762024-2026 feature notes (Runtime Monitoring, Malware Protection for EBS, EKS Protection, Security Hub custom actions, global endpoints, auto-enable enhancements) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).477Load on demand when a request mentions recent detections.478479## Expert heuristic: severity-based auto-response blast radius480481Blast-radius scoping table, 3-phase validation, dedup snippet, and post-deploy alarms moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).482Load on demand before enabling containment.483484## References (load on demand)485486- [references/finding-types-and-remediation-actions.md](references/finding-types-and-remediation-actions.md) — finding-type to action matrix, WAF IP blocking, suppression filters, threat intel sets487- [references/eventbridge-and-lambda-patterns.md](references/eventbridge-and-lambda-patterns.md) — event structure, rule patterns, Lambda templates, multi-account forwarding488- [references/worked-examples.md](references/worked-examples.md) — secondary worked example (REVIEW_REQUIRED, low-severity recon)489- [references/diagnostic-commands.md](references/diagnostic-commands.md) — pre-flight data-gathering commands490- [references/advanced-patterns.md](references/advanced-patterns.md) — Step-0 expert behaviors, TTP correlation, blast-radius validation, 2024-2026 features491492## Domain493494AWS CloudOps / Security Automation — GuardDuty-driven detection and response.495496## AWS documentation497498- **Amazon GuardDuty** — https://docs.aws.amazon.com/guardduty/latest/ug/what-is-guardduty.html499- **GuardDuty EventBridge events** — https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html500- **GuardDuty suppression filters** — https://docs.aws.amazon.com/guardduty/latest/ug/filters.html501- **GuardDuty Organizations** — https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_organizations.html502- **Security Hub ASFF** — https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-findings-format.html503- **GuardDuty threat intel sets** — https://docs.aws.amazon.com/guardduty/latest/ug/threat-intel-set.html504- **GuardDuty Runtime Monitoring** — https://docs.aws.amazon.com/guardduty/latest/ug/runtime-monitoring.html505- **GuardDuty Malware Protection** — https://docs.aws.amazon.com/guardduty/latest/ug/malware-protection.html