# Install wget
yum install wget -y

# Install certbot-auto
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto

# Obtain SSL certificate with Nginx plugin for the domain
sudo ./certbot-auto --nginx -d app.com --debug

# Test SSL configuration
https://www.ssllabs.com/ssltest/analyze.html?d=app.com

# Configure cron job for SSL auto-renewal
sudo crontab -e

# Add below lines in crontab to check for certificate renewals periodically
PATH = /home/ec2-user/:/usr/local/sbin:/usr/local/bin:/bin:/usr/sbin:/usr/bin
0 6 * * * certbot-auto renew --text >> /home/ec2-user/certbot-cron.log