AWS SDK的PHP的例子? [英] AWS SDK for PHP Example?
问题描述
我想(万物)我的AWS EC2服务器上安装的AWS SDK的PHP。我的认为的我已经安装它,但似乎无法弄清楚如何使用它。所有code的例子我能找到的是S3。我在寻找一个 PHP code示例使用AWS SDK的PHP版本2.x做的什么的与亚马逊EC2 。
I am trying to install the AWS SDK for PHP on my (of all things) AWS EC2 server. I think I have it installed, but can't seem to figure out how to use it. All of the code examples I can find are for S3. I'm looking for a PHP Code Example for using the AWS SDK for PHP v2.x to do anything with Amazon EC2.
即使它只是列出我的当前运行情况。没什么特别的,我只需要看到它的工作。
Even if it just lists my currently running instances. Nothing fancy, I just need to see it work.
我已经安装使用梨的SDK。
I've installed the SDK using Pear.
推荐答案
维克托Smirnow已经采取的时间来提供的如何获得EC2实例的列表与Amazon PHP SDK 2 (+1个) - 因此,你应该简单地检查他的回答更多细节,但短期的版本使用<一个href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html"相对=nofollow>通过AWS SDK的PHP 2
Victor Smirnow has already taken the time to provide a question and elaborate answer on How to get list of EC2 instances with Amazon PHP SDK 2 (+1 each) - accordingly you should simply check his answer for more details, but the short version for using the DescribeInstances API action via the AWS SDK for PHP 2 describeInstances method as requested boils down to:
$config = array();
$config['key'] = 'key';
$config['secret'] = 'secret';
$config['region'] = 'us-east-1';
$ec2Client = \Aws\Ec2\Ec2Client::factory($config);
$result = $ec2Client->DescribeInstances();
这篇关于AWS SDK的PHP的例子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!