NodeJS app on AWS Lightsail with SSL

Create an instance on AWS Lightsail

Login to Lightsail page on AWS

Click on create instance

Setup nodeJS app

Setup apache configuration

Include "/opt/bitnami/apps/egg-eliminate/conf/httpd-app.conf" 
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
Include "/opt/bitnami/apps/egg-eliminate/conf/httpd-prefix.conf" 

Create a nodeJS app

const http = require('http');const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});

Test the app by access following

Setup SSL using Let’s Encrypt

Setup DNS record to access via subdomain

game.example.com. A  3.113.25.255
1. Stop web server
2. Configure web server to use a free Let's Encrypt certificate for the domains:
game.example.com
3. Configure a cron job to automatically renew the certificate each month
4. Configure web server name to: game.example.com
5. Enable HTTP to HTTPS redirection (example: redirect
http://game.example.com to https://game.example.com)
6. Start web server once all changes have been performed
Please provide a valid e-mail address for which to associate your Let's Encrypt 
certificate.
Domain list: game.example.comServer name: game.example.comE-mail address []: pramendra@gmail.comThe Let's Encrypt Subscriber Agreement can be found at:https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
/tmp/bncert-xxxxx.logIf you find any issues, please check Bitnami Support forums at:https://community.bitnami.com
0 0 * * * sudo /opt/bitnami/letsencrypt/lego

Stay ahead of the curve. Subscribe for emerging business & tech trends in byte-sized chunks. Intrapreneur @ Mercari🗼🇯🇵 https://www.linkedin.com/in/pram-gupta