Here We will know, How to install Letsencrypt SSL certificate on AWS EC2 ubuntu instance in this post. You already have some domains or subdomains may be running. Also you have a webserver installed apache or nginx. Please follow the step by step approach to install lets encrypt TLS/SSL certificate on an ubuntu AWS EC2 instance.

STEP 1: INSTALL CERTBOT TOOL AND DEPENDENCIES

Login to your AWS EC2 instance with ubuntu user. you have connect to AWS EC2 instance through putty.

Login as a root user and use below commands to add letsencrypt cert repository, install the certificate tool and dependencies.

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update

If you have apache webserver then install certbot for apache using below command:

$ sudo apt-get install python-certbot-apache

If you have nginx webserver then install certbot for nginx using below command:

$ sudo apt-get install python-certbot-nginx

STEP 2: GENERATE CERTIFICATE FOR DOMAIN OR DOMAINS

You can generate certificate for one or multiple domains through a single command. After running the command certbot client will automatically obtain cert or certs as per list provided in command. The first domain in list is base domain and then you can keep subdomains or aliases.
For Apache:

sudo certbot --apache -d yourdomain.com -d www.yourdomain.com

For Nginx:

sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

The generated certificate files and private key will get stored under /etc/letsencrypt/live. There will be directories created for domains under /etc/letsencrypt/live directory. The changes related to apache, nginx configuration for domains will get automatically added in respective domain configurations under /etc/nginx/sites-available or /etc/apache2/sites-available directory. Running above commands will add up respective rules for ssl as well in the configuration files.

I hope this article will help you to install Letsencrypt SSL certificate on AWS EC2 ubuntu instance.

Leave a Reply