Container for the parameters to the TerminateInstances operation. Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.

If you specify multiple instances and the request fails (for example, because of a single incorrect instance ID), none of the instances are terminated.

Terminated instances remain visible after termination (for approximately one hour).

By default, Amazon EC2 deletes all EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue running.

You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices attached to the instance persist. When you terminate an instance, any attached EBS volumes with the DeleteOnTermination block device mapping parameter set to true are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon Elastic Compute Cloud User Guide.

For more information about troubleshooting, see Troubleshooting Terminating Your Instance in the Amazon Elastic Compute Cloud User Guide.

상속: AmazonEC2Request
        public void Run()
        {
            var request = new TerminateInstancesRequest
            {
                InstanceIds = new List<string>()
                {
                    instance.InstanceId
                }
            };

            try
            {
                var responseTerminate = awsClient.Ec2Client.TerminateInstances(request);
                foreach (var item in responseTerminate.TerminatingInstances)
                {
                    instance.CurrentStatus = item.CurrentState.Code.ToString();
                    instance.PreviousStatus = item.PreviousState.Code.ToString();
                }

                if (instance.CurrentStatus == "32")
                    FinishedSuccessfully = true;
            }
            catch (AmazonEC2Exception ex)
            {
                Error = "InvalidInstanceID.NotFound" == ex.ErrorCode ? "Instance does not exist." : ex.Message;
            }
        }
        /// <summary>
        /// Terminate an active EC2 instance.
        /// </summary>
        protected override void AmazonExecute()
        {
            var request = new TerminateInstancesRequest
            {
                InstanceId = this.InstanceIds.Get(this.ActivityContext)
            };

            try
            {
                var response = EC2Client.TerminateInstances(request);
                this.InstanceChanges.Set(this.ActivityContext, response.TerminateInstancesResult.TerminatingInstance);
            }
            catch (EndpointNotFoundException ex)
            {
                this.LogBuildMessage(ex.Message);
            }
        }
