Lightsail is an amazing service by AWS. It's beginner-friendly and someone who is new to AWS should begin with it to get the hang of it. It offers Virtual servers, storage, databases, and networking for a low and easy-to-understand prices. Lightsail also supports Load balancers, CDN and containers now!
In this tutorial, I am going to show you how easy it is to launch your WordPress website on AWS Lightsail with SSL and your domain.
Make sure you have downloaded the SSH key (we will need this later on) before proceeding. If you don't like the default one you can create a new one using "Create New". Leave "Enable Automatic Snapshots" for now, we will cover snapshot later on
If you enter the IP address in the browser tab you will notice that it has installed WordPress with the latest default theme - twenty twenty one (at the time of writing)
🎉 Congratulations! You have launched your own WordPress website. Let's attach an SSL certificate and domain to it and get admin credentials.
This will attach a static IP to your instance (WHich essentially means that your IP will be the same even after you restart your instance). Your website will only be accessible with the new IP now (not the previous one). After the static IP has been created and attached it will show you the IP details page. Click on the AWS Lightsail logo from the top left corner to go back to the AWS Lightsail dashboard
I am using AWS Route 53, but the setup is pretty much the same for every domain registrar (GoDaddy, Namecheap, Dreamhost, Hostgator, etc.)
You should be able to access your website using your domain now. Please note that it can take up to 72 hours to complete DNS propagation, so don't worry if you are not able to access your website using the domain name right away.
The next step is to generate and attach an SSL certificate. For that connect to your website using SSH by the following command
ssh -i <path_to_your_key> bitnami@<your-domain-or-ip>
When prompted for adding to the known host list, type
yes and press enter
If it says something about bad permissions then run the following command to change the key file permissions
sudo chmod 400 <path_to_your_key>
Once you have logged in to your instance (via ssh), run the following command
It will ask you a series of questions. Enter in the domain name you are using (add www version too if you intend to use it). Type
Y and press enter when it asks for "Enable HTTP to HTTPS redirection", and "Do you agree to these changes?". Enter in your email address, again type
Y and press enter when it asks "Do you agree to the Let's Encrypt Subscriber Agreement?"
While being logged in to your instance (via ssh), run
sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
- We used Let's Encrypt Free SSL and Lego Client behind the scenes to generate a free SSL and then set-up a
cronjob to renew the SSL certificate automatically when it expires
- In AWS Lightsail you can take snapshots (full-fledged cloned images of your instance) by going to the Instance page and then selecting the snapshot tab. Using snapshots you can take backups, keep older versions of your website or you can create larger size (upgraded) instances. The AWS Lightsail snapshots are pretty cheap, you can check the prices here
- It's a simple option and works really well, I am using AWS Lightsail for hosting my small baby clothes store: 🍼 Toddos Club