public Ec2ImageCreator(AwsImageCreateOptionsValues options)
        {
            _client  = new AmazonEC2Client(options.Credentials, options.RegionEndpoint);
            _options = options;

            _imageHandler = new Ec2ImageHandler(_client);
        }
 public string Create(AwsImageCreateOptionsValues options)
 {
     Logger.Info($"Creating AMI {options.ImageRequest.Name} from instance {options.ImageRequest.InstanceId}");
     try
     {
         var requiredStartingStates = new List <Ec2InstanceState> {
             Ec2InstanceState.Stopped
         };
         if (!options.WaitForShutdown)
         {
             requiredStartingStates.Add(Ec2InstanceState.Running);
         }
         _instanceHandler.WaitForInstanceToReachOneOfStates(options.ImageRequest.InstanceId, requiredStartingStates);
         var response = _client.CreateImage(options.ImageRequest);
         WaitForImageToReachState(response.ImageId, "available");
         return(response.ImageId);
     } catch (Exception e)
     {
         throw new CouldNotCreateAMIException($"Could not create image from instance {options.ImageRequest.InstanceId}: {e.Message}"); // Do we get any additional information about the error?
     }
 }
 public AwsCreateImageOperation(AwsImageCreateOptionsValues options) : base(options)
 {
     this.options = options;
 }
 public AwsImageCreateOptionsBuilder(string instanceId, string name)
 {
     _values = new AwsImageCreateOptionsValues(instanceId, name);
     _disks  = new AwsImageCreateDisksOptionsBuilder(_values.ImageRequest.BlockDeviceMappings, this);
 }