예제 #3
0
 public void TerminateInstance(string instanceId)
 {
     try
     {
         AWSModel.TerminateInstancesRequest request = new AWSModel.TerminateInstancesRequest();
         List <string> terminateList = new List <string>();
         terminateList.Add(instanceId);
         request.InstanceId = terminateList;
         ec2.TerminateInstances(request);
     }
     catch (WebException e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
     catch (AmazonEC2Exception e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
 }
예제 #4
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.EC2.Model.TerminateInstancesRequest();

            if (cmdletContext.InstanceId != null)
            {
                request.InstanceIds = cmdletContext.InstanceId;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
예제 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the TerminateInstances operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.TerminateInstances"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TerminateInstances operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<TerminateInstancesResponse> TerminateInstancesAsync(TerminateInstancesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new TerminateInstancesRequestMarshaller();
            var unmarshaller = TerminateInstancesResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, TerminateInstancesRequest, TerminateInstancesResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
예제 #6
0
        /// <summary>
        /// This function terminates an existing EC2 instance, regardless of location
        /// </summary>
        /// <param name="InstanceId">The id of the instance to be terminated</param>
        /// <returns>Success flag</returns>
        public bool TerminateInstance(string InstanceId)
        {
            bool result = false;

            // Initialize error values
            ErrorCode    = 0;
            ErrorMessage = "";

            // Create the request
            var deleteRequest = new TerminateInstancesRequest ()
            {
                InstanceIds = new List<string> { InstanceId }
            };

            try
            {
                // Run the operation
                var deleteResponse = EC2client.TerminateInstances (deleteRequest);

                // Check response for errors
                if (deleteResponse.HttpStatusCode != HttpStatusCode.OK)
                {
                    ErrorCode = Convert.ToInt32 (deleteResponse.HttpStatusCode);
                    ErrorMessage = "Http Error [" + deleteResponse.HttpStatusCode.ToString () + "]";
                }
                else
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                ErrorCode    = -1;
                ErrorMessage = ex.Message + "::" + ex.InnerException;
            }

            return result;
        }
예제 #7
0
 public void TerminateInstance(string instanceId)
 {
     try
     {
         AWSModel.TerminateInstancesRequest request = new AWSModel.TerminateInstancesRequest();
         List<string> terminateList = new List<string>();
         terminateList.Add(instanceId);
         request.InstanceId = terminateList;
         ec2.TerminateInstances(request);
     }
     catch (WebException e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
     catch (AmazonEC2Exception e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
 }
예제 #8
0
        /// <summary>
        /// <para> The TerminateInstances operation shuts down one or more instances. This operation is idempotent; if you terminate an instance more
        /// than once, each call will succeed. </para> <para> Terminated instances will remain visible after termination (approximately one hour).
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TerminateInstances service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the TerminateInstances service method, as returned by AmazonEC2.</returns>
		public TerminateInstancesResponse TerminateInstances(TerminateInstancesRequest request)
        {
            var task = TerminateInstancesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
예제 #9
0
        public void Terminate(string bootstrapId, string vpcId)
        {
            Logger.Info("Terminating instances");
            var instanceRequest = new DescribeInstancesRequest
            {
                Filters = new[]
                {
                    new Filter
                    {
                        Name = "tag:Name",
                        Values = new[] {Ec2TagHandler.GetNameTag(bootstrapId)}.ToList()
                    },
                    new Filter
                    {
                        Name = "instance-state-name",
                        Values = new[] {"running", "pending", "stopping", "stopped"}.ToList()
                    },
                    new Filter
                    {
                        Name = "vpc-id",
                        Values = new[] {vpcId}.ToList()
                    }
                }.ToList()
            };
            var instances = _client.DescribeInstances(instanceRequest);

            var terminationRequest = new TerminateInstancesRequest();
            var instanceIds = instances.Reservations.SelectMany(x => x.Instances.Select(y => y.InstanceId)).ToList();
            terminationRequest.InstanceIds.AddRange(instanceIds);

            _client.TerminateInstances(terminationRequest);
            Logger.WithLogSection("Waiting for instances to terminate", () => WaitForInstancesToTerminate(instanceIds));
        }
예제 #10
0
 private Amazon.EC2.Model.TerminateInstancesResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.TerminateInstancesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "TerminateInstances");
     try
     {
         #if DESKTOP
         return(client.TerminateInstances(request));
         #elif CORECLR
         return(client.TerminateInstancesAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
예제 #11
0
 IAsyncResult invokeTerminateInstances(TerminateInstancesRequest terminateInstancesRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new TerminateInstancesRequestMarshaller().Marshall(terminateInstancesRequest);
     var unmarshaller = TerminateInstancesResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 private void TerminateAgents(AmazonEC2Client ec2Client, List<string> instanceIds)
 {
     var termRequest = new TerminateInstancesRequest {InstanceIds = instanceIds};
     TerminateInstancesResponse termResponse = ec2Client.TerminateInstances(termRequest);
     if (termResponse.HttpStatusCode != HttpStatusCode.OK)
     {
         throw new Exception("Agents were not terminated succesfully");
     }
 }
예제 #13
0
 public async Task terminateInstanceAsync(string instanceId)
 {
     TerminateInstancesRequest request = new TerminateInstancesRequest {
         InstanceIds = new List<string> { instanceId }
     };
     await _ec2Client.TerminateInstancesAsync(request);
 }
예제 #14
0
 /// <summary>
 /// <para>Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call
 /// succeeds.</para> <para>Terminated instances remain visible after termination (for approximately one hour).</para> <para>By default, Amazon
 /// EC2 deletes all Amazon EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue
 /// running.</para> <para>You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What
 /// happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices
 /// attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch
 /// are automatically deleted. For more information about the differences between stopping and terminating instances, see <a
 /// href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html" >Instance Lifecycle</a> in the <i>Amazon Elastic
 /// Compute Cloud User Guide</i> .</para>
 /// </summary>
 /// 
 /// <param name="terminateInstancesRequest">Container for the necessary parameters to execute the TerminateInstances service method on
 ///          AmazonEC2.</param>
 /// 
 /// <returns>The response from the TerminateInstances service method, as returned by AmazonEC2.</returns>
 /// 
 public TerminateInstancesResponse TerminateInstances(TerminateInstancesRequest terminateInstancesRequest)
 {
     IAsyncResult asyncResult = invokeTerminateInstances(terminateInstancesRequest, null, null, true);
     return EndTerminateInstances(asyncResult);
 }
예제 #15
0
        private void TerminateInstance(AwsRegionLocations region, string instanceId)
        {
            var client = ec2Clients.GetOrAdd(region, r => AWSClientFactory.CreateAmazonEC2Client(credentials, region.ToAwsRegionEndpoint()));

            var deleteRequest = new TerminateInstancesRequest()
            {
                InstanceIds = new List<string>() { instanceId }
            };

            client.TerminateInstances(deleteRequest);
        }
예제 #16
0
        /// <summary>
        /// Terminates an EC2 instance.
        /// </summary>
        /// <param name="instanceIds"></param>
        public void TerminateInstance(IEnumerable<string> instanceIds)
        {
            var request = new TerminateInstancesRequest { InstanceId = new List<string>(instanceIds) };

            Client.TerminateInstances(request);
        }
예제 #17
0
        public void terminate(string instanceId)
        {
            try
            {
                TerminateInstancesRequest request = new TerminateInstancesRequest();
                request.InstanceId.Add(instanceId);

                TerminateInstancesResponse response = _service.TerminateInstances(request);
            }
            catch (AmazonEC2Exception ex)
            {
                throw new Exception("Caught Exception: " + ex.XML);
            }
        }
예제 #18
0
		internal TerminateInstancesResponse TerminateInstances(TerminateInstancesRequest request)
        {
            var task = TerminateInstancesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Shuts down one or more instances. This operation is idempotent; if you terminate an
        /// instance more than once, each call succeeds.
        /// 
        ///  
        /// <para>
        /// Terminated instances remain visible after termination (for approximately one hour).
        /// </para>
        ///  
        /// <para>
        /// By default, Amazon EC2 deletes all EBS volumes that were attached when the instance
        /// launched. Volumes attached after instance launch continue running.
        /// </para>
        ///  
        /// <para>
        /// You can stop, start, and terminate EBS-backed instances. You can only terminate instance
        /// store-backed instances. What happens to an instance differs if you stop it or terminate
        /// it. For example, when you stop an instance, the root device and any other devices
        /// attached to the instance persist. When you terminate an instance, the root device
        /// and any other devices attached during the instance launch are automatically deleted.
        /// For more information about the differences between stopping and terminating instances,
        /// see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html">Instance
        /// Lifecycle</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
        /// </para>
        ///  
        /// <para>
        /// For more information about troubleshooting, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesShuttingDown.html">Troubleshooting
        /// Terminating Your Instance</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the TerminateInstances service method.</param>
        /// 
        /// <returns>The response from the TerminateInstances service method, as returned by EC2.</returns>
        public TerminateInstancesResponse TerminateInstances(TerminateInstancesRequest request)
        {
            var marshaller = new TerminateInstancesRequestMarshaller();
            var unmarshaller = TerminateInstancesResponseUnmarshaller.Instance;

            return Invoke<TerminateInstancesRequest,TerminateInstancesResponse>(request, marshaller, unmarshaller);
        }
예제 #20
0
        /// <summary>
        /// <para>Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call
        /// succeeds.</para> <para>Terminated instances remain visible after termination (for approximately one hour).</para> <para>By default, Amazon
        /// EC2 deletes all Amazon EBS volumes that were attached when the instance launched. Volumes attached after instance launch continue
        /// running.</para> <para>You can stop, start, and terminate EBS-backed instances. You can only terminate instance store-backed instances. What
        /// happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and any other devices
        /// attached to the instance persist. When you terminate an instance, the root device and any other devices attached during the instance launch
        /// are automatically deleted. For more information about the differences between stopping and terminating instances, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html">Instance Lifecycle</a> in the <i>Amazon Elastic
        /// Compute Cloud User Guide</i> .</para>
        /// </summary>
        /// 
        /// <param name="terminateInstancesRequest">Container for the necessary parameters to execute the TerminateInstances service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the TerminateInstances service method, as returned by AmazonEC2.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<TerminateInstancesResponse> TerminateInstancesAsync(TerminateInstancesRequest terminateInstancesRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new TerminateInstancesRequestMarshaller();
            var unmarshaller = TerminateInstancesResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, TerminateInstancesRequest, TerminateInstancesResponse>(terminateInstancesRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
예제 #21
0
            /// <summary>
            /// Shuts down one or more instances. This operation is idempotent; if you terminate an instance more than once, each call succeeds.
            /// Terminated instances remain visible after termination (for approximately one hour). By default, Amazon EC2 deletes all EBS volumes that were attached when the instance
            /// launched. Volumes attached after instance launch continue running. You can stop, start, and terminate EBS-backed instances. You can only terminate
            /// instance store-backed instances. What happens to an instance differs if you stop it or terminate it. For example, when you stop an instance, the root device and
            /// any other devices attached to the instance persist. When you terminate an instance, any attached EBS volumes with the DeleteOnTermination block device mapping parameter
            /// set to true are automatically deleted. For more information about the differences between stopping and terminating instances, see Instance Lifecycle in the Amazon EC2 User Guide.
            /// </summary>
            /// <param name="instances">A list of instance IDs to be stopped.</param>
            /// <param name="settings">The <see cref="EC2Settings"/> used during the request to AWS.</param>
            public bool TerminateInstances(IList<string> instances, EC2Settings settings)
            {
                if ((instances == null) || (instances.Count == 0))
                {
                    throw new ArgumentNullException("instances");
                }



                //Create Request
                AmazonEC2Client client = this.CreateClient(settings);
                TerminateInstancesRequest request = new TerminateInstancesRequest();

                foreach (string instance in instances)
                {
                    request.InstanceIds.Add(instance);
                }



                //Check Response
                TerminateInstancesResponse response = client.TerminateInstances(request);

                if (response.HttpStatusCode == HttpStatusCode.OK)
                {
                    _Log.Verbose("Successfully terminated instances '{0}'", string.Join(",", instances));
                    return true;
                }
                else
                {
                    _Log.Error("Failed to terminate instances '{0}'", string.Join(",", instances));
                    return false;
                }
            }
예제 #22
0
 /// <summary>
 /// Initiates the asynchronous execution of the TerminateInstances operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.TerminateInstances"/>
 /// </summary>
 /// 
 /// <param name="terminateInstancesRequest">Container for the necessary parameters to execute the TerminateInstances operation on
 ///          AmazonEC2.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// 
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking
 ///         EndTerminateInstances operation.</returns>
 public IAsyncResult BeginTerminateInstances(TerminateInstancesRequest terminateInstancesRequest, AsyncCallback callback, object state)
 {
     return invokeTerminateInstances(terminateInstancesRequest, callback, state, false);
 }
예제 #23
0
        /// <summary>
        /// The TerminateInstances operation shuts down one or more instances. This
        /// operation is idempotent; if you terminate an instance more than once, each call
        /// will succeed.
        /// Terminated instances will remain visible after termination (approximately one
        /// hour).
        /// 
        /// </summary>
        /// <param name="service">Instance of AmazonEC2 service</param>
        /// <param name="request">TerminateInstancesRequest request</param>
        public static void InvokeTerminateInstances(AmazonEC2 service, TerminateInstancesRequest request)
        {
            try 
            {
                TerminateInstancesResponse response = service.TerminateInstances(request);
                
                
                Console.WriteLine ("Service Response");
                Console.WriteLine ("=============================================================================");
                Console.WriteLine ();

                Console.WriteLine("        TerminateInstancesResponse");
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata  responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
                if (response.IsSetTerminateInstancesResult())
                {
                    Console.WriteLine("            TerminateInstancesResult");
                    TerminateInstancesResult  terminateInstancesResult = response.TerminateInstancesResult;
                    List<TerminatingInstance> terminatingInstanceList = terminateInstancesResult.TerminatingInstance;
                    foreach (TerminatingInstance terminatingInstance in terminatingInstanceList)
                    {
                        Console.WriteLine("                TerminatingInstance");
                        if (terminatingInstance.IsSetInstanceId())
                        {
                            Console.WriteLine("                    InstanceId");
                            Console.WriteLine("                        {0}", terminatingInstance.InstanceId);
                        }
                        if (terminatingInstance.IsSetShutdownState())
                        {
                            Console.WriteLine("                    ShutdownState");
                            InstanceState  shutdownState = terminatingInstance.ShutdownState;
                            if (shutdownState.IsSetCode())
                            {
                                Console.WriteLine("                        Code");
                                Console.WriteLine("                            {0}", shutdownState.Code);
                            }
                            if (shutdownState.IsSetName())
                            {
                                Console.WriteLine("                        Name");
                                Console.WriteLine("                            {0}", shutdownState.Name);
                            }
                        }
                        if (terminatingInstance.IsSetPreviousState())
                        {
                            Console.WriteLine("                    PreviousState");
                            InstanceState  previousState = terminatingInstance.PreviousState;
                            if (previousState.IsSetCode())
                            {
                                Console.WriteLine("                        Code");
                                Console.WriteLine("                            {0}", previousState.Code);
                            }
                            if (previousState.IsSetName())
                            {
                                Console.WriteLine("                        Name");
                                Console.WriteLine("                            {0}", previousState.Name);
                            }
                        }
                    }
                }

            } 
            catch (AmazonEC2Exception ex) 
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
            }
        }
예제 #24
0
        /// <summary>
        /// Initiates the asynchronous execution of the TerminateInstances operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TerminateInstances operation on AmazonEC2Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTerminateInstances
        ///         operation.</returns>
        public IAsyncResult BeginTerminateInstances(TerminateInstancesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new TerminateInstancesRequestMarshaller();
            var unmarshaller = TerminateInstancesResponseUnmarshaller.Instance;

            return BeginInvoke<TerminateInstancesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
예제 #25
0
 public void TerminateInstance(string instanceId)
 {
     TerminateInstancesRequest terminateInstancesRequest = new TerminateInstancesRequest()
                                                               {
                                                                   InstanceId = new List<string>() { instanceId }
                                                               };
     var terminateInstancesResponse = amazonEc2.TerminateInstances(terminateInstancesRequest);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the TerminateInstances operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the TerminateInstances operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<TerminateInstancesResponse> TerminateInstancesAsync(TerminateInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new TerminateInstancesRequestMarshaller();
            var unmarshaller = TerminateInstancesResponseUnmarshaller.Instance;

            return InvokeAsync<TerminateInstancesRequest,TerminateInstancesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
예제 #27
0
 public override void DestroyNode(Node node)
 {
     TerminateInstancesRequest request = new TerminateInstancesRequest () { InstanceId = new List<string> () { node.Id }};
     TerminateInstancesResponse response = Client.TerminateInstances (request);
 }