AWS Cost Explorer icon

AWS Cost Explorer

Get cost and usage data from AWS Cost Explorer

Actions2

  • Cost and Usage Actions
  • Dimension Values Actions

Overview

This node integrates with AWS Cost Explorer to retrieve cost and usage data. It is designed to help users analyze their AWS spending over specified time periods, broken down by various dimensions such as service or linked account. The node supports fetching detailed cost and usage reports, dimension values for filtering, and total cost summaries.

Common scenarios include:

  • Monitoring monthly or daily AWS costs to optimize budgets.
  • Filtering costs by specific AWS services to identify expensive resources.
  • Grouping cost data by service to understand spending distribution.
  • Retrieving dimension values to dynamically build filters or reports.

Practical example: A user wants to get the monthly unblended cost of all AWS services from January 1 to January 31, grouped by service name, to review which services contributed most to their bill.

Properties

Name Meaning
Start Date The start date for the cost/usage query in YYYY-MM-DD format (required).
End Date The end date for the cost/usage query in YYYY-MM-DD format (required).
Granularity The granularity of the data returned. Options: Daily, Monthly, Hourly.
Metrics The metrics to retrieve. Options: Blended Cost, Unblended Cost, Usage Quantity.
Service Filter Optional filter to restrict results to a specific AWS service by name (e.g., "Amazon EC2").
Group By Service Boolean flag to group results by service name (true/false).

Output

The node outputs an array of JSON objects representing the response from AWS Cost Explorer API calls. For the "Get" operation on "Cost and Usage", the output includes detailed cost and usage data structured according to AWS's response schema, typically containing:

  • TimePeriod: The queried date range.
  • ResultsByTime: An array of cost/usage data grouped by time intervals.
  • Groups (if grouping enabled): Cost data grouped by service or other dimensions.
  • Metrics: Values for requested metrics like UnblendedCost or UsageQuantity.

If the node fetches dimension values or total cost, the output JSON reflects those respective AWS API responses.

The node does not output binary data.

Dependencies

  • Requires valid AWS credentials with permissions to access AWS Cost Explorer.
  • Needs configuration of an API key credential providing AWS Access Key ID, Secret Access Key, and region.
  • Uses AWS SDK for JavaScript v3 (@aws-sdk/client-cost-explorer) internally.

Troubleshooting

  • Common issues:

    • Invalid or missing AWS credentials will cause authentication errors.
    • Incorrect date formats or invalid date ranges may result in API errors.
    • Requesting unsupported metrics or granularity can lead to failures.
    • Filtering by a non-existent service name returns empty results.
  • Error messages:

    • Authentication errors: Verify AWS credentials and permissions.
    • Validation errors: Check that dates are in YYYY-MM-DD format and that the end date is after the start date.
    • API throttling: If requests exceed AWS limits, consider adding delays or reducing request frequency.
  • To continue processing multiple items even if some fail, enable the node’s "Continue On Fail" option.

Links and References

Discussion