Skip to content
Visual explainer 3h to learn 5 steps

WAF, Shield, GuardDuty, Inspector & Macie

Pick the right service to block, detect or audit a given threat.

By Invicly Tech, , in AWS Solutions Architect – Associate. About 12 minutes to read.

Topic 8 of 34

In short

AWS has separate services to block, detect and assess threats. WAF filters malicious HTTP requests, Shield protects against DDoS, GuardDuty detects suspicious activity from logs, Inspector scans for vulnerabilities, and Macie finds sensitive data in S3. Exam questions hinge on picking the right verb: block, detect or discover.

Explained simply

Attackers try many things: flooding your site with traffic, sending poisoned input to a login form, stealing keys, or finding data you forgot was there. AWS has a separate service for each job, and the trick is to know which verb each service does: block, absorb, detect, scan or discover.

AWS WAF is a web application firewall. It reads each HTTP request and blocks the bad ones, such as SQL injection attempts or one IP sending thousands of login requests. AWS Shield protects against DDoS attacks, where huge amounts of junk traffic try to knock your site offline.

Amazon GuardDuty is a security camera. It watches activity logs and network data, and raises an alarm when something looks wrong, such as an instance talking to a known criminal server. It does not block anything by itself; it tells you, so you or an automation can respond.

Amazon Inspector checks your servers, container images and Lambda functions for known software vulnerabilities. Amazon Macie looks inside S3 buckets for sensitive data like credit card numbers or passport details. One finds weak doors, the other finds valuables left in the open.

Press Play on a diagram to walk through it one step at a time.

MapPick the threat service
Threat protection
  • Block web attacks
    • AWS WAF
    • SQL injection and XSS rules
    • Rate-based rules
  • Absorb DDoS
    • Shield Standard: free, automatic
    • Shield Advanced: paid, response team
  • Detect threats
    • GuardDuty
    • CloudTrail, VPC Flow, DNS logs
  • Find vulnerabilities
    • Inspector
    • EC2, ECR images, Lambda
  • Discover sensitive data
    • Macie
    • PII in S3 buckets
LayersDefense in depth for a web app
  1. 1
    Route 53 and Shield

    DNS and DDoS absorption at the edge.

  2. 2
    CloudFront with WAF

    Caching plus HTTP request filtering.

  3. 3
    ALB and security groups

    Only CloudFront reaches the origin.

  4. 4
    Instances and containers

    Inspector scans for CVEs.

  5. 5
    Data in S3

    Macie finds sensitive data.

  6. 6
    Across everything

    GuardDuty watches logs and runtime.

In depth

How WAF evaluates a request

A web ACL is a list of rules with priorities. WAF checks rules from the lowest priority number upward. The first rule that matches with a terminating action, Allow or Block, ends the check. Count only records a match and continues, which makes it perfect for testing new rules safely. CAPTCHA and Challenge make a browser prove it is not a simple bot. If no rule decides, the web ACL's default action applies.

AWS managed rule groups save you writing patterns: the core rule set for common OWASP attacks, known bad inputs, SQL database protections, Amazon IP reputation lists, and paid groups for bot control and account takeover prevention. Rate-based rules count requests per IP, or per header or other key, over an evaluation window of 1 to 10 minutes and block the sources that go over the limit.

Always start new rules in Count mode, check WAF logs for false positives, then switch to Block.

FlowOne request through a web ACL
  1. 1
    Request arrives

    At CloudFront, ALB or API Gateway.

  2. 2
    Rule 0, 1, 2...

    Checked in priority order.

  3. 3
    Count matches

    Logged, evaluation continues.

  4. 4
    Allow or Block

    First terminating match stops it.

  5. 5
    Default action

    Used when no rule decides.

Shield Standard versus Shield Advanced

Shield Standard is on for every AWS customer at no cost. It defends against common network and transport layer attacks, such as SYN floods and UDP reflection, on all AWS edge and Regional infrastructure.

Shield Advanced is a paid subscription of 3,000 USD per month per organization, with a one-year commitment. It protects named resources: CloudFront distributions, Route 53 hosted zones, Global Accelerator accelerators, load balancers and Elastic IPs. You get detailed attack visibility, automatic application layer DDoS mitigation through WAF, access to the Shield Response Team (with Business or Enterprise Support), and DDoS cost protection, which credits scaling charges caused by an attack. WAF charges for protected resources are included.

