I am using Zend Framework’s library to manage EC2 instances and AMI. However I can’t list the AMI’s I own and can’t list existing EC2 instances.
$ec2Instance = new Zend_Service_Amazon_Ec2_Instance($awsAccessKey, $awsSecretKey);
$instances = $ec2Instance ->describe();
$ec2Instance ->describe() should list all instances but it is returning no instances even though I have three of them running at this time.
$ami = new Zend_Service_Amazon_Ec2_Image($awsAccessKey, $awsSecretKey);
$images = $ami->describe();
$ami->describe() returns all the public images but none of them are the ones I created even though I have two AMIs.
Does any one know what I am missing here?
The problem was that you have to explicitly set the region for your instances.
As of version 1.10.3 of Zend Framework the following will not work because it will set a different variable internally:
Moreover us-west-1 is considered as an invalid region using version 1.10.3 of Zend Framework.
Instead setting the region in the constructor will make it work:
Then I was able to use $ec2Instance ->describe() to list all my instances.