Jun 26, 2015

AWS - Extract protected API response data.

In most AWS API call you will get response model.

object(Guzzle\Service\Resource\Model)#97 (2) {
  ["data":protected]=> Array(THE DATA YOU NEED TO ACCESS HERE)

Here my sample, call to describe the ec2 instance.

$result = $client->describeInstances();

var_dump($result); // Display the result in Guzzle\Service\Resource\Model

$response = $result->toArray(); // Convert the protected data, into array

// Display the intance IP information.
Reference Stackoverflow.com