Skip to content

GetCostAndUsageWithResources

Source: src/AWS/CostExplorer/GetCostAndUsageWithResources.ts

Runtime binding for ce:GetCostAndUsageWithResources.

Query cost and usage at individual-resource granularity (EC2 instance ids etc.). Requires resource-level data to be enabled in Cost Explorer settings and only covers the trailing 14 days. Provide the implementation with Effect.provide(AWS.CostExplorer.GetCostAndUsageWithResourcesHttp).

// init — account-level binding takes no resource
const getCostAndUsageWithResources = yield* AWS.CostExplorer.GetCostAndUsageWithResources();
// runtime
const result = yield* getCostAndUsageWithResources({
TimePeriod: { Start: "2026-07-01", End: "2026-07-14" },
Granularity: "DAILY",
Filter: { Dimensions: { Key: "SERVICE", Values: ["Amazon Elastic Compute Cloud - Compute"] } },
Metrics: ["UnblendedCost"],
});