/// <summary> /// Gets a list of instance ids from a cluster and instance arns /// </summary> /// <param name="arns"></param> /// <returns></returns> private async Task <List <string> > GetAwsClusterInstancesIds(List <string> arns) { string awsRegion = context.AppSettings.SettingsConfig.AwsRegion; string awsCluster = context.AppSettings.SettingsConfig.AwsClusterName; AmazonECSClient ecs = new AmazonECSClient(Amazon.RegionEndpoint.GetBySystemName(awsRegion)); ecsModel.DescribeContainerInstancesRequest clusterRequest = new ecsModel.DescribeContainerInstancesRequest(); clusterRequest.Cluster = awsCluster; clusterRequest.ContainerInstances = arns; var items = await ecs.DescribeContainerInstancesAsync(clusterRequest); return(items.ContainerInstances.Where(t => t.RunningTasksCount > 0).Select(t => t.Ec2InstanceId).ToList()); }