Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

AMI Information Utilities

Example 736. Register an AMI with EC2

register Each AMI is associated with an unique ID which is provided by the Amazon EC2 service through the RegisterImage operation. During registration, Amazon EC2 retrieves the specified image manifest from Amazon S3 and verifies that the image is owned by the user registering the image.

register returns the imageId for the registered Image.

= new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
$ip $ec2_img->register('imageLocation');

Example 737. Deregister an AMI with EC2

deregister, Deregisters an AMI. Once deregistered, instances of the AMI can no longer be launched.

deregister returns boolean TRUE or FALSE.

= new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
$ip $ec2_img->deregister('imageId');

Example 738. Describe an AMI

describe Returns information about AMIs, AKIs, and ARIs available to the user. Information returned includes image type, product codes, architecture, and kernel and RAM disk IDs. Images available to the user include public images available for any user to launch, private images owned by the user making the request, and private images owned by other users for which the user has explicit launch permissions.

Table 149. Launch permissions fall into three categories

Name Description

The owner of the AMI granted launch permissions for the AMI to the all group. All users have launch permissions for these AMIs.


The owner of the AMI granted launch permissions to a specific user.


A user has implicit launch permissions for all AMIs he or she owns.

The list of AMIs returned can be modified by specifying AMI IDs, AMI owners, or users with launch permissions. If no options are specified, Amazon EC2 returns all AMIs for which the user has launch permissions.

If you specify one or more AMI IDs, only AMIs that have the specified IDs are returned. If you specify an invalid AMI ID, a fault is returned. If you specify an AMI ID for which you do not have access, it will not be included in the returned results.

If you specify one or more AMI owners, only AMIs from the specified owners and for which you have access are returned. The results can include the account IDs of the specified owners, amazon for AMIs owned by Amazon or self for AMIs that you own.

If you specify a list of executable users, only users that have launch permissions for the AMIs are returned. You can specify account IDs (if you own the AMI(s)), self for AMIs for which you own or have explicit permissions, or all for public AMIs.

describe returns an array for all the images that match the critera that was passed in. The array contains the imageId, imageLocation, imageState, imageOwnerId, isPublic, architecture, imageType, kernelId, ramdiskId and platform.

= new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
$ip $ec2_img->describe();

Zend Framework