let's encrypt, aws, amazon linux 2,

How to secure domain with Let's Encrypt SSL/TLS certificate on Amazon Linux 2

Nov 28, 2021 · 1 min read · Post a comment

As a sequel to the previous topic where we saw how to install Certbot on Amazon Linux 2, here I’m going to show you how to secure your domain with a free Let’s Encrypt SSL/TLS certificate and make your website padlock icon green. I will show you two scenarios depending on your web server.

Prerequisites

  • Amazon Linux 2
  • sudo privileges
  • Certbot

Obtain Nginx based Let’s Encrypt SSL/TLS Certificate

Step 1. Make sure that your domain is correctly pointed to your Amazon Linux 2 EC2 instance. To easily check it, you can use an online DNS tool.

Step 2. To obtain Nginx based Let’s Encrypt SSL/TLS Certificate, run:

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

Step 3. It will ask you several questions whether you want an HTTPS redirect or not, but at the end, you should see the following message:

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at: 
...

Obtain Apache based Let’s Encrypt SSL/TLS Certificate

To obtain Apache based Let’s Encrypt SSL/TLS Certificate, run:

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

And you should get the same message as from step 3 above.

Conclusion

If you are not familiar with the DNS checking tool or how to generate the Let’s Encrypt certificate with Certbot don’t hesitate to put a comment below. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.