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.
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.
- 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
- 1Route 53 and Shield
DNS and DDoS absorption at the edge.
- 2CloudFront with WAF
Caching plus HTTP request filtering.
- 3ALB and security groups
Only CloudFront reaches the origin.
- 4Instances and containers
Inspector scans for CVEs.
- 5Data in S3
Macie finds sensitive data.
- 6Across 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.
- 1Request arrives
At CloudFront, ALB or API Gateway.
- 2Rule 0, 1, 2...
Checked in priority order.
- 3Count matches
Logged, evaluation continues.
- 4Allow or Block
First terminating match stops it.
- 5Default 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.
- Free and automatic
- Layer 3 and 4 attacks
- All AWS customers
- No response team
- 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.
- GuardDuty to EventBridge: High severity finding event1High severity finding event
- EventBridge to Lambda: Rule matches, invoke function2Rule matches, invoke function
- Lambda to EC2 instance: Replace SGs with quarantine SG3Replace SGs with quarantine SG
- Lambda to EC2 instance: Snapshot volumes for forensics4Snapshot volumes for forensics
- Lambda to EventBridge: Publish alert to security team5Publish 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.
- 1Block web attacks with WAF rules~35m
- 2Explain Shield Standard vs Advanced~35m
- 3Detect threats with GuardDuty~35m
- 4Scan workloads with Inspector~35m
- 5Find 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.
{
"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.
{
"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.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Enable GuardDuty in your lab Region, generate sample findings, and list them.
- Exercise 2medium
Create a regional web ACL with the AWS managed core rule set in Count mode and attach it to an ALB.
- 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.