AWS for WordPress: Getting starting with Light Sail, Cloud-front and Route 53 : Part-3
Published: 2023-12-05 16:36:29

Hello guys,

Welcome back to the third and last episode of this series. In this article, we will setup the Lightsail distribution, which is actually a world-wide CDN service specially designed for web apps to provide a faster experience to website visitors. After distribution setup, we will update our domain records for Lightsail distribution.

Click on the "**Network**" menu.

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

And now click on the "Create Distribution" button. Remember, before moving towards distribution setup, it's mandatory to assign static IP to your LightSail instance, as we did in Part 2.

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

Select origin from the drop-down menu as shown in the below screenshot, which means selecting your Lightsail instance.

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

By default, cache behavior is set to **WordPress**, so you don't need to do anything, but if you are using any other app on Lightsail instead of WordPress, then choose this option wisely.

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

Now it's time to select the distribution plan. Well, I am choosing the **50GB/month** plan for testing purposes, and it's also free for one year, but you can choose the plan according to your traffic.

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

In the final step, you need to assign the name for your distribution and click on the "Create Distribution" button. It will take a little bit of time to create the distribution; just sit back and take a sip of coffee.

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

After the successful creation of distribution, it's time to generate SSL certificates for distribution. Click on the "**Custom Domains**" tab, and then click on "Create certificate**" It will show you the pop-up where you need to enter your certificate name and domain name. I added my domain, including www.iotsnacks.com and iotsnacks.com.

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

It will take some time, and later it will show you a validation error. Click on "Validation Details," and it will guide you to add CNAME records to your domain. So in our case, we are using Route 53, and we will add these verification CNAME records to Route 53. Later on, it will automatically verify the records.

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

After domain verification, it will show you the "Attach certificate" option. Just click on that and attach the certificates to your distribution.

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

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

Now, in the final step, we need to route our domain traffic to this distribution. On the same page, at the end, you will see the URL of that distribution. Just copy the URL and navigate to Route 53.

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

In Route 53, click on "Hosted Zones" and select your domain, then click on "Create Record," and you will see the page just like below. Follow the instructions as per the below image, and you are good to go with the record addition.

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

Congratulations! You have successfully deployed your WordPress website on AWS using Route 53+ Lightsail and Lightsail Distribution, also known as Cloud Front.