Example 721. Modify Image Attributes
Modifies an attribute of an AMI
Table 146. Valid Attributes
| Name | Description |
|---|---|
launchPermission |
Controls who has permission to launch the AMI. Launch permissions can be granted to specific users by adding userIds. To make the AMI public, add the all group. |
productCodes |
Associates a product code with |
modifyAttribute returns boolean TRUE or
FALSE.
<?php
$ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
// modify the launchPermission of an AMI
$return = $ec2_img->modifyAttribute('imageId',
'launchPermission',
'add',
'userId',
'userGroup');
// set the product code of the AMI.
$return = $ec2_img->modifyAttribute('imageId',
'productCodes',
'add',
null,
null,
'productCode');
Example 722. Reset an AMI Attribute
resetAttribute will reset the attribute of an AMI to
its default value. The productCodes attribute cannot be reset.
<?php
$ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
$return = $ec2_img->resetAttribute('imageId', 'launchPermission');
Example 723. Describe AMI Attribute
describeAttribute returns information about an attribute of an
AMI. Only one attribute can be specified per call. Currently only
launchPermission and productCodes are supported.
describeAttribute returns an array with the value of the attribute
that was requested.
<?php
$ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
$return = $ec2_img->describeAttribute('imageId', 'launchPermission');




