Cloud billing alerts

How do I send cloud billing alerts to Slack or Discord?

You can route cloud billing alerts to Slack or Discord using each provider's native webhook or pub-sub plumbing, but the setup varies wildly between platforms. AWS Budgets alerts reach Slack through Amazon SNS and Amazon Q Developer free of charge, while Azure takes 8 to 24 hours to post cost data before evaluating budgets, and Google Cloud requires a Pub/Sub topic with base64 decoding before you can send a readable message to a chat channel.

If you don't want to build and host custom middleware functions just to parse JSON payloads across multiple vendors, third-party trackers can monitor your bills directly. Here is how each native option works, what payloads they expect, and where the setup breaks down.

Setting up Slack and Discord incoming webhooks

Before configuring alerts in your cloud consoles, you need an endpoint that accepts incoming HTTP POST requests.

To create a Slack incoming webhook, open your Slack app's management dashboard, choose Incoming Webhooks, and toggle Activate Incoming Webhooks to on. Click the Add New Webhook to Workspace button, which runs an install flow that generates your webhook URL without writing custom code. If you want the webhook to post into a private channel, you must be a member of that private channel before authorizing it.

The resulting URL appears under Webhook URLs for Your Workspace in this format:

https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Each Slack webhook URL is tied to a single user and a single channel. When posting messages, you cannot override the channel, username, or icon; it always inherits those values from the app configuration. Don't commit this URL to public repositories; Slack actively searches out and revokes leaked secrets.

A basic message requires an HTTP POST request with Content-type: application/json and a JSON body containing a text field:

curl -X POST -H 'Content-type: application/json' \
--data '{"text":"Billing alert triggered."}' \
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

Slack returns an HTTP 200 status with a plain text ok body when the message posts. If your request fails, Slack returns status codes like HTTP 400 Bad Request, HTTP 403 Forbidden, and HTTP 404 Not Found. Common response errors include invalid_payload when JSON is malformed or unescaped, no_text when the text attribute is missing, and too_many_attachments if you pass more than the maximum limit of 100 attachments. You can also include a blocks array alongside the text field if you want Block Kit visual components.

In Discord, webhook setup takes three steps:

  1. Open Server Settings and go to the Integrations tab.
  2. Click the Create Webhook button.
  3. Edit the webhook name, pick your target text channel from the dropdown list, and save.

Discord webhooks accept HTTP POST requests and expect application/json.

AWS: Budgets, SNS, and Amazon Q Developer for Slack

AWS Budgets lets you monitor costs, usage, and Reserved Instance or Savings Plans coverage. Monitoring and receiving notifications on AWS Budgets is free of charge. You can track thresholds based on actual spending or forecasted costs.

To send alerts to Slack, AWS uses Amazon Q Developer rather than direct outgoing webhooks:

  1. In the AWS Budgets console, choose Configure alerts on a budget and attach an Amazon SNS topic as an alert recipient. Ensure your SNS topic policy explicitly grants AWS Budgets permission to publish to it.
  2. Add Amazon Q Developer to your Slack workspace.
  3. In the AWS console, open Amazon Q Developer in chat applications, click Configure new client, select Slack, and click Configure.
  4. Select your Slack workspace from the dropdown list in the top right and click Allow.
  5. Provide a configuration name. This name must be unique across your AWS account and cannot be edited later.
  6. Under IAM role, pick Notification permissions from the policy templates. This template gives Read and List permissions for CloudWatch alarms, events, logs, and Amazon SNS topics. Role names accept only alphanumeric characters (a-z, A-Z, 0-9).
  7. Select the Amazon SNS topics to monitor. You can subscribe to topics across multiple AWS Regions, but at least one must match the SNS topic configured on your budget.

Avoid toggling Publish logs to Amazon CloudWatch Logs unless needed; it incurs an additional CloudWatch Logs charge. Also note that action-enabled budgets (which alter IAM policies or resources) cost $0.10 per day after your first two free action-enabled budgets. AWS Budgets Reports cost $0.01 for each delivered email report.

If you prefer threshold alarms on raw metrics, you can use CloudWatch billing alarms. First, open Billing Preferences in the AWS Billing and Cost Management console, click Edit by Alert preferences, select Receive CloudWatch Billing Alerts, and save. Next, switch your console region to US East (N. Virginia), where worldwide billing metric data is stored. Under CloudWatch Alarms, select the EstimatedCharges metric in the Total Estimated Charge namespace. The documented configuration uses Maximum for the statistic, a 6 hours period, and a static threshold Greater than your dollar limit. These alarms trigger only on current cumulative billing and don't project month-to-date trends. For more detail on native threshold configurations, see How do I set up AWS billing alerts that warn me before the bill gets out of hand?.

Google Cloud: Budgets and Pub/Sub delivery

Google Cloud doesn't offer direct chat webhooks for billing alerts. When you create a budget in Cloud Billing, default alert thresholds are set at 50%, 90%, and 100% of the budget amount based on Actual spend. You can also configure thresholds against Forecasted spend, unless your budget uses a custom time range. Each Cloud Billing account supports up to 50,000 budgets.

In Cloud Monitoring, you can link up to five email notification channels to a budget. However, Cloud Monitoring only supports Email notification channels for Cloud Billing budget alerts; other notification channel types aren't supported.

To route Google Cloud budget alerts to Slack or Discord, you must publish to a Pub/Sub topic and handle message translation yourself:

  1. Ensure your user has the Billing Account Costs Manager or Billing Account Administrator role on the billing account, and the Pub/Sub Admin role on the target project (or custom permissions pubsub.topics.setIamPolicy and pubsub.topics.list).
  2. If your organization enforces the iam.allowedPolicyMemberDomains constraint, exempt the project containing the Pub/Sub topic from that policy.
  3. In your budget settings, enable programmatic notifications and link your Pub/Sub topic.
  4. Keep at least one threshold alert rule and at least one email recipient enabled. If you remove all thresholds, the budget generates programmatic messages but omits the alertThresholdExceeded and forecastThresholdExceeded keys.

Pub/Sub messages arrive multiple times per day with current status, even if your account has no usage. Pub/Sub provides at-least-once delivery, so messages may arrive out of order or duplicated.

Every notification includes three base attributes: billingAccountId, budgetId, and schemaVersion (such as 1.0). The data payload is a base64-encoded UTF-8 string containing a JSON object with properties like costAmount, budgetAmount, budgetDisplayName, currencyCode, and alertThresholdExceeded (formatted as a decimal, such as 0.9 for 90%).

Because this payload is base64-encoded and doesn't match Slack's {"text": "..."} format, you must deploy an intermediate service to decode it and forward a POST request to your webhook. If delivery fails due to topic misconfiguration or deleted resources, Google Cloud won't notify you. Expect a delay between real resource consumption and cost reporting to Cloud Billing; initial budget notifications can take several hours to arrive. For a deeper look at managing these delays, read How do I set up Google Cloud budget alerts that reach me in time?.

Azure: Action groups and cost evaluation cycles

In Azure Cost Management, you can configure budget alerts based on actual or forecasted cost at the Management group, Subscription, or Resource group scope. (Enterprise Agreement accounts also support Billing account, Department, and Enrollment account scopes.)

Budgets require at least one cost threshold and an email address, accepting up to five thresholds and five emails per budget. Alert limits can be set from 0.01% to 1000% of the budget amount. When spending crosses a threshold, notifications fire, but your resources aren't stopped and consumption continues.

Azure supports Action groups on budgets, but only at Subscription and Resource group scopes. To configure an alert via the Azure CLI:

az consumption budget create-with-rg \
  --amount 100 \
  --budget-name TestCLIBudget \
  -g $rg \
  --category Cost \
  --time-grain Monthly \
  --time-period '{"start-date":"2024-06-01","end-date":"2025-12-31"}' \
  --notifications "{\"Key1\":{\"enabled\":\"true\", \"operator\":\"GreaterThanOrEqualTo\", \"contact-emails\":[], \"threshold\":80.0, \"contact-groups\":[\"$ActionGroupId\"]}}"

Note that budgets created using the Azure PowerShell module (New-AzConsumptionBudget) do not send notifications; Microsoft recommends using the REST APIs to create and edit budgets because CLI commands might not support the latest API versions.

Action groups can trigger HTTP webhooks directly, regardless of whether the common alert schema is enabled. However, Azure's billing pipeline isn't instantaneous:

  • Cost and usage data is typically available within 8 to 24 hours.
  • Budgets are evaluated against these costs once every 24 hours.
  • Once evaluated, threshold email notifications are normally sent within an hour.

If your workloads spike unexpectedly, Azure's daily evaluation cycle means you won't see an alert until the next evaluation window runs.

Cloudflare: Direct webhook destinations

Cloudflare provides native webhook support for notifications, including built-in handling for Slack and Discord.

Under Alerts > Destinations in the Cloudflare dashboard, you can add a webhook by giving it a name and pasting your webhook URL. For Slack and Discord URLs, Cloudflare automatically parses the embedded secret without requiring manual secret configuration. You can test the destination immediately with the Save and Test option. Once created, you can only edit the destination's name or delete it.

Cloudflare offers two ways to monitor spend:

  1. Budget alerts: Configured under Manage Account > Billing > Billable Usage. This evaluates cumulative account-wide usage-based spend against a dollar threshold. It sends a single email when crossed, resets at the beginning of each billing period, and doesn't pause usage.
  2. Usage notifications: Configured under Alerts > Platform Notifications. These track individual product usage (such as total bytes for Argo Smart Routing or total DNS queries for Load Balancing). These Usage Based Billing notifications require a Professional plan or higher and apply to Pay-as-you-go accounts. (Image Transformation Notifications are available on all plans to alert when free quotas are exceeded.)