Architecture matters as much as the subscription. Put CloudFront, Route 53 and Global Accelerator in front, because the edge absorbs floods far from your origin, and keep origins private.

CompareShield tiers
Shield Standard
  • Free and automatic
  • Layer 3 and 4 attacks
  • All AWS customers
  • No response team
Shield Advanced
  • 3,000 USD per month, 1-year term
  • Named resources, incl. Layer 7 help
  • Shield Response Team access
  • DDoS cost protection

GuardDuty: what it watches and how to respond

GuardDuty's foundational data sources are CloudTrail management events, VPC Flow Logs and Route 53 Resolver DNS query logs. It reads these from its own independent streams, so you do not need to turn the logs on yourself, and there are no agents. Optional protection plans go further: S3 Protection (data events on buckets), EKS Protection (Kubernetes audit logs), Runtime Monitoring (an agent on EKS, ECS and EC2), Malware Protection for EC2 volumes and for new S3 uploads, RDS Protection (login activity) and Lambda Protection (network activity).

Findings have names like CryptoCurrency:EC2/BitcoinTool.B!DNS and a severity from low to critical. Extended Threat Detection links several findings into one attack sequence.

GuardDuty only reports. To respond automatically, send findings through EventBridge to a Lambda function or Systems Manager runbook that, for example, swaps an instance's security group to a quarantine group.

SequenceAutomatic response to a finding
GuardDuty
EventBridge
Lambda
EC2 instance
  1. 1High severity finding event
    GuardDuty to EventBridge: High severity finding event
  2. 2Rule matches, invoke function
    EventBridge to Lambda: Rule matches, invoke function
  3. 3Replace SGs with quarantine SG
    Lambda to EC2 instance: Replace SGs with quarantine SG
  4. 4Snapshot volumes for forensics
    Lambda to EC2 instance: Snapshot volumes for forensics
  5. 5Publish alert to security team
    Lambda to EventBridge: Publish alert to security team

Inspector and Macie

Inspector is continuous vulnerability management. For EC2 it uses the Systems Manager agent, or scans EBS snapshots agentlessly, to compare installed packages with known CVEs. For ECR it scans images when pushed and rescans when new CVEs appear. For Lambda it scans function packages and can review code. It also reports network reachability, such as a port open to the internet. Each finding gets an Inspector score that adjusts the CVE severity for your context, for example lower if the vulnerable host is not reachable.

Macie works only on S3. It keeps an inventory of buckets and flags ones that are public, unencrypted or shared outside the account. Automated sensitive data discovery samples objects across all buckets continuously, and discovery jobs scan chosen buckets fully. Managed data identifiers detect things like credit card numbers, AWS secret keys and passport numbers; custom data identifiers add your own regular expressions and keywords.

  • Inspector: EC2, ECR images, Lambda
  • Inspector finds CVEs and network exposure
  • Macie: S3 only
  • Macie finds PII, credentials and risky bucket settings

Picking the right service on the exam

Read the verb in the question. "Block SQL injection or limit requests per IP" is WAF. "Protect against large DDoS attacks with expert help and cost protection" is Shield Advanced. "Detect compromised instances, unusual API calls or crypto mining" is GuardDuty. "Find software vulnerabilities in instances or container images" is Inspector. "Find PII in S3" is Macie.

A few neighbors appear as distractors. Security Hub collects findings from all of these services in one place and checks accounts against best-practice standards. Detective helps investigate the root cause of a finding with graphs of related activity. Firewall Manager applies WAF, Shield Advanced, security group and Network Firewall policies across every account in an organization. Network Firewall filters traffic inside a VPC, including non-HTTP protocols that WAF cannot see.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Block web attacks with WAF rules~35m
  2. 2
    Explain Shield Standard vs Advanced~35m
  3. 3
    Detect threats with GuardDuty~35m
  4. 4
    Scan workloads with Inspector~35m
  5. 5
    Find sensitive S3 data with Macie~35m

Key points

  • WAF attaches to CloudFront, ALB, API Gateway, AppSync and Cognito user pools.
  • Shield Standard is on for everyone; Advanced adds DDoS cost protection and expert support.
  • GuardDuty is agentless for core logs and needs only to be enabled.
  • Inspector continuously scans for CVEs and unintended network exposure.
  • Macie uses machine learning and patterns to flag PII in S3.

Key terms

Tap a card to flip it. 0/6 known

