Howto: AWS beanstalk custom subdomain with HTTPS

How to configure my (tomcat) webapp running on AWS elastic beanstalk with an SSL certificate available at my custom subdomain https://mysubdomain.chatbotsagency.com/healthcheck

elastic_beanstalk_logo[1]

Why AWS?
– you can host your (tomcat) webapp on AWS beanstalk for free*
– you get a free SSL cert from AWS
– Problem: no HTTPS on elastic beanstalk URLs by default

Why not Heroku?
– Heroku has HTTPS out of the box, but…
– Heroku is super nice when building directly from github, but if you need some custom modifications or have a custom build process, beanstalk is more flexible

Needed steps for configuration:

Steps

1. create new SSL cert for HTTPS (via AWS, it’s free!)
– for e.g. “mysubdomain.chatbotsagency.com”
+ validation via email
-> create new free SSL certificate for your custom subdomain

2. setup app (e.g. tomcat webapp) at beanstalk
– during setup: set custom domain “Environment settings” – Name & Domain
-> setup new beanstalk environment at http://mysubdomain.us-west-2.elasticbeanstalk.com
– opt. check webapp with URL http://mysubdomain.us-west-2.elasticbeanstalk.com/healthcheck (tomcat apps runs on /healthcheck)

3. setup subdomain forwarding at your own domain provider
– CNAME mysubdomain.chatbotsagency.com -> mysubdomain.us-west-2.elasticbeanstalk.com
-> app runs at: http://mysubdomain.chatbotsagency.com
– opt. check webapp with URL http://mysubdomain.chatbotsagency.com/healthcheck

4. my beanstalk environment: configure LB
– configure – scaling -> load balancing: enable

5. my beanstalk environment: configure HTTPS
– Network Tier – Load Balancer
– Secure listener port: 443
– SSL certificate ID: pick your new SSL cert “mysubdomain.chatbotsagency.com”
– “Apply”

6. opt. beanstalk configure SSL for direct access
– configuraion – instances – EC2 key pair

7. EC2 instance – adapt security group, add ports
– add 80 (http), 22 (ssh), 443 (https)
– opt. 8080, 8443 (tomcat)
– opt 3306 (mysql)

My webapp runs on beanstalk (tomcat) with an SSL cert to my custom subdomain:
-> https://mysubdomain.chatbotsagency.com/healthcheck


* if eligable AWS EC2 free tier