Cloudflare dispatches webhook alerts from its published IP ranges to publicly resolvable IP addresses on port 80 or 443. If you want alerts sent to a private IP address or different port, you must route them through a Cloudflare Tunnel or forward them using Cloudflare Workers. For details on tracking usage charges across services like Workers and R2, see How do I get alerted when Cloudflare usage-based billing jumps?.

Comparing native alerting routes

ProviderDirect Slack/Discord Webhook?Routing MechanismReporting Delay / CadenceExtra Costs
AWS BudgetsYes (Slack only)Amazon SNS to Amazon Q Developer in chat appsSeveral times daily (CloudWatch 6-hour evaluation)Free for monitoring; $0.10/day per action-enabled budget after the first 2 free action-enabled budgets
Google CloudNoPub/Sub topic to custom consumer functionUpdates multiple times per day; initial delay of several hoursPub/Sub consumption charges; Cloud Monitoring restricted to email only
Azure BudgetsYes (via Action Groups)Action Groups (Subscription and Resource Group scopes)Data available in 8 to 24 hours; evaluated every 24 hoursFree for budget evaluations; EA required for department quota alerts
CloudflareYesAlerts Destinations (native Slack/Discord URL parsing)Usage alerts trigger on product thresholds; budget alerts once per cycleUsage-based billing notifications require a Professional plan or higher on Pay-as-you-go accounts

The unified route: Costbrake

Wiring separate notification pipelines for every cloud provider takes time and leaves gaps when you add AI APIs and developer infrastructure. AWS requires IAM roles and Q Developer, Google Cloud requires Pub/Sub decoders, Azure lags by up to 24 hours, and platforms like OpenAI or Anthropic don't offer native chat budget webhooks at all.

Costbrake monitors spend across 23 providers - including AWS, Google Cloud, Azure, Cloudflare, OpenAI, Anthropic, Vercel, Supabase, and GitHub - without custom glue code.

Instead of waiting for daily budget evaluations, Costbrake checks spending hourly on the Free plan ($0 for 2 connections, 3 budgets, and email alerts) and every 5 minutes on the Pro plan ($12 a month or $120 a year, covering 10 connections and 50 budgets). During a detected spike, check frequency accelerates up to every minute.

You receive alerts for:

  • Spikes: An hour that costs more than 3x your 7-day baseline and at least $5 above normal.
  • Thresholds: Budget alerts at 50%, 80%, and 100% of your configured limit.
  • Forecasts: Warnings when month-to-date spend plus the run rate over the last 72 hours projects that you'll exceed your monthly budget. (See How do I forecast my cloud bill before the month ends?.)
  • New charges: When an unfamiliar service racks up more than $1 within the billing cycle.

On the Pro plan, alerts post directly to Slack, Discord, or custom signed webhooks. Pro also includes optional, reversible brakes for 18 providers to stop runaways - like throttling a Lambda to zero, stopping an EC2 instance, freezing an OpenAI spend limit at $0.01, or detaching Cloudflare custom routes. A brake only runs when an admin manually confirms it; it never triggers automatically.

Every workspace starts with a 14-day Pro trial without requiring a credit card. You can configure your monitors by hand or point an AI coding tool to agent setup. Review full tier details on Costbrake pricing.

Questions and answers

Can I send AWS budget alerts directly to Discord using native AWS tools?

AWS Budgets integrates natively with Amazon Q Developer, which supports Slack, Microsoft Teams, and Amazon Chime, but does not support Discord webhooks directly. To route AWS budget notifications to Discord, you have to subscribe an AWS Lambda function or external endpoint to your budget's Amazon SNS topic and forward the payload as an HTTP POST request.

Why can't I link a Slack webhook directly into Google Cloud Monitoring for billing?

Cloud Monitoring limits Cloud Billing budget alerts strictly to Email notification channels; other notification channels such as Webhooks or Slack are unsupported. To send Google Cloud budget events to Slack, you must enable programmatic notifications, export the messages to a Google Cloud Pub/Sub topic, and decode the base64-encoded payload with your own code.

Do Azure budget alerts stop my virtual machines when spending limits are exceeded?

No, exceeding an Azure budget threshold triggers notifications to your configured email addresses or action groups, but it doesn't affect active resources or pause consumption. Any automated mitigation requires configuring specific actions or automation runbooks inside your action group.

What happens if my Slack incoming webhook URL is committed to a public GitHub repo?

Slack continuously scans public version control repositories for exposed webhook URLs and revokes compromised tokens immediately. Once revoked, any cloud provider attempting to post alerts to that URL receives an HTTP error, and you will need to generate a new webhook in your Slack app dashboard.

Does Cloudflare send billing alerts to private network IP addresses?

Generic webhook alerts from Cloudflare are only dispatched to publicly resolvable IP addresses on port 80 or 443. If your alert intake endpoint lives behind a firewall, on a private IP, or on a non-standard port, you must route the alert through a Cloudflare Tunnel or receive and proxy the payload using Cloudflare Workers.

Sources

Updated