Tips on Migrating Your Blog to AWS Lightsail

I’ve been running my blog on WordPress using Host Gator for almost ten years. While I have never had problems with my hosting provider, I have wanted to explore options to migrate to either Azure or AWS. I recently read about how AWS Lightsail would be the most affordable and simple option. I then looked for documentation to help me with the migration and ran into a lot of conflicting information. Hopefully, the issues and solutions detailed below will help others wishing to migrate their WordPress blog to AWS Lightsail.

Getting Started

I spent a lot of time looking for documentation on how to migrate my WordPress site to Lightsail. I found two articles to be the most helpful starting points. Both of them have some overlap, but together, they got me through the migration. The first, Migrate an existing WordPress blog to Amazon Lightsail, walks you through the steps of exporting your current WordPress site to your new Lightsail instance.

Note: There are other articles out there that advise using services or plugins that cost money. Do not use them. The abovementioned article walks you through migrating your data for free.

There are only three things that I would add to this documentation. First, I would recommend turning on automatic snapshotting during the creation of the instance.

Instance Creation

The second is that I would recommend patience when doing the data import. The small XML file you download in the export phase only details what data to pull from your site. So, while uploading that file takes a few seconds, the actual data migration can take 10-20 minutes.

The third thing is that some things will need to be redone or cleaned up in this process. For example, in your new Lightsail instance, you must download the theme from your old site, reenter your site identity info, and clean up the sample pages and posts from your site.

Networking and Security

The second article, Quick Start Guide: WordPress on Amazon Lightsail, has a bit of overlap with the first but does a great job of addressing how to attach a static IP to your website (it is free, but you will be given a dynamic IP initially) and mapping a domain name to your website. The article provides a link to another article that goes into more detail about the DNS process.

The last thing that I needed help with was the SSL certificate process. The nice thing about Lightsail is that the SSL certificate you receive from Let’s Encrypt is free. What may discourage some is that it requires entering commands in the CLI to accomplish. However, I think that this article uses clear and simple steps to get your SSL certificate installed.

The only thing I ran into was that I ended up with a problem because my website showed up as insecure because of mixed content. I fixed this by using the Really Simple SSL WordPress plugin. I used the free version, which cleared up my issue with a few clicks.


I went through a lot of trial and error to migrate my website to AWS Lightsail. It is a pretty easy process that can save you a few dollars but, most importantly, help you gain a few new skills.

How to Create Your Own Dynamic DNS Service using Cloudflare Dynamic DNS

Learn how to set up a Dynamic DNS service with Cloudflare for free. Dynamic DNS allows you to update your DNS records automatically whenever your IP address changes, and Cloudflare makes it easy with its API. To start, create an API token with permission to edit DNS records and use a simple Bash script to update your DNS record with Cloudflare. The script is designed to run on your source machine and can be used to provide DDNS service from anywhere. With Cloudflare Dynamic DNS, you can use their CDN and security features to improve website performance and security.

Some Background

Dynamic DNS is used by many whose IP provider has given a dynamic IP address. While there are free services out there, it is typically a service that costs $25 a year. In this article, I will show you how to create your own script to manage dynamic DNS service using Cloudflare.

How it All Started

This all started with a Network Chuck video. For some background, I’ve been running NoIP as my dynamic DNS provider for several years. This, combined with port forwarding on my firewall, allowed me to VPN to my home network and RDP into my desktop PC while away from home.

This setup has worked for years, but the Network Chuck video highlighted the security issues surrounding punching holes in my network firewall. So, I followed his advice and the steps in his video to install a free Kemp load balancer and SSL offloader on my network. The Kemp load balancer acts as a reverse proxy, forwarding external requests to my internal resources, and SSL offloading ensures that my connections are secure.

While this was a great step forward regarding network security, it also meant that my dynamic DNS provider was no longer working. NoIP relies on a client-side application to periodically update your IP address with their DNS servers. Still, with the Kemp load balancer in place, I needed a more flexible solution.

