Skip to content

Instantly share code, notes, and snippets.

@Sam-Martin
Created September 8, 2015 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sam-Martin/5dac054187ba10e97f3d to your computer and use it in GitHub Desktop.
Save Sam-Martin/5dac054187ba10e97f3d to your computer and use it in GitHub Desktop.
Get AWS Billing Estimate by PowerShell cmdlets
$Dimension1 = New-Object Amazon.CloudWatch.Model.Dimension
$dimension1.set_Name("Currency")
$dimension1.set_Value("USD")
# Has to be us-east-1 irrespective of what regions you use
$result = Get-CWMetricStatistics -MetricName EstimatedCharges -region us-east-1 -Namespace "AWS/Billing" -StartTime (Get-Date).AddDays(-14) -EndTime (get-date) -Period (60*60*24) -Statistics 'Maximum' -Dimensions @($Dimension1, $Dimension2)
$result.Datapoints | select timestamp,maximum | sort timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment