You can try two option.
I will prefer ALB as you do not need expose port at the instance level and also you will not manage any proxy at the instance.
If you are using ALB, you can redirect to https from LB rule. A rule
has to have a condition and an action. Since we want to redirect all
traffic that comes in on port 80 to the same URI, just with HTTPS
instead, our condition should be simply “all”. Unfortunately you can’t
just put a single asterisk in for the condition, the closest I’ve been
able to come up with is *.example.com
, where xample.com
is
whatever your domain is.
aws-alb-redirects
If you are not using ALB, then you can try Nginx.
- You need to install Nginx on your server
- Allow port 80 in your instance
- Place below config in nginx.conf
This will redirect all
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
This will redirect the specific site.
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}
redirect-http-to-https-nginx
Another clarification from your question
How to integrate my amazon certificate into my instance?
No, You can not use AWS certificate within EC2 instance, you need to place LB on the top of Instance to use AWS certificate.