Hosting a WordPress Website on AWS LightSail with SSL
Tags: aws, wordpress, hosting, tutorial
Published: 2024-04-09 18:46:06


In today's "**oh where is my mobile phone**" age, having an online presence is like having ice-cream in summers. Whether you're a blogger, entrepreneur, or small business owner, creating a website can help you reach a wider audience and establish your brand. Hence, comes in Wordpress, being the easiest and most accessible tool for the matter. Now, development aside, the question comes in about hosting the website. Where to host it so that it remain the safest yet accessible plus easy to manage, plus cheap, plus all-in-one management. There comes AWS in picture.  With the power of **AWS Lightsail**, launching a WordPress site has never been easier. AWS Lightsail is a simplified cloud service that offers virtual private servers (VPS) with a user-friendly interface and predictable pricing.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6iju7ypoh99s3cahmn4l.jpg)

### First thing: Why choose lightsail above other hosting?

1. **Simplicity:** Lightsail offers a simplified user interface and easy-to-use tools that make it straightforward to deploy and manage virtual private servers (VPS) and applications.

2. **Predictable Pricing:** One of the standout features of Lightsail is its predictable pricing model. Unlike some other cloud services that charge based on usage or complex pricing structures, Lightsail offers flat-rate pricing with transparent billing. Plus there is always AWS pricing calculator for that. Visit [this Link](https://aws.amazon.com/lightsail/pricing/?gclid=Cj0KCQjwztOwBhD7ARIsAPDKnkCv3xqGVoSqLI1_JWNOAZDTQBnRQ6UYufRr7fLQtsp3ysWiaxt_SgYaApEiEALw_wcB&trk=507b4414-55b0-4543-aece-488381229e4e&sc_channel=ps&ef_id=Cj0KCQjwztOwBhD7ARIsAPDKnkCv3xqGVoSqLI1_JWNOAZDTQBnRQ6UYufRr7fLQtsp3ysWiaxt_SgYaApEiEALw_wcB:G:s&s_kwcid=AL!4422!3!536451955673!e!!g!!aws%20lightsail%20pricing!11542872454!112556718156) to see the pricing. Also, Lightsail offers a free tier for around first 3 months, allowing you to explore the platform without incurring any charges.

3. **Scalability:** While Lightsail is designed to be simple and easy to use, it still offers scalability for growing websites and applications. Users can easily upgrade their instances to larger sizes or add additional resources such as storage, RAM, or CPU as needed, ensuring that their hosting environment can scale with their business.

4. **Integration with AWS Services:** Lightsail is part of the larger AWS ecosystem, which means it integrates seamlessly with other AWS services such as Route 53 for DNS management, S3 for storage, and CloudWatch for monitoring. This makes it easy to leverage additional AWS services to enhance the functionality and performance of your website or application.

5. **Security:** As a service provided by AWS, Lightsail benefits from the security of the AWS infrastructure. AWS data centers are highly secure and adhere to industry-leading standards for data protection and compliance.

6. **Reliability:** Lightsail includes features such as automated backups and snapshots to help users protect their data and recover from any potential disasters.

Overall, AWS Lightsail offers a compelling combination of various metrics making it a top choice.

## Lauching Virtual Server with Wordpress(Instance)

 Go to the lightsail dashboard and from the left hand side navigation, choose "Instances". Click on create instance. This will open a screen with various choices. First is to select the region where you wish to launch the instance and the availability zone as well. Choose the region nearest to your customer base so as to decrease latency.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3q4o14zpt3xu1ov0intp.png)

Now, choose the "WordPress" blueprint, which is a pre-configured image optimized for running WordPress sites. Choose linux/unix as operating system. If you are not comfortable with linux, you can choose windows OS as well.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr75ig8gx3gp7j08ykpa.png)

Now, for additional security, create a new SSH key-pair. Note: you'll need this to connect to the instance. Before that, there is option to enable automated snapshots. If you enable this, LightSail will take automatic snapshots of your instance everyday. The snapshots for the last 7 days will retain and the older snapshots will be deleted.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/byi20uyc60irxfrn6qwg.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tk37qhz1xjwqyu8i3azp.png)

Next is to select the size of the instance. Select the instance plan that best suits your needs – the smallest plan should be sufficient for most personal or small business websites.

Give name to your instance. Add necessary tags as per your requirement. Click on "create instance."

Now, once the instance is created, open the instance. TO access the Wordpress Admin Panel, click on the "Access WordPress Admin" on the top right corner. You will get the link with the IP on the pop-up. Click on that and you will be redirected to the access page.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/26s32kxsh4b4r1yzqrov.png)

The default username of the login is"**user**". For password, go back to your instance and select "retrieve default password" option. Now, this will give you steps to retrieve the default password. Copy that and you can access the wordpress admin panel.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qexyr7wiskn6udu7x3py.png)

The screen for password will look something like this.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gjumiemci421cepsbjhr.png)

Finally, you are in officially in business. Now, apply all the knowledge you have of wordpress and build a website like never before. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5lex4eegx7a9d6b635g.png)

## Connecting to DNS

Now, go to the instance. You will see the public IP for you instance. Copy that. Go to your DNS provider and add A record pointing to that IP. Now, anyone going to the URL will see the amazing wordpress website you created. 

## SSL

Now comes the important part. How to add SSL to the website. Don't worry, I got you covered (I mean AWS got you covered).

For this, open the instance page. Select the connect tab and scroll down till you see "connect using SSH" option.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4qblnz1jkf0hheyl14f.png)

Now, we will use the bncert tool to request an SSL/TLS certificate from Let's Encrypt. Note that using this toll will make the process simpler but is valid only for the domains and subdomains you mention while creating the SSL certificate. Enter the command: 
```
sudo /opt/bitnami/bncert-tool
```
After this, you may be asked to whether you want to download update. Proceed as per your preference. Next is to insert the domain list that you want the certificate to be valid for. Enter those.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r4jadmhh5pozrrionf78.png)

The next options depend on the domains you add. If you are adding www domain, you will be asked a few preferences for redirections. If not, you will be warned you for the absence of www domain. Then the action steps will be displayed and your consent to proceed will be asked.  

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8y1ku5ahwk73chg4o6k5.png)

Now, enter a valid email address to associate the certificate with.

Once the process is completed, your site will have SSL certificate attached and your site will be redirected for http to hppts. 

Launching a WordPress site on AWS Lightsail is a straightforward process that can be completed in just a few easy steps. By following this guide, you can quickly deploy your site to the cloud and start reaching your audience online. With the power and flexibility of AWS Lightsail, the possibilities for your website are endless. Happy Wordpressing or AWSing or LightSailing ... Whatever you like!