GetCostAndUsage
Source:
src/AWS/CostExplorer/GetCostAndUsage.ts
Runtime binding for ce:GetCostAndUsage.
Query cost and usage metrics (UnblendedCost, UsageQuantity, …)
filtered and grouped by dimension over a time range — the core Cost
Explorer query. Provide the implementation with
Effect.provide(AWS.CostExplorer.GetCostAndUsageHttp).
Querying Cost and Usage
Section titled “Querying Cost and Usage”// init — account-level binding takes no resourceconst getCostAndUsage = yield* AWS.CostExplorer.GetCostAndUsage();
// runtimeconst result = yield* getCostAndUsage({ TimePeriod: { Start: "2026-06-01", End: "2026-07-01" }, Granularity: "MONTHLY", Metrics: ["UnblendedCost"],});const total = result.ResultsByTime?.[0]?.Total?.UnblendedCost?.Amount;