Generate Certificate with Certbot
How to request certificate with certbot and how to add/update certificate via Certificate Manager
Last updated
How to request certificate with certbot and how to add/update certificate via Certificate Manager
Last updated
This example will show to request certification for happenn.com and www.happenn.com
SSH to the server and check command 'certbot' is it available. If not, install it.
Use a pem/ppk key as credentials. You will get it from Server Admin. If you have problem using the key file you need to set permissions, follow this guide:
First, we assign variable "DOMAIN" with the domain we want to get the certification. The reason we will use the variable instead of the string is because, the domain string will be use a few time, this will reduce the time need to typing the same domain again and again and also make copy paste be come more easier .On the second line with certbot command, we request certification for "happenn.com" and "www.happenn.com". If the domain you want to request is already a sub-domain. The second "-d www.$DOMAIN" can be remove.
The certbot will tell us to create a file in specific path with a specific text in it. This can be done via FTP or SSH. The file name and data will always contains the same text.
As in the image, the file name is "XKNxgoKHYVF4EA6s4eaDvHBxBp2auHhH1-NTzQggWls" which also contains inside the file data before the period.
For fast create file, you can open another SSH and use "cat" command to create a new file with the data
After the file has been create, press enter to continue. Depend on how many sub-domain you will request the SSL for. You will need to create the file equal to that number. In this case, we want "happenn.com" and "www.happenn.com". We will need to create 2 files.
After getting a success message
This will create create folder and move the certification files to another folder so that it can be download to your computer.
After complete requesting certification files, you will have 4 files
cert.pem
chain.pem
fullchain.pem
privkey.pem
Go to AWS console and select service Certificate Manager
Click on Import a certificate
Put content inside the file in the box
Certificate body: cert.pem
Certificate private key: privkey.pem
Certificate chain: chain.pem or fullchain.pem
Click Next
Click Review and import
Click Import
Go to AWS console and select service EC2
Select Load Balancing > Load Balancers
Select the Load Balancers that you want to assign certificate to.
Select Listeners tab
Select View/edit certificates on HTTPS : 443 row
Click + tab at the top
Select the certificate(s) you want to add and click Add
This will bind certificate(s) to the load balancer and doesn't need to setup SSL on the server itself as the load balancers will handle it for you.
For updating the existing certificate, you can request a new one as long as it is soon to be expire. However, if the certificate is not yet soon to be expire, you will only able to request specific amount per day. You will get a message when requesting the certificate from certbot.
Go to AWS console and select service Certificate Manager
Click on the domain name you want to reimport
Click on Reimport Certificate and follow the same step as Import Certificate