Skip to content

Instantly share code, notes, and snippets.

@jdunmore
Last active August 29, 2015 14:05
Show Gist options
  • Save jdunmore/29e9f842bd4c38968b98 to your computer and use it in GitHub Desktop.
Save jdunmore/29e9f842bd4c38968b98 to your computer and use it in GitHub Desktop.
Check an AWS alarm from the PHP SDK
<?php
include("vendor/autoload.php");
use Aws\Common\Aws;
// Create a service builder using a configuration file
$aws = Aws::factory('config.php');
// Get the client from the builder by namespace
$client = $aws->get('CloudWatch');
$result = $client->describeAlarms( array(
'AlarmNames' => array('ALARM NAME'))
);
$alarm = $result['MetricAlarms'][0];
echo $alarm['StateValue'] . PHP_EOL;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment