Run the GetUsageStatistics API operation using the
credentials of GuardDuty administrator account account. Provide the following information to
run the command:
-
(Required) provide the Regional GuardDuty detector ID of the account
for which you want to retrieve the statistics.
-
(Required) provide one of the types of statistics to retrieve:
SUM_BY_ACCOUNT | SUM_BY_DATA_SOURCE | SUM_BY_RESOURCE |
SUM_BY_FEATURE | TOP_ACCOUNTS_BY_FEATURE
.
Currently, TOP_ACCOUNTS_BY_FEATURE
does not support
retrieving usage statistics for
RDS_LOGIN_EVENTS
.
-
(Required) provide one or more data sources or features to query
your usage statistics.
-
(Optional) provide a list of account IDs for which you want to
retrieve usage statistics.
You can also use the Amazon Command Line Interface. The following command is an example about
retrieving the usage statistics for all the data sources and features,
calculated by accounts. Make sure to replace the detector-id
with your own valid detector ID. For standalone accounts, this command
returns the usage cost over the past 30 days for your account only. If you
are a GuardDuty administrator account with member accounts, you see costs listed by account
for all members.
To find the detectorId
for your account and current Region, see the
Settings page in the https://console.amazonaws.cn/guardduty/ console,
or run the ListDetectors API.
Replace SUM_BY_ACCOUNT
by the type with which you want to
calculate the usage statistics.
To monitor cost for data sources
only
aws guardduty get-usage-statistics --detector-id 12abc34d567e8fa901bc2d34e56789f0
--usage-statistic-type SUM_BY_ACCOUNT
--usage-criteria '{"DataSources":["FLOW_LOGS", "CLOUD_TRAIL", "DNS_LOGS", "S3_LOGS", "KUBERNETES_AUDIT_LOGS", "EC2_MALWARE_SCAN"]}'
To monitor cost for features
aws guardduty get-usage-statistics --detector-id 12abc34d567e8fa901bc2d34e56789f0
--usage-statistic-type SUM_BY_ACCOUNT
--usage-criteria '{"Features":["FLOW_LOGS", "CLOUD_TRAIL", "DNS_LOGS", "S3_DATA_EVENTS", "EKS_AUDIT_LOGS", "EBS_MALWARE_PROTECTION", "RDS_LOGIN_EVENTS", "LAMBDA_NETWORK_LOGS", "EKS_RUNTIME_MONITORING", "FARGATE_RUNTIME_MONITORING", "EC2_RUNTIME_MONITORING"]}'