telnet ec2-x-x-x-x.compute-1.amazonaws.com 443
telnet localhost 443
telnet internal.ip 443
telnet hostname 443
telnet x.x.x.x 443
telnet freedns.dynu.com 443
However telnet on port 80 works fine with all of them.
My AWS Ubuntu 18 box has a /etc/hosts file that reads
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
netstat -ln says:
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
What am I missing or where am I going wrong?
Technically if ec2-x-x-x-x.compute-1.amazonaws.com is good then the IP address should also be good.
You do not have a process (web server) listening on IPv4 port 80 or 443. You do have a process (web server) listening on IPv6 ports 80 and 443.
The problem is that your web server is either not setup for 0.0.0.0:80 and 0.0.0.0:443 or your web server failed during startup. Consult your web server logfiles.
These addresses could only have worked resolving IPv6 addresses.
telnet ec2-x-x-x-x.compute-1.amazonaws.com 443
telnet localhost 443
telnet internal.ip 443
telnet hostname 443