我正在尝试使用AWS API获取 EstimatedCharges 数据。我正在使用他们提供的PHP库。除了没有返回数据点之外,一切正常。一些观察:
我的代码:
<?php
date_default_timezone_set('UTC');
require_once('../sdk.class.php');
require '../aws-autoloader.php';
$cw = Aws\CloudWatch\CloudWatchClient::factory(array(
'region' => 'us-east-1',
'version' => '2010-08-01',
'credentials' => array(
'key' => 'xxxxxxxxxx',
'secret' => 'yyyyyyyyyyy'
)
));
$count = $cw->getMetricStatistics(array(
'MetricName' => 'EstimatedCharges',
'Statistics' => array('Maximum'),
'Unit' => 'Count',
'Namespace' => 'AWS/Billing',
'StartTime' => '03/09/2017',
'EndTime' => '03/13/2017',
'Period' => 300,
'Dimensions' => array(
array('Name' => 'Currency', 'Value' => 'USD')
),
));
echo $count;