Sub topic 15
Cost and operational best practices
This chapter assumes you have enabled GuardDuty and Security Hub, and that you know how detectors, protection plans, and delegated administrators work from the earlier chapters. It covers what drives the bill and which habits keep a detection pipeline manageable.
What drives cost
GuardDuty charges by usage, so cost follows how much activity your accounts generate. The main drivers are:
- Foundational data sources. CloudTrail management events, VPC Flow Logs, and DNS logs are billed by volume analyzed. A busy network costs more than a quiet one.
- Protection plans. Each plan has its own meter. Examples are S3 data events, EKS audit logs, malware scanning by gigabytes scanned, and Runtime Monitoring by vCPU or instance hours.
- Security Hub. Billing is based on the number of security checks run and the number of finding ingestion events.
Each service offers a free trial of about 30 days, and GuardDuty shows projected cost during the trial. Check current prices on the AWS pricing pages, because they change by Region and over time.
Measure before you tune
GuardDuty reports its own usage. This command breaks it down by data source for one detector:
DETECTOR_ID=$(aws guardduty list-detectors --query 'DetectorIds[0]' --output text)
aws guardduty get-usage-statistics \
--detector-id "$DETECTOR_ID" \
--usage-statistic-type SUM_BY_DATA_SOURCE \
--usage-criteria '{"DataSources":["FLOW_LOGS","CLOUD_TRAIL","DNS_LOGS"]}'Other statistic types, such as SUM_BY_ACCOUNT and TOP_RESOURCES, show which accounts or resources produce the most billable volume. Run the report monthly and look for one account or resource that dominates.
Control cost without losing coverage
- Enable plans on purpose. Turn on a protection plan only where the workload exists. Enable the EKS plans only in accounts that run EKS, and the RDS plan only where you use Aurora.
- Keep every Region on. Attackers often use Regions you never look at. GuardDuty is cheap in an idle Region because cost follows activity, so leaving it on costs little.
- Trim Security Hub scope. Each enabled control runs checks that are billed. Disable standards and controls that do not apply to you, such as a control for a service you do not use.
- Reduce noise upstream. Use suppression rules for known-benign findings. Suppressed findings are archived, which cuts alert fatigue and downstream processing such as Lambda invocations.
Operate it as a pipeline
Cost control is one part of keeping the pipeline healthy. These practices apply to the whole design:
- Manage GuardDuty and Security Hub from a delegated administrator account, and turn on auto-enable for new member accounts so no account is left uncovered.
- Aggregate Security Hub findings into one home Region so responders have a single place to look.
- Route by severity. Send high-severity findings to paging and automation, and send the rest to a ticket queue or a daily digest.
- Test rules and automation with
create-sample-findingsbefore you rely on them. - Give each remediation Lambda function a narrow IAM role that allows only the actions it performs.
- Review suppression rules and trusted IP lists regularly. A rule written a year ago may now hide a real threat.
Common mistakes
- Enabling every protection plan in every account on day one, then being surprised by the bill.
- Writing suppression rules that are too broad, such as archiving a whole finding type for all resources.
- Paying for Security Hub standards that nobody reviews.
- Never testing the automation path until a real incident.
Exercise
Your GuardDuty bill rose sharply last month. Name the command you would run first, and name two actions you could take to reduce cost without reducing coverage of the workloads you run.
Show answer
Run aws guardduty get-usage-statistics with a type such as SUM_BY_ACCOUNT or SUM_BY_DATA_SOURCE to find which account or data source grew. Then disable protection plans in accounts that do not run the matching workload (for example, EKS plans in accounts without EKS), and add suppression rules for known-benign findings to cut downstream processing. Keeping the detector enabled in every Region preserves coverage.