Skip to content

CICD-458 · Cloud budget validation ​

Encyclopedia · FinOps and resource optimization · All snippets

Previous · CICD-457 · Next · CICD-459

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites authorized read reports, explicit pricing period and reviewed ownership for cleanup.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters AWS_ACCOUNT_ID, BUDGET_NAME.

2. Copy the snippet ​

bash
aws budgets describe-budget --account-id "${AWS_ACCOUNT_ID:?}" --budget-name "${BUDGET_NAME:?}" --output json | jq -e '.Budget | (.CalculatedSpend.ActualSpend.Amount|tonumber) <= (.BudgetLimit.Amount|tonumber)'

3. How it works ​

The CLI reads the selected account's configured budget and the available spend data. The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.

4. Verify the result ​

Use the correct account and acknowledge delayed spend data.

Validation syntax-validated (Bash parse). Status definitions.