Threat Detection via SDK Best Practices
Alert triage workflow and finding-suppression hygiene.
Search across all documentation pages
Alert triage workflow and finding-suppression hygiene.
This is the checklist to run through when standing up or auditing GuardDuty and Security Hub via SDK. Each item is a rule stated positively with a one-line rationale, grouped from coverage outward through triage, automation, cost, and multi-account operations. Work top to bottom - get detection coverage right first, then build the triage and automation on top of it.
us-east-1 sees nothing happening in eu-west-1.Status is ENABLED and data sources are actually on before relying on the coverage.SortCriteria on ListFindings so the highest-severity items surface first.Read findings efficiently with server-side filtering and pagination.
# --- Python (boto3) ---
import boto3
guardduty = boto3.client("guardduty", region_name="us-east-1")
paginator = guardduty.get_paginator("list_findings")
high_severity_ids = []
for page in paginator.paginate(
DetectorId="<detector-id>",
FindingCriteria={"Criterion": {"severity": {"Gte": 7}}},
):
high_severity_ids.extend(page["FindingIds"])
print(f"{len(high_severity_ids)} high-severity findings")// --- TypeScript (AWS SDK v3) ---
import { GuardDutyClient, ListFindingsCommand } from "@aws-sdk/client-guardduty";
const guardduty = new GuardDutyClient({ region: "us-east-1" });
let nextToken: string | undefined;
const highSeverityIds: string[] = [];
do {
const page = await guardduty.send(new ListFindingsCommand({
DetectorId: "<detector-id>",
FindingCriteria: { Criterion: { severity: { Gte: 7 } } },
NextToken: nextToken,
}));
highSeverityIds.push(...(page.FindingIds ?? []));
nextToken = page.NextToken;
} while (nextToken);
console.log(`${highSeverityIds.length} high-severity findings`);Action: "ARCHIVE" handles a pattern automatically instead of manual re-archiving every occurrence.EnableOrganizationAdminAccount plus auto-enable configuration scales far better than manual CreateMembers/InviteMembers per account.Enable GuardDuty in every region you operate in, enable Security Hub with at least AWS Foundational Security Best Practices, and confirm both with a status check before relying on the coverage.
Filter and sort server-side by severity, and use suppression filters for specific known-benign patterns you have already triaged - never suppress broadly by severity range alone.
An overly broad IAM role on the remediation Lambda. Scope it to the exact actions and resources it needs, since a compromised or buggy remediation function with wide permissions is itself a serious risk.
Yes. Each has its own EnableOrganizationAdminAccount call and its own delegated administrator designation - delegating one does not delegate the other.
Scope the EventBridge rule's event pattern with a severity threshold and/or a finding-type prefix match, so only trusted categories and severities reach the remediation function.
Several. Each Security Hub standard (CIS, FSBP, etc.) computes its own score from its own controls - report them individually rather than blending into a single number.
Archiving is a one-off action on findings you have already reviewed. A suppression filter automates that same action going forward for a defined, recurring pattern, so you are not manually re-archiving the same thing repeatedly.
Only for small, static account sets. For anything that grows over time, Organizations-based auto-enable configuration removes the manual per-account invitation step entirely.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Reviewed by Chris St. John·Last updated Jul 25, 2026