Где переменная ec2 является экземпляром Amazon.EC2.AmazonEC2
public RunInstancesResult RunInstances()
{
RunInstancesRequest request;
RunInstancesResponse response;
RunInstancesResult result;
request = new RunInstancesRequest();
request
.WithInstanceType(InstanceType)
.WithImageId(ImageId)
.WithKeyName(KeyName)
.WithPlacement(new Placement() {AvailabilityZone = AvailabilityZone})
.WithMaxCount(1)
.WithMinCount(1)
.WithSecurityGroup(SecurityGroups);
response = ec2.RunInstances(request);
InstanceId = response.RunInstancesResult.Reservation.RunningInstance[0].InstanceId;
var trequest = new CreateTagsRequest();
trequest.WithResourceId(InstanceId);
trequest.WithTag(new Tag[] {
new Tag { Key = "#Name", Value = ServerTag },
new Tag { Key = "Hosts", Value = "prod data restored"}
});
var tresponse = ec2.CreateTags(trequest);
return response.RunInstancesResult;
}