GuardDuty, Inspector, Security Hub and Incident Response
Overview
AWS offers managed security services that watch your environment so you do not have to build detection from scratch. Amazon GuardDuty detects threats (suspicious behaviour), Amazon Inspector finds vulnerabilities (software and network exposure), Amazon Macie discovers sensitive data in S3 and AWS Security Hub aggregates findings and checks security standards across accounts.
A good analogy is a building's security team: GuardDuty is the guard who notices someone trying every door at midnight, Inspector is the surveyor who finds a rusty lock, Macie checks which boxes contain confidential papers, and Security Hub is the control room screen that brings all alerts together.
Operations teams must know what each service detects, how to enable it organisation-wide, and how to respond – usually by routing findings through EventBridge into automated or manual runbooks.
Key Concepts
- GuardDuty analyses CloudTrail, VPC Flow Logs, DNS logs (plus optional S3, EKS, Lambda, Malware Protection, RDS login, runtime monitoring) to produce findings with severity.
- Inspector continuously scans EC2 (via SSM agent or agentless), ECR images and Lambda functions for CVEs and network reachability; produces risk scores.
- Macie uses ML and pattern matching to find PII/sensitive data in S3 and evaluates bucket security posture.
- Security Hub aggregates findings in ASFF from AWS and partner services, runs standards (AWS Foundational Security Best Practices, CIS, PCI DSS, NIST 800-53) and supports automation rules.
- Detective builds graphs for investigating root cause across CloudTrail, VPC Flow and GuardDuty data.
- AWS WAF filters web requests (SQLi, XSS, rate limiting, bot control) on ALB/CloudFront/API Gateway; Shield Standard is automatic DDoS protection and Shield Advanced adds response team and cost protection.
- All can be enabled organisation-wide with a delegated administrator and findings routed to EventBridge.
- Trusted Advisor and Config give additional security checks (open ports, MFA on root, public snapshots).
Detailed Notes
Which service for which question?
| Question | Service |
|---|---|
| Is an instance talking to a known crypto-mining or C2 domain? | GuardDuty |
| Does my EC2/ECR/Lambda have unpatched CVEs? | Inspector |
| Which S3 buckets contain credit-card numbers? | Macie |
| Show all findings and compliance score in one place | Security Hub |
| Why did this role start calling unusual APIs? | Detective |
| Block SQL injection at the edge | WAF |
| Mitigate volumetric DDoS | Shield (Advanced) |
Enabling GuardDuty and Security Hub
aws guardduty create-detector --enable --finding-publishing-frequency FIFTEEN_MINUTES
aws guardduty update-organization-configuration --detector-id <ID> --auto-enable-organization-members ALL
aws securityhub enable-security-hub --enable-default-standards
aws securityhub batch-enable-standards --standards-subscription-requests \
StandardsArn=arn:aws:securityhub:us-east-1::standards/aws-foundational-security-best-practices/v/1.0.0
Enable in every Region you use (they are Regional) and use Security Hub cross-Region aggregation.
Example GuardDuty finding types
| Finding | Meaning / response |
|---|---|
UnauthorizedAccess:EC2/SSHBruteForce | Instance targeted/attacking via SSH; tighten SG, review keys |
CryptoCurrency:EC2/BitcoinTool.B!DNS | Instance resolving mining domains; isolate and investigate |
Recon:IAMUser/MaliciousIPCaller | API calls from known bad IP; rotate credentials |
Exfiltration:S3/MaliciousIPCaller | Data access from bad IP; review bucket policy |
Policy:S3/BucketPublicAccessGranted | Public bucket; restore Block Public Access |
Automated response (EventBridge)
{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"],
"detail": { "severity": [{ "numeric": [">=", 7] }] }
}
Targets: SNS/Slack, Lambda or SSM Automation that isolates the instance (replace security groups with a quarantine SG that denies all), snapshots volumes for forensics, and tags the instance.
Incident response playbook for a compromised instance
- Contain: attach quarantine security group; remove from load balancer; revoke role sessions (add a Deny with
aws:TokenIssueTimecondition). - Preserve evidence: EBS snapshots, memory capture if required, export logs; do not terminate immediately.
- Investigate: CloudTrail, VPC Flow Logs, Detective, GuardDuty finding detail.
- Eradicate and recover: rebuild from golden AMI, rotate credentials and keys.
- Learn: update controls, runbooks and detection.
Inspector operations
aws inspector2 enable --resource-types EC2 ECR LAMBDA
aws inspector2 list-findings --filter-criteria '{"severity":[{"comparison":"EQUALS","value":"CRITICAL"}]}'
For EC2, Inspector uses the SSM agent; instances not managed by SSM show as unscanned (or use agentless scanning). Findings feed Security Hub; remediate by patching with Patch Manager and rebuilding images.
WAF snippet
aws wafv2 create-web-acl --name edge --scope REGIONAL --default-action Allow={} \
--visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=edge \
--rules file://rules.json
Rate-based rules throttle abusive IPs; managed rule groups protect against OWASP Top 10.### Choosing the right detection service
| Service | Data source | Finds |
|---|---|---|
| GuardDuty | CloudTrail, VPC Flow Logs, DNS logs, plus optional S3, EKS, RDS, malware and runtime protection | Threats such as crypto-mining, credential exfiltration |
| Inspector | EC2, ECR images, Lambda | Software vulnerabilities and network exposure (CVEs) |
| Macie | S3 objects | Sensitive data such as PII |
| Security Hub | Aggregates findings and runs standards checks (CIS, AWS Foundational) | Posture and compliance scores |
| Detective | Graph of logs | Root cause investigation |
| Config | Resource configuration | Compliance with rules |
| Trusted Advisor | Account checks | Security, limits, cost, resilience |
aws guardduty list-findings --detector-id <id> --finding-criteria '{"Criterion":{"severity":{"Gte":7}}}'
aws securityhub get-findings --filters '{"SeverityLabel":[{"Value":"CRITICAL","Comparison":"EQUALS"}]}'
aws inspector2 list-findings --filter-criteria '{"severity":[{"comparison":"EQUALS","value":"CRITICAL"}]}'
Findings flow to EventBridge in near real time, so remediation can be automated. Enable services organization-wide with a delegated administrator and auto-enable for new accounts. Inspector needs the SSM Agent for EC2 scanning (or agentless scanning), and GuardDuty works without agents. Suppress known-benign findings with suppression rules rather than disabling detectors.
Real World Example
Scenario – cryptomining detected. GuardDuty flags CryptoCurrency:EC2/BitcoinTool.B!DNS on a web server in a development account. The finding reaches Security Hub in the Audit account and EventBridge starts an SSM Automation runbook that swaps the instance's security groups for a quarantine group, snapshots its EBS volumes and opens an OpsItem.
Investigators use CloudTrail and Detective to learn that a leaked access key created the instance. The key is revoked, an Inspector finding about an unpatched application is fixed through Patch Manager, and an SCP restricting large instance types is added.
Architecture Diagram
- 1GuardDuty and Inspector generate findings from logs and scans.
- 2Findings aggregate in Security Hub in the delegated administrator account.
- 3EventBridge filters high-severity findings.
- 4Targets notify responders and run automation to contain the resource.
Best Practices
- ✓Enable GuardDuty, Security Hub, Inspector and Config in all Regions and accounts via delegated admin.
- ✓Route high-severity findings through EventBridge to ticketing and automated containment.
- ✓Keep instances SSM-managed so Inspector and Patch Manager can work.
- ✓Define and rehearse incident response runbooks (contain, preserve, investigate, recover).
- ✓Use WAF managed rules and rate limits plus Shield Advanced for critical internet-facing apps.
Common Interview Questions
Exam Tips
SOA-C03 focus
- Threat detection from CloudTrail/Flow/DNS logs -> GuardDuty; CVE scanning -> Inspector; PII in S3 -> Macie.
- Aggregate and score compliance -> Security Hub (standards like CIS, FSBP).
- Block SQL injection or rate-limit -> WAF; DDoS -> Shield.
- React to findings automatically -> EventBridge with Lambda/SSM Automation.
Finished this lesson?
0 of 46 lessons done · 0% of the course

