Initializes an empty volume of a given size.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The Availability Zone in which to create the new volume. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Create a new volume in the same availability zone as a running instance.
// Instantiate the class $ec2 = new AmazonEC2(); // Describe the running instance to get the Availability Zone $describe = $ec2->describe_instances(array( 'InstanceId' => 'i-1f549375' )); // Grab the Availability Zone $avail_zone = (string) $describe->body->availabilityZone(0); // First result of the built-in XPath search. // Create the volume $response = $ec2->create_volume($avail_zone, array( 'Size' => 10 // Gibibytes )); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (7 lines) | View on GitHub