Created
September 8, 2015 09:03
-
-
Save Sam-Martin/5dac054187ba10e97f3d to your computer and use it in GitHub Desktop.
Get AWS Billing Estimate by PowerShell cmdlets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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