AWS EC2 - Public IPv4 address not working on a running EC2 instance

Viewed 152

I am trying to display a very basic node.js app on an ec2 instance. I have it running on local host just fine but when I try to launch it on an ec2, it displays this error: enter image description here

I know it has something to do with the ports, but I'm not sure what the issue is. Here is the very basic source code:

const http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello! Yes!');
}).listen(8080);

and here is a screenshot of my security configurations in the AWS EC2 instance:

enter image description here

Anyone have any idea what I'm doing wrong?

1 Answers

Try explicitly adding http in front of the URL: http://<ec2-public-ip-address>

Related