AWS SDK的PHP的例子? [英] AWS SDK for PHP Example?

查看:1312
本文介绍了AWS SDK的PHP的例子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想(万物)我的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 API行动href="http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.Ec2.Ec2Client.html#_describeInstances"相对=nofollow> describeInstances 方法要求可以归结为:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