Get a Let'sEncrypt certificate on Amazon EC2

Posted in php, blog on November 4, 2020 by Henk Verlinde ‐ 1 min read

Get a Let'sEncrypt certificate on Amazon EC2

Introduction

I needed to issue a server certificate with LetsEncrypt on Amazon EC2, so I will write it down as a memorandum.

Volume Type is Amazon Linux 2 AMI (HVM), SSD Volume Type (free tier).

Get certbot

  1. Fetch with wget
wget https://dl.eff.org/certbot-auto

2. Add permission

chmod 700 certbot-auto

Modified certbot-auto to work with Amazon Linux

  1. Search for
elif [ -f /etc/issue ] && grep -iq "Amazon Linux" /etc/issue ; then
  Bootstrap() {
    Experimental Bootstrap "Amazon Linux" BootstrapRpmCommon
  }
  BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"

2. Modified as below

 elif grep -i "Amazon Linux" /etc/issue > /dev/null 2>&1 || \
   grep 'cpe:.*:amazon_linux:2' /etc/os-release > /dev/null 2>&1;
  Bootstrap() {
    Experimental Bootstrap "Amazon Linux" BootstrapRpmCommon
  }
  BOOTSTRAP_VERSION="BootstrapRpmCommon $BOOTSTRAP_RPM_COMMON_VERSION"

3. Move to bin so that you can use it with the command

sudo mv ./certbot-auto /usr/local/bin

4. certbot debug start It puts necessary modules etc.

 certbot-auto --debug

Try it out

 certbot-auto certonly --standalone -t

If you get an error, stop the web server

end

I think I was able to get it without any problems. That’s it.