AwsPs.Client.GetInstances C# (CSharp) Method

GetInstances() public method

public GetInstances ( ) : IEnumerable
return IEnumerable
        public IEnumerable<Instance> GetInstances()
        {
            AmazonEC2Client client = _GetClient();
            var describeInstancesRequest = new DescribeInstancesRequest();
            var response = client.DescribeInstances(describeInstancesRequest);
            var instances = response.DescribeInstancesResult.Reservation.SelectMany(x => x.RunningInstance).Select(x => new{ x.InstanceId, State = x.InstanceState.Name, x.IpAddress, x.InstanceType, x.PublicDnsName, InstanceName = x.Tag.Where(y => y.Key == "Name").Select(z => z.Value).First(), });
            return instances.Select(instance => new Instance
                                                    {
                                                        Name = instance.InstanceName,
                                                        State = instance.State,
                                                        Dns = instance.PublicDnsName,
                                                        Id = instance.InstanceId,
                                                        Ip = instance.IpAddress
                                                    });
        }