For EC2 instances that are running Amazon Linux 2 AMI, you have to enable EPEL repository:
sudo yum update
sudo amazon-linux-extras install epelThen you can install nginx and certbot
sudo amazon-linux-extras install nginx1.12
sudo yum install -y certbot python2-certbot-nginxAfter setting up your nginx configs with the proper server_name tags, you can install the certificates
sudo certbot --nginx -d yourdomain.comnginx won't start automatically with the system, so you have to setup:
sudo chkconfig nginx onor
sudo systemctl enable nginxAlso, for some reason, EC2 won't work correctly after nginx install, so reboot the machine.
sudo reboot
Subscribe
Join the newsletter to get the latest updates.