My company want to take daily snapshots of a windows in Amazon Web Service. We can take snapshot without any issue but when I try to create instance from snapshot, it always cr
try this
var launchRequest = new RunInstancesRequest()
{
ImageId = amiID,
InstanceType = ConfigurationManager.AppSettings["AwsInstanceType"],
MinCount = 1,
MaxCount = 1,
KeyName = keyPairName,
SecurityGroupIds = groups,
SubnetId = ConfigurationManager.AppSettings["AwsSubnetId"],
};
RunInstancesResponse runInstancesResponse = amazonEc2client.RunInstances(launchRequest);
var InstanceId = runInstancesResponse.Reservation.Instances[0].InstanceId;
var trequest = new CreateTagsRequest();
trequest.Resources=new List(){InstanceId};
List tags=new List();
Tag tag=new Tag("Name","TestCodeFinal");
tags.Add(tag);
trequest.Tags = tags;
amazonEc2client.CreateTags(trequest);
Reservation reservation = runInstancesResponse.Reservation;