Query AWS EC2 Hosts Using DQL for Cloud Infrastructure Insights

,

Hello,

In the user interface, I am able to see the AWS instance id of an AWS EC2 host even without configuring the AWS connector.

How could I get the AWS instance id using the ‘fetch dt.entity.host’ query ?

Hi @flomaz ,

You need a combined query:

fetch dt.entity.host
| fieldsAdd runs_on[dt.entity.ec2_instance]
| lookup [ fetch dt.entity.ec2_instance | fieldsAdd awsInstanceId ],sourceField:runs_on[dt.entity.ec2_instance], lookupField:id, prefix:"ec2"

Hello @Miguel_RinconG ,

thanks a lot for your query.

This will work if there is a record in dt.entity.ec2_instance but is it possible to get the ec2 instance id if there is no record in dt.entity.ec2_instance?

The hosts are part of a Kubernetes cluster in which an active gate and one agents are deployed. The AWS connector was not deployed in this specific AWS account.