Retrieves the encrypted administrator password for the instances running Windows.
The Windows password is only generated the first time an AMI is launched. It is not generated for rebundled AMIs or after the password is changed on an instance. The password is encrypted using the key pair that you provided.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The ID of the instance for which you want the Windows administrator password. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Get encoded Windows password.
// Instantiate the class $ec2 = new AmazonEC2(); // Get console output $response = $ec2->get_password_data('i-1f549375'); // Success? var_dump($response->isOK());Result:
bool(true)
Get the decrypted version of the Windows password.
// Instantiate the class $ec2 = new AmazonEC2(); // Get console output $response = $ec2->get_password_data('i-1f549375', array( 'DecryptPasswordWithKey' => file_get_contents('my-keypair.pem') )); // Success? var_dump($response->isOK()); var_dump(strlen((string) $response->body->passwordData)); // Length of the password
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (36 lines) | View on GitHub