How to Install SSL on your AWS EC2 Instance Using Certbot

Secure Sockets Layer , more commonly referred to as SSL is a standard for establishing a secure encrypted link between a Server and Client.

March 27, 20242 min read

Secure Sockets Layer , more commonly referred to as SSL is a standard for establishing a secure encrypted link between a Server and Client. Websites with an SSL certificate have a padlock on the left side of the URL Bar reading connection is secure. Websites with this SSL certificate are more likely to be trusted by users of the website and vice versa.

This tutorial assumes that you are comfortable with the linux command line and you already have a live website with HTTP and PORT 80 is Open. For example http://example.com

1) SSH into your EC2 Instance

Login to your AWS Account. Search EC2 in the Search bar. Click on It and you will find a list of EC2 instances in your region. Click on the Instance where your website is located and connect to it via SSH as user with admin priviledges (sudo).

2) Install snapd

 sudo apt update
 sudo apt install snapd

3) Remove Certbot Packages

 sudo apt-get remove certbot

4) Install Certbot

sudo snap install --classic certbot

5) Ensure Certbot Command can run

sudo ln -s /snap/bin/certbot /usr/bin/certbot

6) Choose either of a) or b)

a) Get and Install your Certificates

sudo certbot --nginx

b) Get Certificate

 sudo certbot certonly --nginx

7) Attempt Automatic Renewal


Certbot installed includes automated renewal functionality through a cron job or systemd timer. You won't need to manually run Certbot unless your configuration changes. Test automatic certificate renewal with this command:

 sudo certbot renew --dry-run

8) Confirm your website has an ssl certificate and has a padlock on the left of url bar

https://example.com
Victor Ogonyo

About Victor Ogonyo

Backend and DevOps Engineer