GetUsageStatistics - Amazon GuardDuty

GetUsageStatistics

Lists Amazon GuardDuty usage statistics over the last 30 days for the specified detector ID. For newly enabled detectors or data sources the cost returned will include only the usage so far under 30 days, this may differ from the cost metrics in the console, which projects usage over 30 days to provide a monthly cost estimate. For more information see Understanding How Usage Costs are Calculated.

Request Syntax

POST /detector/detectorId/usage/statistics HTTP/1.1 Content-type: application/json { "maxResults": number, "nextToken": "string", "unit": "string", "usageCriteria": { "accountIds": [ "string" ], "dataSources": [ "string" ], "resources": [ "string" ] }, "usageStatisticsType": "string" }

URI Request Parameters

The request uses the following URI parameters.

detectorId

The ID of the detector that specifies the GuardDuty service whose usage statistics you want to retrieve.

Length Constraints: Minimum length of 1. Maximum length of 300.

Required: Yes

Request Body

The request accepts the following data in JSON format.

maxResults

The maximum number of results to return in the response.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 50.

Required: No

nextToken

A token to use for paginating results that are returned in the response. Set the value of this parameter to null for the first request to a list action. For subsequent calls, use the NextToken value returned from the previous request to continue listing results after the first page.

Type: String

Required: No

unit

The currency unit you would like to view your usage statistics in. Current valid values are USD.

Type: String

Required: No

usageCriteria

Represents the criteria used for querying usage.

Type: UsageCriteria object

Required: Yes

usageStatisticsType

The type of usage statistics to retrieve.

Type: String

Valid Values: SUM_BY_ACCOUNT | SUM_BY_DATA_SOURCE | SUM_BY_RESOURCE | TOP_RESOURCES

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "nextToken": "string", "usageStatistics": { "sumByAccount": [ { "accountId": "string", "total": { "amount": "string", "unit": "string" } } ], "sumByDataSource": [ { "dataSource": "string", "total": { "amount": "string", "unit": "string" } } ], "sumByResource": [ { "resource": "string", "total": { "amount": "string", "unit": "string" } } ], "topResources": [ { "resource": "string", "total": { "amount": "string", "unit": "string" } } ] } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

nextToken

The pagination parameter to be used on the next list operation to retrieve more items.

Type: String

usageStatistics

The usage statistics object. If a UsageStatisticType was provided, the objects representing other types will be null.

Type: UsageStatistics object

Errors

For information about the errors that are common to all actions, see Common Errors.

BadRequestException

A bad request exception object.

HTTP Status Code: 400

InternalServerErrorException

An internal server error exception object.

HTTP Status Code: 500

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: