I'm trying to get AWS CloudWatch metric datapoints with powershell. But Get-CWMetricStatistic
command returns datapoints empty.
When I see CloudWatch by AWS Management Console, graph data exists.
Please tell me why I cannot pick up my data points.
$Namespace="AWS/ApplicationELB"
$MetricName="HealthyHostCount"
$Statistic="Minimum"
$Period = 300
$start=[System.DateTime]::UtcNow.AddHours(-1)
$end=[System.DateTime]::UtcNow
$dim=[Amazon.CloudWatch.Model.Dimension]::new()
$dim.Name="TargetGroup"
$dim.Value="MyTargetGroup"
$dim2=[Amazon.CloudWatch.Model.Dimension]::new()
$dim2.Name="LoadBalancer"
$dim2.Value="MyELB"
Get-CWMetricStatistic -Namespace $Namespace `
-MetricName $MetricName `
-Statistic $Statistic `
-UtcStartTime $start `
-UtcEndTime $end `
-Period $Period `
-Dimension $dim,$dim2