如何在.NET编程方式启动一个Amazon EC2实例实例、方式、如何在、NET

2023-09-11 23:37:54 作者:£魔龙★祭天彡

我一直在试图开始在C#中的EC2实例没有运气。

I have been attempting to start an instance of EC2 in C# without luck.

在传递一个实例ID,开始我得到一个错误的实例不能不管,我传递,我从对象属性中获得一个实例ID找到。实例

When passing in an instance id to start the instance I get an error that the instance cannot be found despite that I am passing in an instance ID that I have obtained from the object property.

我将不胜感激与此任何提示或指针。

I would be most grateful for any tips or pointers with this.

推荐答案

亚马逊取得了巨大的努力,其AWS云计算的.Net SDK集成到VS2008和放大器; VS 2010

Amazon made huge efforts to integrate its AWS Cloud .Net SDK To VS2008 & VS 2010

1 - 下载并安装 AWS SDK MSI 2 - 创建一个AWS控制台项目,输入(在您的登录名菜单可从您的AWS控制台上的右上角)您的凭据 在3 - 添加以下code(见下面的图片)。 在4 - 您需要的资料完成的。这是非常简单的。 您可以检查计划启动/通过刷新您的AWS控制台屏幕停止成功。

AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client();
//Start Your Instance
ec2.StartInstances(new StartInstancesRequest().WithInstanceId("i-00000000"));
//Stop it
ec2.StopInstances(new StopInstancesRequest().WithInstanceId("i-00000000"));

您只需要更换I-00000000您的实例ID(在AWS管理控制台提供)

You just need to replace "i-00000000" by your instance Id (available in your AWS Management Console)

希望这有助于那些谷歌搜索这一点,并就这个问题绊脚石(像我一样我自己)迅速开始。照片下面通过这些向导,这些简单的步骤将不遗余力你相当头痛。

Hope this helps those googling this and stumbling upon this question (as I did myself) start off quickly. Following these simple steps via these wizards will spare you considerable headaches.