亚马逊ec2查询制作
任何人都可以告诉一个想法来创建一个查询来描述 aws ec2 中的区域。我在 &authparameters 中感到困惑。另外请提供一个生成签名的程序。
Can any one tell an idea to create a query for describing regions in aws ec2.I confused in &authparameters .Also please give a program to generate signature .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能应该使用 AWS SDK for PHP 来为您处理这些事情;它会让你的代码变得更好,它们包含错误的可能性要小得多,从长远来看,它会节省你的时间。
You should probably just use the AWS SDK for PHP to handle this stuff for you; it'll make your code nicer, they're far less likely to contain bugs, and it'll save you time in the long run.
经过长时间的搜索,我找到了一个程序,它将创建一个查询并从AWS返回响应..它工作正常..
程序
After a longtime search i found a program that will create a query and returns the response from AWS..It works fine..
Program
“prathyush”在这里的答案是非常方便的信息。我已经搜索了一段时间有关如何通过使用 php 的 http 请求在 ec2 上运行实例的信息。这段 php 代码经过修改后可以做到这一点甚至更多!
例如,将 $params 部分替换为:
$params = array(
'行动' => '运行实例',
'图像ID' => 'ami-f0f61599',
'Placement.AvailabilityZone' =>; 'us-east-1a',
'InstanceType' => 'm1.large',
'最小计数' => '1',
'最大计数' => '1',
'键名' => '你的密钥对',
'AWSAccessKeyId' => $键,
'时间戳' => gmdate('Ymd\TH:i:s\Z'),
'版本' => '2008-05-05',
'签名版本' => 2、
'签名方法' => 'HmacSHA256'
);
不要忘记将上面的可用区域更改为您需要的。对我来说,我将其更改为 eu-west-1a。
另外,在代码底部出现的两个位置将 ec2.amazonaws.com 更改为 eu-west-1.ec2.amazonaws.com。
The answer here by 'prathyush' is very handy information. I've been searching for a while now for info on how to run an instance on ec2 via an http request with php. This bit of php code can be adapted to do just that and more!
For example replace the $params section with:
$params = array(
'Action' => 'RunInstances',
'ImageId' => 'ami-f0f61599',
'Placement.AvailabilityZone' => 'us-east-1a',
'InstanceType' =>'m1.large',
'MinCount' => '1',
'MaxCount' => '1',
'KeyName' => 'yourkeypair',
'AWSAccessKeyId' => $key,
'Timestamp' => gmdate('Y-m-d\TH:i:s\Z'),
'Version' => '2008-05-05',
'SignatureVersion' => 2,
'SignatureMethod' => 'HmacSHA256'
);
Don't forget to change the availability zone above to what you need. For me I changed it to eu-west-1a.
Also change ec2.amazonaws.com to eu-west-1.ec2.amazonaws.com in the two places it appears in the bottom bit of the code.