Setting up an EC2 with https
Setting up an EC2 with https
Introduction
Setting up an EC2 with https is a bit tricky. This article will guide you through the process.
Prerequisites
- You have a domain name
- You have an EC2 instance running
Make sure that the security groups are set to allow traffic on the ports you want to use in the EC2.
Step 1 - Create a certificate
- Go to the AWS Certificate Manager
- Click on Request a certificate and Request a public certificate
- Add your domain name and click Next
- Select DNS validation and click Next
- Click Confirm and request
- Add the cname record to your DNS provider
Step 2 - Create A Target Group
- Go to the EC2 console
- Click on Target Groups
- Click on Create target group
- Add a name and click Next
- Select Instance and click Next
- Select your EC2 instance and click Next
- Click Next
- Click Create target group
The most important step:
Make sure that the port is the port that your server is running on in EC2. If you don't set this correctly, you will get a 502 error.
Step 3 - Create a Load Balancer With an HTTPS Listener
- Go to the EC2 console
- Click on Load Balancers
- Click on Create Load Balancer
- Select Application Load Balancer and click Create
- Add a name and click Next
- Select your VPC and click Next
- Select the target group you created in step 2 and click Next
- The certificate should be in the dropdown if the CNAME's were added correctly. Select it and click Next
- Click Next
Step 6 - Add the DNS records
- Go to the EC2 console
- Click on Load Balancers
- Click on your load balancer
- Copy the DNS name
- Go to your DNS provider and add a CNAME record with the DNS name as the value
- The CNAME name should be the domain or subdomain you want to use that the certificate was created for
- Wait for the DNS to propagate
- Enjoy your https website
Donations accepted at: xsimon.eth