AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client();
//启动您的实例
ec2.StartInstances(new StartInstancesRequest().WithInstanceId("i-00000000"));
//停止
ec2.StopInstances(new StopInstancesRequest().WithInstanceId("i-00000000"));
答案 0 :(得分:1)
这是使用.net和启动实例的一个很好的(官方)指南:http://docs.aws.amazon.com/AWSSdkDocsNET/latest/DeveloperGuide/run-instance.html
您无法自己命名实例,并且需要指定更多信息。这是在该页面上找到的一个例子。
string amiID = "ami-e189c8d1";
string keyPairName = "my-sample-key";
var groups = new List<string>() { mySG.GroupId };
var launchRequest = new RunInstancesRequest()
{
ImageId = amiID,
InstanceType = "t1.micro",
MinCount = 1,
MaxCount = 1,
KeyName = keyPairName,
SecurityGroupIds = groups
};