Kong integration with Consul

Hi. I’m trying to use Kong as API Gateway and Consul as service discovery. Both Kong and Consul are running in docker containers.
Kong runs perfectly without Consul. I can add services and routers. And I tested it, it routes perfectly as I wanted. I can connect to port 8001.
But now I run both Kong and Consul. I run Consul in EC2 Instance A and Kong in EC2 Instance B. I already added DNS_RESOLVER for Kong to point to Consul. My Consul is running okay.
I’m getting this error as in picture but when i remove DNS_RESOLVER from docker-compose file it runs perfectly but it means that Kong is not using Consul as DNS resolver

And i can’t connect to port 8001. Only port 8000 works

What should i do to resolve this problem?
Thanks for reading