0Pricing
AWS Security Academy · Lesson

Matching Findings with Event Patterns

Write rules that fire only on the alerts you care about.

Matching Findings with Event Patterns is a free AWS Security Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Patterns Matter

You do not want to react to every event — only the ones that matter. An event pattern is the filter that decides which events a rule acts on.

A precise pattern means your automation fires exactly when a real threat appears and stays quiet otherwise, avoiding both missed alerts and noisy false triggers.

Pattern Structure

An event pattern is JSON that mirrors the structure of the events it matches. You specify the fields and values you care about; an event matches only if every specified field matches.

Fields you omit are ignored, so a pattern can be as broad or as narrow as you need.

{
  "source": ["aws.guardduty"],
  "detail-type": ["GuardDuty Finding"]
}

Matching on Source

The most common filter is source — for example "aws.guardduty" or "aws.macie".

Combined with detail-type, this narrows events to a specific kind from a specific service. It is the natural starting point for any security rule before you refine further.

Filtering by Severity

You often want to act only on serious findings. By matching nested fields in detail, a pattern can require, say, a GuardDuty severity at or above a threshold.

EventBridge supports numeric matching like greater-than, so a rule can fire only for high-severity findings and ignore low-risk noise.

{
  "detail": {
    "severity": [ { "numeric": [ ">=", 7 ] } ]
  }
}

Advanced Matching

Patterns support richer operators: prefix matching, exists checks, anything-but, and IP-address CIDR matching.

These let you express precise conditions — match any finding type starting with "UnauthorizedAccess", or any event whose region field exists but is not your home region.

Match Specific Finding Types

GuardDuty produces dozens of finding types like Recon, CryptoCurrency, or InstanceCredentialExfiltration.

By matching the detail.type field, you can route different threats to different remediations — credential theft to one Lambda, cryptomining to another — so each gets the response it deserves.

Test Your Patterns

A pattern that never matches is a silent failure. Use the EventBridge console's sandbox to paste a sample event and confirm the pattern matches it.

Testing with real event samples before deploying prevents the embarrassing and dangerous case of automation that simply never fires.

Avoid Over-Matching

Too broad a pattern triggers remediation on benign events, causing disruption — imagine isolating instances on every low-severity informational finding.

Scope patterns to genuine threats. The art is matching enough to catch real incidents while excluding the routine noise that should not invoke automated action.

Patterns Across Services

The same pattern syntax works for any event source: Config rule compliance changes, Security Hub findings, Macie discoveries, or specific CloudTrail API calls.

Learning event patterns once lets you build security automation across your entire AWS estate using one consistent matching language.

Multiple Patterns, Multiple Rules

Rather than one giant pattern trying to catch everything, build several focused rules, each with its own pattern and target.

One rule isolates instances on credential findings; another only alerts on low-severity recon; another reacts to Macie discoveries. Smaller, single-purpose rules are easier to test, reason about, and adjust than one sprawling catch-all.

From Pattern to Action

A matched event is only useful when paired with a target. The pattern decides whether to act; the target decides what to do.

Together they form a rule: this kind of finding, of this severity, triggers this specific remediation. That pairing is the heart of every automated response.

Quick Check

Pick the precise filter.

Recap

An event pattern is the JSON filter that decides which events a rule acts on, matching fields like source, detail-type, and nested detail values. Use numeric matching for severity thresholds and advanced operators (prefix, exists, anything-but, CIDR) to scope precisely. Match specific GuardDuty finding types to route distinct remediations, test patterns in the sandbox, and avoid over-matching so automation fires on real threats only.

Frequently asked questions

Is the “Matching Findings with Event Patterns” lesson free?

Yes — the full text of “Matching Findings with Event Patterns” is free to read here on the web, and the AWS Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Security Academy course, upgrade to CoddyKit PRO.

What will I learn in “Matching Findings with Event Patterns”?

Write rules that fire only on the alerts you care about. You practise AWS Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start AWS Security Academy?

No prior experience is required. AWS Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Matching Findings with Event Patterns” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this AWS Security Academy lesson?

Yes. Every AWS Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. How EventBridge Routes Security Events
  2. Matching Findings with Event Patterns
  3. Triggering Lambda for Auto-Remediation
  4. Orchestrating Responses with Step Functions
← Back to AWS Security Academy