Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(ops): restore AWS Usage helper credential fallback (#784)

Aurora Capital282d18fef968
diff --git a/claude-ops/scripts/aws-usage-cost.sh b/claude-ops/scripts/aws-usage-cost.sh
index 5c434194..51e63495 100755
--- a/claude-ops/scripts/aws-usage-cost.sh
+++ b/claude-ops/scripts/aws-usage-cost.sh
@@ -16,10 +16,13 @@
# Env:
# AWS_REGION / AWS_DEFAULT_REGION (default us-east-1 for CE — global service)
# AWS_PROFILE
+# FINOPS_DOPPLER_PROJECT / FINOPS_DOPPLER_CONFIG (optional credential fallback)
set -euo pipefail
REGION="${AWS_REGION:-${AWS_DEFAULT_REGION:-us-east-1}}"
USAGE_FILTER='{"Dimensions":{"Key":"RECORD_TYPE","Values":["Usage"]}}'
+FINOPS_DOPPLER_PROJECT="${FINOPS_DOPPLER_PROJECT:-finops-dashboard}"
+FINOPS_DOPPLER_CONFIG="${FINOPS_DOPPLER_CONFIG:-prd}"
today() { date +%Y-%m-%d; }
month_start() { date +%Y-%m-01; }
@@ -33,8 +36,33 @@ prev_month_start() {
}
prev_month_end() { date +%Y-%m-01; }
+aws_ce() {
+ local err rc
+ err=$(mktemp)
+ if aws ce get-cost-and-usage --region "$REGION" "$@" 2>"$err"; then
+ rm -f "$err"
+ return 0
+ fi
+ rc=$?
+
+ # The ambient AWS identity may be intentionally scoped to Bedrock or another
+ # service. If Cost Explorer is denied, retry with the configured FinOps
+ # credential source rather than swallowing the error into an empty `{}`.
+ if command -v doppler >/dev/null 2>&1 \
+ && grep -qE 'AccessDenied|not authorized|Unable to locate credentials' "$err"; then
+ if doppler run --project "$FINOPS_DOPPLER_PROJECT" --config "$FINOPS_DOPPLER_CONFIG" -- \
+ aws ce get-cost-and-usage --region "$REGION" "$@"; then
+ rm -f "$err"
+ return 0
+ fi
+ fi
+ cat "$err" >&2
+ rm -f "$err"
+ return "$rc"
+}
+
ce() {
- aws ce get-cost-and-usage --region "$REGION" "$@" 2>/dev/null
+ aws_ce "$@"
}
cmd_daily() {
diff --git a/claude-ops/tests/test-aws-usage-cost.sh b/claude-ops/tests/test-aws-usage-cost.sh
new file mode 100755
index 00000000..0e88430a
--- /dev/null
+++ b/claude-ops/tests/test-aws-usage-cost.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+SCRIPT="$ROOT/scripts/aws-usage-cost.sh"
+
+grep -q 'FINOPS_DOPPLER_PROJECT' "$SCRIPT"
+grep -q 'AccessDenied.*not authorized.*Unable to locate credentials' "$SCRIPT"
+grep -q 'doppler run --project' "$SCRIPT"
+grep -q 'cat "$err" >&2' "$SCRIPT"
+
+echo "aws usage helper fallback and truthful-error contract: ok"
\ No newline at end of file