#14143 ec2.query: handling the case where requesturl is passed in

Handle the cases where requesturl is passed in and the ec2 endpoint needs to be parsed from it.

Fixes #14143