@@ -216,6 +216,9 @@ az group list -o table
216216
217217# List all resources in a resource group
218218az resource list -g DocumentStream -o table
219+
220+ # List resources in the AKS-managed resource group (VMs, disks, load balancers)
221+ az resource list -g MC_DocumentStream_DocumentStreamManagedCluster_westeurope -o table
219222```
220223
221224### AKS Cluster (Start / Stop)
@@ -226,15 +229,21 @@ compute billing. Storage (disks, IPs) still costs a small amount while stopped.
226229# Check if the cluster is running
227230az aks show -g DocumentStream -n DocumentStreamManagedCluster --query " powerState" -o tsv
228231
229- # Stop the cluster (saves ~$3-4 /day)
232+ # Stop the cluster (saves ~$5 /day in compute )
230233az aks stop -g DocumentStream -n DocumentStreamManagedCluster
231234
232- # Start the cluster (takes a few minutes)
235+ # Start the cluster (takes 3-5 minutes)
233236az aks start -g DocumentStream -n DocumentStreamManagedCluster
237+
238+ # Get kubectl credentials after starting
239+ az aks get-credentials -g DocumentStream -n DocumentStreamManagedCluster --overwrite-existing
234240```
235241
236242### PostgreSQL Flexible Server (Start / Stop)
237243``` bash
244+ # List servers
245+ az postgres flexible-server list -o table
246+
238247# Check status
239248az postgres flexible-server show -g DocumentStream -n < server-name> --query " state" -o tsv
240249
@@ -245,17 +254,57 @@ az postgres flexible-server stop -g DocumentStream -n <server-name>
245254az postgres flexible-server start -g DocumentStream -n < server-name>
246255```
247256
257+ ### Check Costs (az rest)
258+ The ` az costmanagement query ` CLI command was removed by Microsoft in 2023. Use ` az rest `
259+ to call the Cost Management API directly:
260+
261+ ``` bash
262+ # Cost breakdown by service, per day, this month
263+ SUB_ID=$( az account show --query id -o tsv) && az rest --method post \
264+ --url " https://management.azure.com/subscriptions/${SUB_ID} /resourceGroups/DocumentStream/providers/Microsoft.CostManagement/query?api-version=2025-03-01" \
265+ --body ' {
266+ "type": "Usage",
267+ "dataset": {
268+ "aggregation": {
269+ "totalCost": { "name": "PreTaxCost", "function": "Sum" }
270+ },
271+ "granularity": "Daily",
272+ "grouping": [{ "name": "ServiceName", "type": "Dimension" }]
273+ },
274+ "timeframe": "MonthToDate"
275+ }'
276+ ```
277+
278+ Other useful groupings (replace ` ServiceName ` above):
279+ - ` ResourceType ` — group by resource type (VMs, disks, LB, etc.)
280+ - ` ResourceId ` — group by individual resource
281+ - ` MeterCategory ` — group by billing meter category
282+
283+ Valid timeframes: ` MonthToDate ` , ` WeekToDate ` , ` TheLastMonth ` , ` BillingMonthToDate ` .
284+
285+ ** Note:** The Cost Management API and ` az consumption usage list ` both return empty results
286+ for free credit / sponsorship subscriptions. For these subscription types, check costs in the
287+ Azure Portal: ** Cost Management + Billing** > ** Azure credits** or ** Subscriptions** >
288+ your subscription > ** Cost analysis** .
289+
248290### Cost Awareness
249- | Resource | Running cost | Stopped cost |
250- | ---| ---| ---|
251- | AKS (3x Standard_B2ms) | ~ $3-4/day | ~ $0.30/day (disks) |
252- | PostgreSQL (Burstable B1ms) | ~ $0.50/day | ~ $0.01/day (storage) |
253- | ACR (Basic tier) | ~ $0.17/day | ~ $0.17/day |
254- | Blob Storage | Pennies | Pennies |
255- | Static public IPs | ~ $0.12/day | ~ $0.12/day |
291+
292+ Our setup: 2x Standard_B2s_v2 nodes, Free tier AKS control plane, Standard Load Balancer.
293+
294+ | Resource | $/hour | $/day (running) | $/day (stopped) |
295+ | ---| ---| ---| ---|
296+ | 2x Standard_B2s_v2 (2 vCPU, 8 GiB each) | $0.192 | $4.61 | $0 |
297+ | 2x OS Disk (128 GiB Standard SSD) | — | $0.64 | $0.64 |
298+ | Standard Load Balancer (first 5 rules) | $0.025 | $0.60 | $0.60 |
299+ | Public IP | $0.004 | $0.10 | $0.10 |
300+ | ACR (Basic tier) | — | $0.17 | $0.17 |
301+ | Blob Storage | — | Pennies | Pennies |
302+ | ** Total** | | ** ~ $6.12** | ** ~ $1.51** |
303+
304+ If PostgreSQL Flexible Server is also running (Burstable B1ms): add ~ $1.20/day.
256305
257306** Rule of thumb:** Stop AKS and PostgreSQL when not actively working. Start them 5-10 minutes
258- before you need them.
307+ before you need them. The cluster takes 3-5 minutes to start.
259308
260309---
261310
0 commit comments