[英]AWS SDK for PHP Example?
I am trying to install the AWS SDK for PHP on my (of all things) AWS EC2 server. 我试图在(所有)AWS EC2服务器上安装适用于PHP的AWS开发工具包。 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.
我可以找到的所有代码示例均适用于S3。 I'm looking for a PHP Code Example for using the AWS SDK for PHP v2.x to do anything with Amazon EC2 .
我正在寻找一个PHP代码示例,以使用适用于PHP v2.x的AWS开发工具包对Amazon EC2进行任何操作 。
Even if it just lists my currently running instances. 即使它只是列出了我当前正在运行的实例。 Nothing fancy, I just need to see it work.
没什么,我只需要看到它的工作即可。
I've installed the SDK using Pear. 我已经使用Pear安装了SDK。
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: Victor Smirnow已经花时间对如何使用Amazon PHP SDK 2获取EC2实例列表 (每个+1)提出了一个问题和详尽的答案-因此,您应该简单地查看他的答案以获取更多详细信息,但是请使用简短版本所述DescribeInstances经由AWS SDK为PHP 2 API动作describeInstances作为请求的方法可以归结为:
$config = array();
$config['key'] = 'key';
$config['secret'] = 'secret';
$config['region'] = 'us-east-1';
$ec2Client = \Aws\Ec2\Ec2Client::factory($config);
$result = $ec2Client->DescribeInstances();
Have you seen the User Guide? 您看过《用户指南》吗? There's a Quick Start and here's the guide for S3 .
有一个快速入门 ,这是S3的指南 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.