How to get list of EC2 instances with Amazon PHP SDK 2?

后端 未结 4 1289
萌比男神i
萌比男神i 2020-12-31 06:03

How to get list of Amazon EC2 instances matching some filters using AWS SDK for PHP 2?

4条回答
  •  既然无缘
    2020-12-31 06:36

    Victor's answer is great, but it wasn't working for me because I was missing one line:

    $reservations=$result->toArray();
    

    The Amazon PHP SDK 2 returns Guzzle Model objects for many things (including this), and they need to be converted to arrays before foreach will work. More info here:

    http://guzzlephp.org/api/class-Guzzle.Service.Resource.Model.html

提交回复
热议问题