#!/bin/bash
#
# 1. create a EC2 instance with public IP
# 2. create a A RR in route53 pointing your.domain.com to the public IP
# 3. make sure HTTP/HTTPS ports(80 443) are public to all in security group of this EC2 instance
# 4. make sure docker daemon is running in this EC2 instance
# 5. run this script !
# 6. keys/cert will be generated under /root/letsencrypt/etc/live/
mkdir -p /root/letsencrypt/log /root/letsencrypt/lib /root/letsencrypt/etc
email='your_email@gmail.com'
domain='your.domain.com'
docker run --rm -it -p 80:80 -p 443:443 -v "/root/letsencrypt/log:/var/log/letsencrypt" -v "/var/www/:/var/www/" -v "/root/letsencrypt/etc:/etc/letsencrypt" -v "/root/letsencrypt/lib:/var/lib/letsencrypt" lojzik/letsencrypt certonly --email $email -d $domain --standalone