iRule to resolve DNS for GTM (wide-ip if possible)

Hi

I’ve server on cloud and want to try to use irule to resolve dynamic IP from cloud and return IP to user.

I saw irule LTM can use RESOLVE:lookup and we can use it on Listener.

But Is it possible to have the same function irule in wide-ip ?

because if we attach irule on Listener, it will surely take more performance than wide-ip.

Flow is When user send dns request for wide-ip “A” → F5 resolve dynamic IP from cloud (it’s hostname will be like ABCDEFG.cloud-us.com)-> F5 return IP to user.

ps. due to some circumstance CNAME is not possible.

Thank you

FYI

This is irule that can include on Listener. (But not wide ip)

The irule resolve dynamic IP from AWS and return to user.

Cloud server is ABC.ap-southeast-1.elb.amazonaws.com
when DNS_REQUEST {
if {([string tolower [DNS::question name]] equals "ABC.com") && ([DNS::question type] equals "A")} {
    set aws [RESOLV::lookup @8.8.8.8 -a "ABC.ap-southeast-1.elb.amazonaws.com"]
    DNS::answer insert "[DNS::question name]. 111 [DNS::question class] [DNS::question type] [lindex $aws 0]"
    DNS::return
    }
}