Use HTTPS for a VM instance with LAMP stack running in Google Compute engine without domain name

I have a VM instance running in Google compute engine. It has an external IP address. My only usage of the VM instance is for a REST api for an android app. I do not want to use it with any browsers. Only the android app is going to communicate with this.

I have installed a lamp stack and am able to use the REST apis that I have created with normal http and the external IP address. I want to secure the communication using TLS. I do not have a domain name. I don't require one. Is it possible to use HTTPS in this situation?

I can create add the self signed certificates in my android app as well. I'm not sure if this possible? after some research I found that lets encrypt doesn't issue certificates for IP addresses and various reasons for it, which mainly includes browsers. In my case browsers are of no use coz only my android app is going to access the server.

Any solution? work around?

My objective is to secure the http communication between my android app client and the GCE VM instance server.


Solution 1:

Domain names are very cheap. Some are free. Since you do not care about a domain name, just purchase a cheap one and deploy a Let's Encrypt certificate. You will greatly minimize future problems.

Your other option is to generate a self-signed certificate with the IP address. I am not an Android developer so I cannot comment on self-signed certificate setup with a private root certificate.