Skip to content

Instantly share code, notes, and snippets.

@justinclayton
Created July 26, 2018 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save justinclayton/73ebcc7e5386b9faac698cc5b8b98605 to your computer and use it in GitHub Desktop.
Save justinclayton/73ebcc7e5386b9faac698cc5b8b98605 to your computer and use it in GitHub Desktop.
Yesterday's AWS Costs
aws ce get-cost-and-usage \
--granularity DAILY \
--time-period Start=$(date -v-1d +%Y-%m-%d),End=$(date +%Y-%m-%d) \
--metrics UnblendedCost \
| jq -r '.ResultsByTime[].Total.UnblendedCost.Amount' \
| ruby -e 'puts "$#{gets.to_f.round(2)}"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment