Setting up an SSL Certificate(Let's Encrypt) on AWS Lightsail

Posted by Derek McAuley on May 29th, 2017

I have started building AWS Lightsail websites in work and we needed to set up an SSL cert for the websites.
I found the guides on other sites helpful however some of the commands didn't work, not all details were covered or I ran into issues which I have covered here.
So here is my step by step guide on setting up the free SSL cert on AWS lightsail.

Note: Please replace example.com with your domain name.

Login to your Lightsail AWS account.

Connect using your the browser SSH client:
This will install git, clone the cerbot repo and chnage the directory to cerbot.

Connect using the browser SSH client

You should get a new Window open with the Lightsail server terminal

Lightsail server terminal

Type the below commands into the terminal.

cd /tmp
                  
sudo apt-get git

git clone https://github.com/certbot/certbot

cd certbot

./certbot-auto

How you just need to generate and install your Let's Encrypt certificate

cd certbot

./certbot-auto certonly --webroot -w /opt/bitnami/apps/wordpress/htdocs/ -d example.com

Two certificate will now be in the /etc/letsencrypt/live/example.com folder This set includes the server certificate file cert.pem and the server certificate key file privkey.pem.

Let's Encrypt installed

install the generated certificate in your Web server

sudo ln -s /etc/letsencrypt/live/example.com /fullchain.pem /opt/bitnami/apache2/conf/server.crt

sudo ln -s /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key
sudo /opt/bitnami/ctlscript.sh restart apache

If this fails run the below commends.

sudo unlink /opt/bitnami/apache2/conf/server.key

sudo unlink  /opt/bitnami/apache2/conf/server.crt


sudo /opt/bitnami/ctlscript.sh restart apache

sudo ln -s /etc/letsencrypt/live/example.com /fullchain.pem /opt/bitnami/apache2/conf/server.crt

sudo ln -s /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key
sudo /opt/bitnami/ctlscript.sh restart apache

All going well you should see the below output:

Unmonitored apache
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd stopped
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80
Monitored apache

Redirect all your domains to the https version e.g http://example.com will redirect to https://example.com


RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ http://example.com$1 [R=permanent,L]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

...


RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com$
RewriteCond %{HTTP_HOST} !^(localhost|127.0.0.1)
RewriteRule ^(.*)$ https://example.com$1 [R=permanent,L]
...



Why not leave a comment below.


Name:

Comments:




Comments:

Taalaibek:
It helped me. Thank you.

.................


Karthikeyan Raju:
I got this Error (http-01): urn:acme:error:unknownHost :: The server could not resolve a domain name :: No valid IP addresses found for mydomain.in

.................


Keldrat:
Cialis Para Diabeticos Dental generic 5mg cialis best price Viagra Aus Der Turkei Kamagra Deutschland Paypal 100 Mg Viagra Price

.................


Keldrat:
Cialis Generique En Ligne Viagra Contre Stress Online Drugstore Canada canadian pharmacy cialis 20mg Acquistare Cialis Online Viagra Original Pas Cher En La Seyne Viagra Prezzo Svizzera

.................


buy viagra online:
In September 2009, Pfizer agreed to pay to settle civil and criminal allegations that it had illegally marketed four drugs—, , , and —for non-approved uses; it was Pfizer's fourth such settlement in a decade. generic viagra Expect you’ll encounter a superb work of force specifically in the matchup you are lacking the creating knowledge and experience about educational dissertation posting, when you prepare the document by yourself.

.................


chuteira society nike mercurial vortex 3 cr7 tf infantil:
lunette soleil ray ban polaris茅 hommelunettes de soleil julbo 39 13 rose vue de facelunettes simulation alcool茅mie pro 75lunettes de soleil vuarnet cup large noir mat bleu pure grey blue flash 128675 chuteira society nike mercurial vortex 3 cr7 tf infantil [url=http://www.naijachoices.com/rope/chuteira-society-nike-mercurial-vortex-3-cr7-tf-infantil]chuteira society nike mercurial vortex 3 cr7 tf infantil[/url]

.................


camisa social branca feminina principessa scarlett:
macbook air 11 core i5 1table cuisson gaz thermocouple achat table cuisson gazbest voltx constructor lunettes de s茅curit茅 pour porteurs de lunettes de lecture transparentesmoins cher lunettes de soleil julbo j370 3114 noir avec des verres jaune pour mixte noir camisa social branca feminina principessa scarlett

.................


cheap viagra online:
Taken recreationally, however, the only counsel you receive may be from a buddy recounting the tale of his indomitable boner during an epic sex session. buy viagra Although they have been shown to be very effective, they may come with a certain amount of discomfort.• Use a vacuum pump.

.................


camicie piombo ermanno scervino camicie donna blusa pizzo:
camisa do palmeiras i 2017 adidas infantilboa apar锚ncia under armour t锚nis speedform gemini 2 1 t锚nis esportivos tamanho 42 homembota cano curto feminina malbork couro leg铆timo e salto fkv cal莽adosa cidade mais caliente dos estados unidos pode ser uma 贸tima op莽茫o para o seu interc芒mbio fica a apenas 8h de voo de s茫o paulo ou 6h30 de fortaleza camicie piombo ermanno scervino camicie donna blusa pizzo

.................


more views. asics gel nimbus 20 stockholm marathon womens running shoes yellow:
buy hot sale black grey suede boots thigh high boots high heels long boots over the knee boots fashion shoes woman in cheap price onphilips s5050 06 aquatouch electric shaver amazon.in healthuae may see big switch to diesel vehicles after fuel pricing changefor love lemons dixie mini dress dolls kill more views. asics gel nimbus 20 stockholm marathon womens running shoes yellow

.................


mens dress shoes buy mens business shoes online myer:
hugo boss orange mens boat shoes newlan tan suede deck shoetrue religion true religion night suspect rocco jeans men fromedwin ed weisenhorn obituary thorntonmilan fashion week dsquared2 autumn winter 14 buro 24 7 mens dress shoes buy mens business shoes online myer

.................


buy womens sportswear sportswear berghaus berghaus from the next uk:
cotswold camping bootie slippers j d williamskeen atlanta cool steel toe shoes gemplersbuy aden anais classic burpy bibs high seas at well.ca free shipping 35 in canadacarven menswear spring 2014 fashion daily mag buy womens sportswear sportswear berghaus berghaus from the next uk

.................


girls activewear camisole c9 champion pink xl target:
the folio bag in french grey saffiano the cambridge satchelsuperdry japan beige light jacket ladies zip buttoned cotton s 1038hugo boss orange eau de toilette 30ml for sale in limerick cityemerica mens the romero laced skate shoe girls activewear camisole c9 champion pink xl target

.................


flex dani black white pediped footwear comfortable shoes for:
babyliss pro perfect curl mkiiaspinal of london purseforuml1106d2 miss lulu oilcloth travel bag polka dot blackparis dress designer brands dkny parnell baby boutique flex dani black white pediped footwear comfortable shoes for

.................


artisan rugs 01 taupe buy online from the rug seller uk:
mens fashion mens designer clothes 2018 farfetchelle foreo spain luna facialbrush ellebeautyawards revista elleextra 30 off factory outlet g.h bass dealmoonmarc jacobs playback leather crossbody bag artisan rugs 01 taupe buy online from the rug seller uk

.................


hot sale dooney bourke cambridge crossbody saddle bag:
penny loafers woven leather loafer penny loafer bass brown etsycatokan babyliss ipro 230 icurl gold 2in1 check babylissavoca wholesale italian linen baggy belted trousers women trousersscott kids 350 track junior jersey black white hot sale dooney bourke cambridge crossbody saddle bag

.................


black jack shaving cream:
canadian diesel online lloydminstermaxman elite male enhancement pills erection pills enlargement pills for men increase24 澧ㄥ皵鏈井鐢熸椿welifeclarks wallabee boot black leather zappos.com free shipping both ways black jack shaving cream

.................


new michael vick 7 atlanta falcons m n throwback jersey black:
sunglasses forfait le s1821 choc 58 14 unisex chocolat rectangleallkase coque samsung galaxy s4 mini en silicone gel motif emojiray ban clubmaster rosehoover plaque de cuisson 5 feux garantie 2 ans 脿 prix pas cher new michael vick 7 atlanta falcons m n throwback jersey black

.................


real photo new vestidos de novia cheap red white wedding dresses o neck short sleeves plus size bride gowns frocks hs161:
black silver glitter shoes made for 18 american girl doll clothesmodabelle romantic outside wedding flowers bridal bouquets artificial bridesmaid flower bouquet wedding bouquet for flower girls in wedding bouquets fromruthshen short knee length cocktail dresses half sleeves lace black party dresses for women special occasion vestidos coctel1pcs a4 size 21x29cm pink candy colors chunky glitter leather for bow diy handbags shoes mk076a real photo new vestidos de novia cheap red white wedding dresses o neck short sleeves plus size bride gowns frocks hs161

.................


EllAttire:
Super Cialis 100mg Achat Cialis France buy generic cialis online Buy Finasteride 1mg Propecia Side Effects Purchase Isotretinoin Price In Internet Levitra By Bayer

.................


EllAttire:
Generic Isotretinoin Pills disulfiram Cialis Inde

.................


Aimee:
Hey there, You have done a fantastic job. I'll certainly digg it and personally suggest to my friends. I am confident they will be benefited from this website. fodboldtrøjer TeresitaL fotballdrakter BrandonLa

.................


Shanon:
Thanks for the auspicious writeup. It in fact was once a enjoyment account it. Look complex to far brought agreeable from you! However, how could we communicate? Maglia liverpool Princessi fodboldtrøjer VerlaLowe

.................


Simone:
Incredible points. Sound arguments. Keep up the great effort. Billiga Liverpool Kläder AlannahBa Real Madrid tröja KittyBlal

.................


Marcus:
Good post. I learn something totally new and challenging on sites I stumbleupon on a daily basis. It's always interesting to read through content from other writers and practice a little something from other websites. Günstige fußballtrikots RandolphH maglie calcio WilburmuU

.................


EllAttire:
Zithromax Tendon Problems Site Fiable Pour Achat Kamagra generic cialis Comprar Viagra Contrareembolso En Espana

.................


Kristen:
Hi colleagues, pleasant post and pleasant urging commented here, I am truly enjoying by these. fodboldtrøjer til børn JoeyWeise fotbollströjor barn FelipaHin

.................


Kathlene:
Have you ever considered about adding a little bit more than just your articles? I mean, what you say is fundamental and everything. Nevertheless think of if you added some great images or video clips to give your posts more, "pop"! Your content is excellent but with pics and clips, this blog could certainly be one of the greatest in its niche. Excellent blog! Billige Fodboldtrøjer

.................


JaneCoali:
clomid buy online

.................


LisaCoali:
nolvadex 20

.................


AmyCoali:
proscar 1mg

.................


EvaCoali:
proscar

.................


JasonCoali:
indomethacin indocin cephalexin 250mg cialis buy online dapoxetine albuterol no prescription hydrochlorothiazide paxil sildenafil prednisone 20mg clomid

.................


AnnaCoali:
allopurinol no rx buy nolvadex online cheap doxycycline 100mg diflucan buy cipro xr

.................


KiaCoali:
buy indocin

.................


SamCoali:
advair generic dapoxetine doxycycline azithromycin kamagra tablets zoloft generic brand cephalexin 250 mg where can i get arimidex tadacip paxil cost

.................


CarlCoali:
estrace hair loss buy proscar kamagra how much is cephalexin cialis advair diskus 250/50

.................


MiaCoali:
buy sildenafil citrate cechalexin 250 buy kamagra viagra tadalafil estrace 1 mg dapoxetine hcl vardenafil 20 mg

.................


PaulCoali:
dapoxetine tadalafil 10 mg ciprofloxacin 500 mg with out prescription indocin 50 mg elimite

.................


EyeCoali:
colchicine price generic viagra sildenafil 100mg buy doxycycline cephalexin 250mg capsules hydrochlorothiazide 25 mg tab vardenafil 20 mg estrace fluoxetine drug azithromycin online cipro

.................


DenCoali:
kamagra zoloft 25mg

.................


EvaCoali:
lisinopril

.................


AlanCoali:
price of allopurinol vardenafil hcl 20mg where can i buy elimite hydrochlorothiazide 25mg buy cephalexin online 2.5 mg cialis estrace dapoxetine buy arimidex doxycycline diflucan generic advair azithromycin tadacip generic of paxil buy albuterol inhaler generic viagra cost indocin sildenafil tadalafil tablets

.................


JudyCoali:
cheap kamagra prednisone indocin proscar where to buy colchicine tadalafil generic advair diskus doxycycline 50 mg online prescriptions for viagra hydrochlorothiazide 25mg

.................


JudyCoali:
prednisone 10 estrace tablets hydrochlorothiazide tab 25mg allopurinol 100mg diflucan 150 mg price doxycycline 100mg tablets no prescription elimite online lisinopril proscar generic zoloft cost

.................


SueCoali:
generic tadacip dapoxetine online purchase zoloft keflex 500 generic tadalafil how much does viagra cost doxycycline cialis online buy generic for advair diskus kamagra paxil nolvadex azithromycin prednisone over the counter vardenafil order order diflucan permethrin cream lisinopril generic brand sildenafil colchicine 0.6 mg tablets

.................


MarkCoali:
cephalexin 250mg advair diskus generic buy dapoxetine usa lisinopril

.................


Winfred:
Heya i'm for the first time here. I found this board and I find It truly useful & it helped me out a lot. I am hoping to offer one thing back and help others like you helped me. Liverpool Trøje

.................


MaryCoali:
dapoxetine 60mg advair price vardenafil buy sildenafil indocin 50 mg tablets azithromycin buy online where to buy arimidex clomid buy online buy proscar doxycycline purchase

.................


KiaCoali:
azithromycin tablets 250 mg

.................


JaneCoali:
tadacip

.................


JasonCoali:
buy arimidex clomid sildenafil paxil buy cheap diflucan online tadacip 20mg vardenafil 20mg tablets cephalexin cipro buy indocin

.................


NickCoali:
cephalexin 500 mg tadacip sildenafil citrate buy proscar where to buy kamagra

.................


NickCoali:
indocin cost of generic viagra vardenafil purchase allopurinol online buy zoloft without prescription

.................