Cloudflare Dynamic DNS

Enter Cloudflare Dynamic DNS. Cloudflare is a CDN and security company that offers a suite of services to improve website performance and security. One of their services is Dynamic DNS, which allows you to update your DNS records automatically when your IP address changes.

The best part? Cloudflare Dynamic DNS is completely free!

To get started, you must sign up for a Cloudflare account and create a new API token with permission to edit DNS records. Once you have your API token, you can update your DNS records using Cloudflare’s API.

Creating Your Dynamic DNS Script

To simplify things, I modified a simple Bash script that I found on GitHub that updates my DNS records with Cloudflare. Here’s the script:


# A bash script to update Cloudflare DNS A records with the external IP of the source machine

# Proxy - uncomment and provide details if using a proxy
# export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>

# Cloudflare zone is the zone which holds the records

# DNS records to be updated

# Flag for Cloudflare proxy status (true or false, lower case in script logic, correctly formatted in JSON payload)

# Cloudflare authentication details file path

# Get the Cloudflare authentication key from the file
cloudflare_auth_key=$(cat "$cloudflare_auth_file")

# Get the current external IP address
current_ip=$(curl -s -X GET

echo "Current IP is $current_ip"

# Loop through the DNS records and update if necessary
for dnsrecord in "${dnsrecords[@]}"; do
    cloudflare_zone_id=$(curl -s -X GET "$zone&status=active" \
      -H "Authorization: Bearer $cloudflare_auth_key" \
      -H "Content-Type: application/json" | jq -r '.result[0].id')

    cloudflare_dnsrecord=$(curl -s -X GET "$cloudflare_zone_id/dns_records?type=A&name=$dnsrecord" \
      -H "Authorization: Bearer $cloudflare_auth_key" \
      -H "Content-Type: application/json")

    cloudflare_dnsrecord_ip=$(echo $cloudflare_dnsrecord | jq -r '.result[0].content')
    cloudflare_dnsrecord_proxied=$(echo $cloudflare_dnsrecord | jq -r '.result[0].proxied')

    if [[ "$current_ip" == "$cloudflare_dnsrecord_ip" ]] && { [[ "$use_proxy" == true ]] && [[ "$cloudflare_dnsrecord_proxied" == true ]] || [[ "$use_proxy" == false ]] && [[ "$cloudflare_dnsrecord_proxied" == false ]]; }; then
        echo "$dnsrecord DNS record is up to date"
        cloudflare_dnsrecord_id=$(echo $cloudflare_dnsrecord | jq -r '.result[0].id')
        # Update the record
        update_response=$(curl -s -X PUT "$cloudflare_zone_id/dns_records/$cloudflare_dnsrecord_id" \
          -H "Authorization: Bearer $cloudflare_auth_key" \
          -H "Content-Type: application/json" \
          --data "{\"type\":\"A\",\"name\":\"$dnsrecord\",\"content\":\"$current_ip\",\"ttl\":1,\"proxied\":$use_proxy}")
        echo "$dnsrecord DNS record has been updated with the current IP: $current_ip"

To use this script, replace the variable with your own values.

Save the script to a file (e.g. and make it executable with

chmod +x

Also, the script reads the Cloudflare API key from a file named cloudflare_auth_key.txt . This is easy enough to create using nano. nano cloudflare_auth_key.txt will create the file. Then, copy and paste the key into the file and save it.

Finally, set up a cron job to run the script periodically (e.g., every 10 minutes) to ensure that your DNS records are always up to date. Here’s an example cron job:

*/10 * * * * /path/to/ > /dev/null 2>&1


And that’s it! You can create your own dynamic DNS service using Cloudflare for free with a few simple steps. This will ensure that your DNS records are always up to date, even when your IP address changes.

By using Cloudflare Dynamic DNS, you can also take advantage of Cloudflare’s CDN and security features to improve website performance and security. And best of all, you don’t have to worry about the security risks of opening up your network firewall.

So go ahead and give it a try!