Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active August 31, 2017 04:27
Show Gist options
  • Save pahud/12d9cca1cd7a664c63af0189f08df32f to your computer and use it in GitHub Desktop.
Save pahud/12d9cca1cd7a664c63af0189f08df32f to your computer and use it in GitHub Desktop.
letsencrypt cert generator with docker
#!/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
@pahud
Copy link
Author

pahud commented Oct 15, 2016

create domain name on api gateway

aws --region=us-east-1 apigateway create-domain-name --domain-name your.domain.com --certificate-name your.domain.com --certificate-body file://cert.pem --certificate-chain file://chain.pem --certificate-private-key file://privkey.pem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment