I have several EC2 instances and i wanted to find an ip addresses of those. I was thinking to use DescribeInstances
with Filter
, but can't find any example how to apply Filter
. Any help is appreciated.
This is already answered previously: Listing Instances in AWS .NET SDK
So, in addition to InstanceId and InstanceType which the example in the above link prints, you can also print
Console.WriteLine(runningInstance.PrivateIpAddress);
Console.WriteLine(runningInstance.PublicIpAddress);
If you need to add filter to the DescribeInstanceRequest then check DescribeInstanceRequest With Filter
Example - How to set filter:
new DescribeInstancesRequest()
{
Filter = new List<Filter>()
{
new Filter()
{
Name = "instance-id",
Value = new List<String>()
{
"i-223c1a1b"
}
}
}
}
So, the above filter will return the details of that particular instance with instance id: i-223c1a1b.
For more details about all the filters and their names, see DescribeInstances Filters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.