Get started with Billing
See what your organization spends this month, create a budget that e-mails you, check what it watches, and delete it again, in about ten minutes.
Replace jane.doe@example.com with your own e-mail address and budget-id with the id of the budget you create in step 2. Nothing in this tutorial creates anything billable.
Prerequisites
- Permission for
billing:GetBillingSummary,billing:CreateBudget,billing:GetBudgetsandbilling:DeleteBudget. - In the console, the check of what a budget covers also needs
tags:ListTags. Forecast for the month and This month by service needbilling:GetCostAndUsage(without it they show "Nothing to forecast yet." and "Nothing billed this month yet."), and the Invoices list needsbilling:GetInvoices. - For the CLI steps, the dcloud CLI, signed in. For the API steps, an access key.
Step 1: See what you spend this month
- Open Billing.
The page shows Current month, Forecast for the month and Last month, then This month by service, Monthly spend and Invoices.
dcloud billing summary getGET /billing/api/summaryThe amounts are net, before discounts, credits and VAT. The CLI and the API answer in euro cents.
Step 2: Create a budget
A budget never stops anything by itself: it records an alert, and e-mails it, when spending reaches a percentage of its amount.
- Open Budgets, then choose Create budget.
- For Name, enter Tutorial.
- For Alert me at (EUR), enter 100.
- Leave Period at Monthly and What it covers at The whole organization.
- Leave Alert thresholds at
80,100, Forecast thresholds at100and Notification emails at your own address, which the form fills in. - Choose Create budget.
The budget appears in the list, with what it has used this month. Unlike the CLI and the API, the console also gives a monthly budget a forecast threshold of 100 % by default.
dcloud billing budgets create --name Tutorial --amount-cents 10000 --period monthly \
--notification-emails jane.doe@example.comPOST /billing/api/budgets
{ "name": "Tutorial", "amountCents": 10000, "period": "monthly", "notificationEmails": ["jane.doe@example.com"] }The answer is 201 with the budget and its id. Without alertThresholds it alerts at 80 % and
100 %.
Step 3: See what the budget watches
- Open Budgets.
Each budget shows the percentage used, the spend against the amount, the period, what it covers and the thresholds it alerts at.
dcloud billing budgets statusGET /billing/api/budgets/statusFor each budget, evaluation holds spendCents, percentUsed, the thresholds already crossed,
and, for a monthly budget, forecastCents. alerts lists the alerts fired this period.
Clean up
- Open Budgets.
- Choose the delete button of the budget Tutorial.
- Choose Delete.
dcloud billing budgets delete budget-idDELETE /billing/api/budgets/budget-idThe budget and the record of its alerts are gone. Your spending is unaffected.