public async Task StopAsync(HostInfo host, TimeSpan cooldown) { Validate.NotNull(host, nameof(host)); if (host.ClusterId > 0) { var cluster = await clusterService.GetAsync(host.ClusterId); await clusterManager.DeregisterHostAsync(cluster, host); await Task.Delay(cooldown); // wait to allow the connections to drain from the load balancer } await ec2.StopInstancesAsync(new StopInstancesRequest(host.ResourceId)); await TransitionStateAsync(host, HostStatus.Stopped); }