logoStacktape docs


Budget ControlWork in progress
Work in progress

Introduction

Budget control allows you to watch your spending and configure email notifications when limits/thresholds are exceeded.

To use budget control, you first need to enable Stacktape cost allocation tags.

Budget control currently only watches prices for AWS resources. It does not aggregate prices for resources managed by third-party providers (such as MongoDb Atlas Clusters or Upstash Redis).

If you're using custom-defined AWS Cloudformation resources configured in (cloudformationResources section), these resources might not be correctly attributed to your stack and therefore will not add to the spend.

This is due to AWS Cloudformation not propagating tags to all resources of your stack (AWS limitation).

All Stacktape-managed resource are correctly attributed to the spend.

Usage

BudgetControl  API reference
limit
Required

The amount of cost (in USD) that you want to track with budget.

Type: number

  • Percentage thresholds for configured notifications are relative to this limit.
notifications

Notification that are sent when a notification condition is met

Type: Array of BudgetNotification

  • Notification sends email(s) to specified email recipients when the notification condition is met.
  • Notifications are triggered:
    • when the actual spend is over specified threshold.
    • when the forecasted spend is forecasted to get over specified threshold.
  • You can configure up to 5 notifications per stack.

Copy

serviceName: my-service
budgetControl:
limit: 100 # USD

Notifications

BudgetNotification  API reference
Parent API reference: BudgetControl
emails
Required

List of email recipients which will receive the notification

Type: Array of string

  • You can specify up to 10 email recipients per notification
budgetType
Default: ACTUAL

Whether the notification applies to how much you have spent (ACTUAL) or to how much you are forecasted to spend (FORECASTED).

Type: string ENUM

Possible values: ACTUALFORECASTED

  • FORECASTED - A forecast is a prediction of how much you will use AWS services over the following month. This forecast is based on your past usage.
  • ACTUAL - An actual budget that you already spent in this month (as billed by AWS).

WARNING: AWS requires approximately 5 weeks of usage data to generate budget forecasts. If you set a notification to trigger based on a FORECASTED amount, this notification isn't triggered until you have enough historical usage information. Therefore we advise to use forecast notifications mainly for long running production stacks. To learn more about budgets, refer to AWS docs

thresholdPercentage
Default: 100

Percentage threshold. When this threshold is crossed, the notification is triggered.

Type: number

  • Example:
    • IF you set:
      • limit to 200 dollars,
      • budgetType to FORECASTED,
      • thresholdPercentage to 80 percent,
    • THEN the notification is triggered once your forecasted spend goes over 160 dollars (80% of 200).
  • Notification sends email(s) to specified email recipients when the notification condition is met.
  • Notifications are triggered:
    • when the actual spend is over specified threshold.
    • when the forecasted spend is forecasted to get over specified threshold.
  • You can configure up to 5 notifications per stack.

Actual budget type notifications

If you configure budgetType to ACTUAL (or don't specify budget type), the notification is triggered when the actual spend goes over your budget limit (100$ in the following example).

Copy

serviceName: my-service
budgetControl:
limit: 100 # USD
notifications:
- emails:
- mail1@example.com
- mail2@example.com

Forecasted budget type notifications

If you configure budgetType to FORECASTED, the notification is triggered when the forecasted spend goes over your budget limit (80$ in the following example).

Copy

serviceName: my-service
budgetControl:
limit: 100
notifications:
- budgetType: FORECASTED
thresholdPercentage: 80
emails:
- mail1@example.com

AWS requires approximately 5 weeks of usage data to generate budget forecasts. If you set a notification to trigger based on a FORECASTED amount, this notification isn't triggered until you have enough historical usage information. Therefore we advise using forecasted notifications mainly for long-running production stacks. To learn more about budgets, refer to AWS docs

Need help? Ask a question on SlackDiscord or info@stacktape.com.