I have one domain codesharehub.com that is hosted on AWS EC2 with elastic IP 188.8.131.52, I have added A record in DNS to map domain with IP but on google search of codesharehub I get IP address instead of domain URL. I am not able to understand what is the issue, please help. I have attached screenshot for reference.
One thing you can do is to set your server config to force HTTP requests to redirect to HTTPS. HTTPS cannot be done with only IP, it has to be a domain. So, this would make it basically impossible for Google to give an IP.
Edit: It seems like it already does this. This might be Google taking time to update. In Google console you can request a reindexing by the Googlebot.