Hello,

My mission started off to see if I could figure out how to integrate the http://docs.aws.amazon.com/aws-sdk-php/v3/api/ to use it on Eucalyptus 4.0.2 production systems.

Researching the internet turned up not much current information. But it did turn up these two original pieces of information about getting the AWS PHP SDK v1 to run from 2013.

But AWS PHP SDK 1.0 is deprecated, big time. So what to do? Perhaps you could just make a drop in replacement? If only that was possible. It seems that AWS always modifys there API terminology per version. To the rescue! As of Eucalyptus 4.x branch the developers have managed to match their code perfectly and v3 api works right out of the box.

Steps to recreate: Install the AWS PHP SDK v3 via composer following normal AWS directions

Once that is done - you need to do some reading. Based on the two articles of the hardwork done to make the AWS PHP SDK work with Eucalyptus no longer work directly - you have to read the Aws/Ec2/Ec2Client constructor. All the information is actually encased in the previous Eucalyptus wiki articles but the constructor names have changed!

So after 10 minutes of reading I realized that this was an easy fix. Go directly to the Elastic Compute Cloud portion of the AWS PHP SDK and scroll down to the constructor and see for yourself.

*EC2 Output*

Once that work was done here is all that is needed to get the EC2 tools via PHP running:

require 'vendor/autoload.php';
use Aws\Ec2\Ec2Client;
$client = new Ec2Client([
  'scheme' => 'http',
  'endpoint' => 'Your-CLC-IP-Here:8773/',
  'validate' => false,
  'version' => '2015-10-01',
  'region' => 'us-east-1',
  'credentials' => [
     'key' => 'Your-KEY-HERE',
     'secret' => 'Your-Secret-Key_here',
     ],
]);
$result = $client->describeInstances([
]);
print_r($result);
?>

Note I hard coded the credentials for two reasons: 1 you have to change the permissions of any credentials file - like ~/.aws/crednetials because it is owned by root:root on any Eucalyptus created image. Or you could use IAM - which I am working on =) But at least this gets you started! S3 is my next take but their constructor is not so straight forward.

take care Jeremy Hajek