define('TEXT_LINE_HEIGHT', 14);
define('INSTANCE_WIDTH', 128);
define('INSTANCE_HEIGHT', 64);
define('VOLUME_WIDTH', 96);
define('VOLUME_HEIGHT', 64);
define('SNAP_WIDTH', 96);
define('SNAP_HEIGHT', 64);
define('VOLUME_GAP', 16);
define('SNAP_GAP', 16);
// Create the access objects
$ec2 = new AmazonEC2();
$s3 = new AmazonS3();
// Get the EC2 instances, EBS volumes, and snapshots
$resInstances = $ec2->describe_instances();
$resVolumes = $ec2->describe_volumes();
$resSnapshots = $ec2->describe_snapshots();
// Check for errors
if (!$resInstances->isOK() || !$resVolumes->isOK() || !$resSnapshots->isOK()) {
    exit("Error retrieving system information.");
}
// Create an object to represent the EC2 region
$region = new Region('us-east-1');
// Add each EC2 instance to the region
foreach ($resInstances->body->reservationSet->item as $itemSet) {
    foreach ($itemSet->instancesSet->item as $item) {
        $instanceId = (string) $item->instanceId;
        $state = (string) $item->instanceState->name;
        $instanceType = (string) $item->instanceType;
        $availabilityZone = (string) $item->placement->availabilityZone;
        if ($state != 'terminated') {
            $region->AddInstance(new Instance($availabilityZone, $instanceId, $state, $instanceType));