The BundleInstance operation request that an instance is bundled the next time it boots. The bundling process creates a new image from a running instance and stores the AMI data in S3. Once bundled, the image must be registered in the normal way using the RegisterImage API.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The ID of the instance to bundle. |
|
|
|
Required |
The details of S3 storage for bundling a Windows instance. Takes an associative array of parameters that can have the following keys:
|
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
|---|---|
|
A |
Examples
Bundle a running Windows-based instance.
// Instantiate the class
$ec2 = new AmazonEC2();
// Create the S3 policy
$policy = new CFPolicy($ec2, array(
'expiration' => $ec2->util->convert_date_to_iso8601('+12 hours'), // Expire in 12 hours
'conditions' => array(
array('acl' => 'public-read'),
array('bucket' => 'my-bucket')
)
));
// Bundle the Windows instance
$response = $ec2->bundle_instance($instance_id, array(
'Bucket' => 'my-bucket',
'Prefix' => 'windows',
'AWSAccessKeyId' => $policy->get_key(),
'UploadPolicy' => $policy->get_policy(),
'UploadPolicySignature' => $policy->get_policy_signature()
));
// Success?
var_dump($response->isOK());
Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (11 lines) | View on GitHub

