I am trying to create a simple https server on Amazon EC2 to test a third-party API.
Here are the steps I followed:
- Created an instance of Amazon EC2 and opened HTTP and HTTPS ports:

- Simple ssl credentials created using
openssl genrsa 2048> privatekey.pem
openssl req -new -key privatekey.pem -out csr.pem
openssl x509 -req -days 365 -in csr.pem -signkey privatekey.pem -out server.crt
- Created a simple node js server
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('./privatekey.pem'),
cert: fs.readFileSync('./server.crt')
};
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8080);
When I start the server and try to connect to it using the url https://ec2-XX-XXX-XXX-XXX.compute-1.amazonaws.com/ , I continue to receive a connection denial.
The telnet test also creates:
Trying XX.XXX.XXX.XXX...
telnet: connect to address XX.XXX.XXX.XXX: Connection refused
telnet: Unable to connect to remote host
Can someone please tell me what I need to fix to enable https in this instance of EC2?