Reputation: 47
Dears, I wrote a code to List Instance Proparties and Display using C#
AmazonEC2Client amazonEC2Client = new AmazonEC2Client("id", "password", Amazon.RegionEndpoint.USEast1))
DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest();
DescribeInstancesResponse describeInstancesResponse = amazonEC2Client.DescribeInstances(describeInstancesRequest);
List<Reservation> result = describeInstancesResponse.Reservations;
then I Can get Values of EC2 Attributes using this code:
foreach (var reservation in result)
{
foreach (var instance in reservation.Instances)
{
instance.InstanceId;
}
}
I need to get the Name Proparty Advise Please Thanks in Advance
Upvotes: 1
Views: 1709
Reputation: 2576
Just like you have retrieved InstanceId, all the information which you can receive about an instance is listed in this API doc.
Name is basically a Tag, so look into instance.Tags
Upvotes: 1