Skip to content

Instantly share code, notes, and snippets.

@chadsaun
Last active December 16, 2015 15: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 chadsaun/5455031 to your computer and use it in GitHub Desktop.
Save chadsaun/5455031 to your computer and use it in GitHub Desktop.
Code used to get the CloudWatch alarm datapoints
<?php
$startTime = strtotime('-1 hours');
$endTime = $startTime + 3600;
$startTime = date('c', $startTime);
$endTime = date('c', $endTime);
$result = $client->getMetricStatistics(array(
'MetricName' => 'Latency',
'Namespace' => 'AWS/ELB',
'StartTime' => $startTime,
'EndTime' => $endTime,
'Period' => 300,
'Statistics' => array('Average'),
));
print_r($result['Datapoints']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment