{"id":115,"date":"2025-12-23T11:44:35","date_gmt":"2025-12-23T11:44:35","guid":{"rendered":"https:\/\/blog.jayapress.in\/?p=115"},"modified":"2025-12-23T11:48:22","modified_gmt":"2025-12-23T11:48:22","slug":"install-certbot-on-ec2-instances-running-amazon-linux-2023-use-it-to-request-and-install-lets-encrypt-ssl-tls-certificate","status":"publish","type":"post","link":"https:\/\/blog.jayapress.in\/index.php\/2025\/12\/23\/install-certbot-on-ec2-instances-running-amazon-linux-2023-use-it-to-request-and-install-lets-encrypt-ssl-tls-certificate\/","title":{"rendered":"Install Certbot on EC2 instances running Amazon Linux 2023, request and install Let&#8217;s Encrypt SSL\/TLS certificate"},"content":{"rendered":"\n<p><em>Install Certbot on EC2 instances running AL2023 (Amazon Linux 2023), use it to request and install Let&#8217;s Encrypt SSL\/TLS certificate on either Apache or Nginx web server, with automated renewal<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/certbot.eff.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Certbot<\/a>\u00a0is a tool to obtain SSL\/TLS certificates from\u00a0<a href=\"https:\/\/letsencrypt.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Let&#8217;s Encrypt<\/a>\u00a0and (optionally) auto-enable HTTPS on your server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<p>Ensure that you have<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>a FQDN (fully qualified domain name) whose DNS entry resolves to your EC2 instance public internet IP address.\n<ul class=\"wp-block-list\">\n<li>If you do not have a domain, you can\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/Route53\/latest\/DeveloperGuide\/domain-register.html#domain-register-procedure-section\" target=\"_blank\" rel=\"noreferrer noopener\">register a new domain<\/a>\u00a0using\u00a0<a href=\"https:\/\/aws.amazon.com\/route53\/\" target=\"_blank\" rel=\"noreferrer noopener\">Amazon Route 53<\/a>\u00a0and\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/Route53\/latest\/DeveloperGuide\/resource-record-sets-creating.html\" target=\"_blank\" rel=\"noreferrer noopener\">create a DNS A record<\/a>.<\/li>\n\n\n\n<li>To prevent EC2 public IPv4 address from changing, you can\u00a0<a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/working-with-eips.html\" target=\"_blank\" rel=\"noreferrer noopener\">associate an Elastic IP address<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"https:\/\/docs.aws.amazon.com\/vpc\/latest\/userguide\/working-with-security-group-rules.html\" target=\"_blank\" rel=\"noreferrer noopener\">security group<\/a>\u00a0attached to your EC2 instance that allows inbound\u00a0<code>HTTP<\/code>\u00a0and\u00a0<code>HTTPS<\/code>\u00a0from internet.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Install Certbot<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y certbot python3-certbot-dns-route53 python3-certbot-apache python3-certbot-nginx\nsudo systemctl daemon-reload\nsudo systemctl enable --now certbot-renew.timer<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install and Configure Apache<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y httpd mod_ssl\nsudo tee \/etc\/httpd\/conf.d\/www.conf &gt; \/dev\/null &lt;&lt; EOF\n&lt;VirtualHost *:80&gt;\n  DocumentRoot \/var\/www\/html\n&lt;\/VirtualHost&gt;\nEOF\n\nsudo systemctl enable --now httpd<\/code><\/pre>\n\n\n\n<p><em>Certbot uses Apache\u00a0<a href=\"https:\/\/httpd.apache.org\/docs\/2.4\/vhosts\/name-based.html#using\" target=\"_blank\" rel=\"noreferrer noopener\">Virtual Hosts<\/a>\u00a0to identify web sites and install certs.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Request and install HTTPS cert<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot --apache<\/code><\/pre>\n\n\n\n<p>Enter valid email address, agree to Let&#8217;s Encrypt Terms of Service, optionally subscribe to&nbsp;<a href=\"https:\/\/www.eff.org\/\" rel=\"noreferrer noopener\" target=\"_blank\">EFF<\/a>&nbsp;mailing list, input your FQDN, to have Certbot request and install HTTPS certificate on your Apache server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"942\" src=\"https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-1-1024x942.png\" alt=\"\" class=\"wp-image-119\" style=\"width:532px;height:auto\" srcset=\"https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-1-1024x942.png 1024w, https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-1-300x276.png 300w, https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-1-768x706.png 768w, https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-1.png 1058w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Verify certificate<\/h2>\n\n\n\n<p>To display information about certificates you have from Certbot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot certificates<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"316\" src=\"https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-2.png\" alt=\"\" class=\"wp-image-123\" style=\"width:529px;height:auto\" srcset=\"https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-2.png 918w, https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-2-300x103.png 300w, https:\/\/blog.jayapress.in\/wp-content\/uploads\/2025\/12\/image-2-768x264.png 768w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Automated Renewal<\/h2>\n\n\n\n<p>Certbot use&nbsp;<code>certbot-renew<\/code>&nbsp;systemd daily for automated renewal of any certificate 30 days before their expiry dates. To verify certbot-renew operation<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>journalctl -u certbot-renew -f<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">More information<\/h2>\n\n\n\n<p>Refer to&nbsp;<a href=\"https:\/\/eff-certbot.readthedocs.io\/en\/stable\/using.html\" rel=\"noreferrer noopener\" target=\"_blank\">Certbot User Guide<\/a><\/p>\n\n\n\n<p>Credit: <a href=\"https:\/\/repost.aws\/articles\/AR_doGU0cxQymwf5A1Gl97yA\/use-certbot-to-enable-https-with-apache-or-nginx-on-ec2-instances-running-amazon-linux-2023-al2023\">https:\/\/repost.aws\/articles\/AR_doGU0cxQymwf5A1Gl97yA\/use-certbot-to-enable-https-with-apache-or-nginx-on-ec2-instances-running-amazon-linux-2023-al2023<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Certbot on EC2 instances running AL2023 (Amazon Linux 2023), use it to request and install Let&#8217;s Encrypt SSL\/TLS certificate on either Apache or Nginx web server, with automated renewal Certbot\u00a0is a tool to obtain SSL\/TLS certificates from\u00a0Let&#8217;s Encrypt\u00a0and (optionally) auto-enable HTTPS on your server. Requirements Ensure that you have Install Certbot Install and Configure [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[2],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":9,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"predecessor-version":[{"id":128,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/posts\/115\/revisions\/128"}],"wp:attachment":[{"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jayapress.in\/index.php\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}