Examples

Rate limiting a login page

Bots are guessing passwords on /login behind an ALB. Step 1: add a rate-based rule that counts requests per client IP, but only for paths starting with /login, using a scope-down statement. Step 2: set the limit to 100 requests in a 5-minute window, far above what a real user needs. Step 3: deploy it with the Count action for a day and read the WAF logs to check no real users would be blocked. Step 4: change the action to Block. Step 5: add the AWS managed account takeover prevention group later if attacks continue from many IPs.

json
{
  "Name": "limit-login",
  "Priority": 1,
  "Action": {"Block": {}},
  "Statement": {"RateBasedStatement": {
    "Limit": 100, "EvaluationWindowSec": 300, "AggregateKeyType": "IP",
    "ScopeDownStatement": {"ByteMatchStatement": {
      "FieldToMatch": {"UriPath": {}}, "PositionalConstraint": "STARTS_WITH",
      "SearchString": "/login",
      "TextTransformations": [{"Priority": 0, "Type": "NONE"}]}}}},
  "VisibilityConfig": {"SampledRequestsEnabled": true,
    "CloudWatchMetricsEnabled": true, "MetricName": "limit-login"}
}

Turning a GuardDuty finding into action

The security team wants every high or critical GuardDuty finding to page them and isolate the instance. Step 1: create an EventBridge rule with the pattern below, which matches findings with severity 7 or higher. Step 2: add two targets: an SNS topic that pages the on-call engineer, and a Lambda function. Step 3: the function reads the instance ID from the finding, replaces its security groups with a quarantine group that has no rules, and snapshots its volumes for forensics. Step 4: test with aws guardduty create-sample-findings to be sure the wiring works before a real incident.

json
{
  "source": ["aws.guardduty"],
  "detail-type": ["GuardDuty Finding"],
  "detail": {"severity": [{"numeric": [">=", 7]}]}
}

Quick reference

  • WAF attaches to CloudFront, ALB, API Gateway, AppSync and Cognito; never to an NLB
  • WAF checks rules by priority; first Allow or Block wins; Count logs and continues
  • Rate-based rules: count per IP or key over 1 to 10 minute windows
  • Shield Advanced: 3,000 USD per month per org, response team, DDoS cost protection
  • GuardDuty reads CloudTrail, VPC Flow Logs and DNS logs without you enabling them
  • GuardDuty detects; respond through EventBridge to Lambda or Systems Manager
  • Inspector: CVEs in EC2, ECR and Lambda. Macie: sensitive data in S3
  • Firewall Manager applies WAF and Shield policies across every account in an organization

Common mistakes

  • Choosing GuardDuty to block traffic; it detects and reports, it does not block.
  • Attaching WAF to a Network Load Balancer; WAF does not support NLB.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1You want to test a new WAF rule without blocking any real users. Which action should it use first?

Question 2

2A company wants credits for scaling costs caused by a DDoS attack. What do they need?

Question 3

3What must you do before GuardDuty can analyze VPC Flow Logs?

Question 4

4A new critical CVE is published. Which service flags ECR images that contain it, without a new push?

Question 5

5An app on an NLB receives malicious TCP traffic on a custom port. WAF cannot help. What filters it inside the VPC?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Enable GuardDuty in your lab Region, generate sample findings, and list them.

  2. Exercise 2medium

    Create a regional web ACL with the AWS managed core rule set in Count mode and attach it to an ALB.

  3. Exercise 3hard

    Use Macie to find employee IDs shaped like EMP-123456 in a bucket called hr-exports.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Does GuardDuty block attacks?
No. It detects and reports findings. You block or isolate by automating a response through EventBridge, or by updating WAF, security groups or NACLs.
Do I need Shield Advanced?
Most workloads are fine with free Shield Standard plus CloudFront and WAF. Shield Advanced makes sense for high-value, internet-facing apps that need expert response and DDoS cost protection.
Can AWS WAF protect a Network Load Balancer?
No. WAF works on HTTP and supports CloudFront, ALB, API Gateway, AppSync, Cognito and a few others. For an NLB, put CloudFront in front or use Network Firewall.
What is the difference between Inspector and GuardDuty?
Inspector finds weaknesses before they are exploited, such as unpatched software. GuardDuty detects suspicious behavior that suggests an attack is happening or has happened.

Go deeper

ShareXLinkedInWhatsApp