Overview
The AWS Cost Explorer node's "Get Cost Forecast" operation retrieves a forecast of how much Amazon Web Services (AWS) predicts you will spend over a specified time period, based on your past costs. This is useful for budgeting, cost monitoring, and financial planning within AWS environments.
Common scenarios:
- Predicting future AWS spending for a project or department.
- Automating budget alerts in workflows.
- Integrating cost forecasts into dashboards or reports.
Practical example:
A DevOps team schedules this node to run weekly, forecasting the next month's AWS costs and sending the results to Slack for review.
Properties
| Name | Meaning |
|---|---|
| Time Start | The start date for retrieving AWS cost forecasts. Data for this date is included. |
| Time End | The end date for retrieving AWS cost forecasts. Data for this date is excluded. |
| Granularity | How the forecasted costs are broken down. Options: DAILY (by day), MONTHLY (by month), HOURLY (by hour). |
| Metrics | The metrics to include in the output. You can specify one or more metrics (e.g., "BlendedCost", "UnblendedCost", "AmortizedCost"). |
Output
The node outputs a json object containing the AWS Cost Explorer forecast response. The structure typically includes:
{
"Total": { /* Forecasted total cost data */ },
"ForecastResultsByTime": [
{
"TimePeriod": { "Start": "...", "End": "..." },
"MeanValue": "...",
"PredictionIntervalLowerBound": "...",
"PredictionIntervalUpperBound": "..."
}
// ...more entries per granularity
]
// ...other AWS response fields
}
- Total: The overall forecasted cost for the period.
- ForecastResultsByTime: An array with forecasted values for each time interval (daily, monthly, or hourly).
- Other fields may be present depending on AWS API responses.
Dependencies
- AWS Account: Requires valid AWS credentials (Access Key ID, Secret Access Key, and Region) configured in n8n.
- n8n Credentials: Must set up an "aws" credential in n8n.
- External Service: Uses AWS Cost Explorer API via the
aws-sdkpackage.
Troubleshooting
Common issues:
- Invalid credentials: If AWS keys or region are incorrect, authentication will fail.
- Missing permissions: The AWS user must have permission to access Cost Explorer APIs.
- Date errors: If "Time Start" is after "Time End", or dates are not in the correct format (
YYYY-MM-DD), AWS may return errors. - Unsupported metric: If an invalid metric is provided, AWS will reject the request.
Error messages:
Operation "..." not supported!: Ensure you selected a valid operation.- AWS SDK errors (e.g., "User is not authorized"): Check IAM permissions and credentials.
- Date format errors: Use ISO date strings (
YYYY-MM-DD).