Letsencrypt with ELB

Installation


  1. SSH to test server
    ssh ec2-user@52.202.36.69



Generate SSL cert for one or multiple domains
  1. Run certbot
    cd certbot-master
    sudo ./letsencrypt-auto certonly --webroot --webroot-path /home/jetty/webapps/multisite --email info@notey.com -d mahoganyavenue.ultrasite.io
  2. Get the cert under /etc/letsencrypt/live/domain
    sudo su
    cd /etc/letsencrypt/live/domain
  3. Upload the cert to AWS IAM
    aws iam upload-server-certificate --server-certificate-name {certname} --certificate-body file://cert.pem --private-key file://privkey.pem --certificate-chain file://chain.pem


*** NEW ***
Go to Elastic Load Balancer, select Ultrasite-v2 (Application)
Add certificates
Copy and paste the cert from /etc/letsencrypt/live/domain
Add

Remove old certs
aws iam delete-server-certificate --server-certificate-name mahogany.2018-08-29e 


Use the SSL cert in AWS Elastic Load Balancer


Manual method:
    Go to EC2 -> Load Balancer -> Select the load balancer -> Listeners -> Add a protocol and use an uploaded IAM cert.
Make sure the port 443 is on for the security group associated with the load balancer.

Aws Configure:
AWSAccessKeyId AKIAJYQVKXOGBBMCFRJA
AWSSecretKey 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


Command line:
Create https listener
Get the listener arn
 
aws elbv2 add-listener-certificates --listener-arn arn:aws:elasticloadbalancing:us-east-1:610548120181:listener/app/Letsencrypt/df5d6be356c5cef8/8816f916b56b8d74 --certificates CertificateArn=arn:aws:iam::610548120181:server-certificate/mahogany


Renew Cert
sudo -H /opt/eff.org/certbot/venv/bin/letsencrypt certonly --standalone --renew-by-default -d blog.cuveesfinewines.com



Renew the cert automatically
  1. Crontab -e
  2. * * * * * /home/ec2-user/certbot-auto renew --quiet


Cert is in /etc/letsencrypt/live
https://www.linode.com/docs/security/ssl/install-lets-encrypt-to-create-ssl-certificates



$ pip install awscli --upgrade --user

aws elbv2 describe-load-balancers

aws elbv2 describe-listeners --load-balancer-arn arn:aws:elasticloadbalancing:us-east-1:610548120181:loadbalancer/app/Letsencrypt/df5d6be356c5cef8
 


Comments