AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the GetCostAndUsage operation. Retrieve cost and usage metrics for your account. You can specify which cost and usage-related metric, such as BlendedCosts or UsageQuantity, that you want the request to return. You can also filter and group your data by various dimensions, such as SERVICE or AZ, in a specific time range. See the GetDimensionValues action for a complete list of the valid dimensions. Master accounts in an organization have access to all member accounts.

Inheritance Hierarchy


Namespace: Amazon.CostExplorer.Model
Assembly: AWSSDK.CostExplorer.dll
Version: 3.x.y.z


public class GetCostAndUsageRequest : AmazonCostExplorerRequest

The GetCostAndUsageRequest type exposes the following members


Public Method GetCostAndUsageRequest()


Public Property Filter Amazon.CostExplorer.Model.Expression

Gets and sets the property Filter.

Filters AWS costs by different dimensions. For example, you can specify SERVICE and LINKED_ACCOUNT and get the costs associated with that account's usage of that service. You can nest Expression objects to define any combination of dimension filters. For more information, see Expression.

Public Property Granularity Amazon.CostExplorer.Granularity

Gets and sets the property Granularity.

Sets the AWS cost granularity to MONTHLY or DAILY. If Granularity isn't set, the response object doesn't include the Granularity, either MONTHLY or DAILY.

Public Property GroupBy System.Collections.Generic.List<Amazon.CostExplorer.Model.GroupDefinition>

Gets and sets the property GroupBy.

You can group AWS costs using up to two different groups, either dimensions, tag keys, or both.

When you group by tag key, you get all tag values, including empty strings.


Public Property Metrics System.Collections.Generic.List<System.String>

Gets and sets the property Metrics.

Which metrics are returned in the query. For more information about blended and unblended rates, see Why does the "blended" annotation appear on some line items in my bill?.

Valid values are BlendedCost, UnblendedCost, and UsageQuantity.

If you return the UsageQuantity metric, the service aggregates all usage numbers without taking into account the units. For example, if you aggregate usageQuantity across all of EC2, the results aren't meaningful because EC2 compute hours and data transfer are measured in different units (for example, hours vs. GB). To get more meaningful UsageQuantity metrics, filter by UsageType or UsageTypeGroups.

Public Property NextPageToken System.String

Gets and sets the property NextPageToken.

The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Public Property TimePeriod Amazon.CostExplorer.Model.DateInterval

Gets and sets the property TimePeriod.

Sets the start and end dates for retrieving AWS costs. The start date is inclusive, but the end date is exclusive. For example, if start is 2017-01-01 and end is 2017-05-01, then the cost and usage data is retrieved from 2017-01-01 up to and including 2017-04-30 but not including 2017-05-01.

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms