This content originally appeared on Level Up Coding - Medium and was authored by Falvis
Today we will look at how you can get an HTTPS for your website/Application hosted on EC2.
We need to set up the nginx if you have configured it to HTTP previously. Once you are done with can we can move on to the next step.
Steps to get HTTPS
- Get SSL/TLS Certificated
- Create a LoadBalancer
- Route all Trafic via LoadBalancer
- Route all Trafic via HTTPS
Now In this example in using route 53’s Domain name service. Even if you don’t have one you can still use the tutorial with slight changes which will be mentioned.
Get SSL/TLS Certificated
Now we can get a free certificate from the AWS Certificate Manager
- Goto Certificate Manager
2. Click on request a certificate
3. Select Public Certificate & click request certificate
4. Enter your domain name with .com or any subdomain if needed. & click Next
5. Select DNS validation for quick certificate generation but of course, you can use Email validation if needed & click Next
6. If you would like to add tags you can but I’m skipping for now & click Review
7. Review all the details if they are correct now click Confirm and request.
8. Now you need to create a record in your hosted zone with this value. But AWS offers you to do the work for you. So you can just click on create a record in Route 53 or manually do it yourself & click Continue
Wait for a few minutes you will get an issued status. Once you get that you can you can move on to the next step.
Create a LoadBalancer
If your application is hosted on an EC2 instance we need to make sure we have trafficked it via a load balancer.
We can only attach the ACM Certificate with a loadbalancer.
- Create a new Loadbalancer choose https/https
2. add a listener and add https with port 443 & click configure security settings
3. Select Choose a certificate from ACM and choose the certificate you just got & click next
4. choose the protocol to connect to the target group as HTTP with port 80 because you don’t need your loadbalncer to talk to your ec2 instance via a HTTPS, HTTP would be more than sufficient to do the job & click next
5. Add your EC2 to your target group and click next
6. Review all the information & click Create
Now we have successfully created a loadbalancer and HTTPS should work in a few minutes.
clear your browser cache or see if your target group is set via port 80.
Route all Trafic via HTTPS
This must be the shortest step of all. All we are trying to achieve here is to force traffic to go through HTTPS even if they try to go through HTTP.
- go to your loadbalncer and select your loadbalancer and choose port 80 and hit edit
2. change the route to redirect to HTTPS and click on Update at the top.
🥳 That’s it, you have successfully changed your HTTP app to HTTPS
Alvis F - Software Engineer - EY | LinkedIn
Get HTTPS 🔐! How to Get SSL\TLS Certificate in AWS for EC2 Hosted Application. was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Falvis
Falvis | Sciencx (2022-02-27T20:19:36+00:00) Get HTTPS ! How to Get SSL\TLS Certificate in AWS for EC2 Hosted Application.. Retrieved from https://www.scien.cx/2022/02/27/get-https-how-to-get-ssltls-certificate-in-aws-for-ec2-hosted-application/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.