First off, it looks like you have chosen a wrong hosting platform. AWS EC2 is too powerful and flexible for the task you are trying to solve. If your task is limited to hosting a simple web application, then you should use something simpler, like webhosting from Hetzner, which has everything included for a pretty small price.
If you still want to stick with AWS, you have options: use AWS services or do everything yourself. If you want to do it AWS way, then you should create a Load Balancer in front of your application. AWS will take care of everything: port redirection and SSL certificate, needed for port 443. However, to be honest, a Load Balancer is a bit of an overkill for a single EC2 instance configuration. Also, this would cost you additional money, as Load Balancers are not free (SSL certificates are, though).
If you do not want to pay for a Load Balancer, then you need to follow the advices given to you in the comments - which means you will have to set up a HTTP proxy and an SSL certificate for it (I suggest Letsencrypt). If you are willing to pay, then you need to do the following:
- Go to Amazon Certificate Manager and request a new certificate for the domain you created (the one you replaced with
my-dns-name
). As you start doing it, AWS will give you exhaustive instructions on how to verify your domain.
- Go to EC2 -> Load Balancers and create a Classic Load Balancer. Create two listeners to it: one for HTTP from port 80 to 3838, and one for HTTPS from port 443 to 3838. Attach the SSL certificate you obtainer earlier, to the second listener.
- Attach your EC2 instance to the Load Balancer you created.
- Go to Route53, remove the record that points to your EC2 instance, and replace it with a
CNAME
record pointing to the Load Balancer's DNS name. Alternatively, you can create an A
record instead, make it an Alias and point it to the Load Balancer (this is even more AWS way).
If you've done everything correctly, then your site should become available both by http://my-dns-name/My_app
and https://my-dns-name/My_app
.