AWS Lightsail is a good option for maintaining websites easily. But, since it runs from a single physical server, failure rates can be high. Naturally, this causes downtime for your website.
But, is there a way to minimize the downtime ?
Yes. Luckily, AWS Lightsail supports snapshot creation that really helps during a website crash.
At Bobcares, we get requests from customers to make proper arrangements to backup their Lightsail websites as part of our Infrastructure Management Solutions.
Today, we’ll see how our Support Engineers properly setup Lightsail snapshots to avoid website failure.
Why Lightsail Snapshot?
Firstly, let’s discuss on the benefits of having Lightsail snapshots.
A Lightsail snapshot is a copy of the system disk and matches the original instance configuration such as memory, CPU, disk size, etc. It involves the option to get a copy of the installed additional disk too.
Usually, Lightsail snapshots cost $0.05 USD/GB-month for both instance snapshots and for disk snapshots. This means, to keep a snapshot of your 10GB website for a month, it would cost $0.5. Again, this depends on the time for which we keep the snapshot.
The top advantages of Lightsail snapshot include:
- Snapshots only consume space for used blocks of the disk
- They support incremental system. This means, it can take a copy of new or modified blocks since a previous snapshot
- Again, data storage happens on a pro-rata basis, so lesser the days of storage, cost would be less.
Similarly, with Lightsail snapshot, we can easily create a new instance in case of a system failure.
Some users may even think of backing up only the website files. But, it will be always difficult to recreate a computer with only some of the files and it is easy to miss some important configuration files. In short, from our experience in managing websites, Lightsail snapshot proves really useful in crash recovery.
How to setup Lightsail snapshot?
OK. We now know the benefits of having Lightsail snapshots.
But, does that mean we can have many snapshots of our instance?
Since every snapshot involves cost, its requires some planning on the backup schedule and the time of snapshot. Now, we’ll take a look on how our Support Engineers do this for our customers.
Step1. Create the snapshot
To create the snapshot, we first access the Lightsail account for the customer and then choose the exact instance. Then, we click on the Manage option on the shortcut menu.
Further, we choose Snapshots.
Then, we set a unique name for the snapshot, and then choose Create snapshot.
As the process completes, snapshot can be viewed from the Recent snapshots section.
2. Automate snapshot creation
Similarly, the snapshot should always depend upon a backup policy for the website. This backup policy depends on the type of website, amount of data, frequency of changes.
Thus, for a normal website, our Support Engineers take a Lightsail snapshot daily and only keep the last 5 snapshots. Here, we check and compare the snapshot size to ensure that it is complete. Again, for heavily changed websites, we increase the frequency to more snapshots depending on the cost the customer can afford to.
How to overcome challenges in live website?
However, from our experience in managing Lightsail instances, we often see customers facing real time issues during a website crash. Let’s now check how our Support Engineers proactively work to overcome such challenges.
1. Backing up application
Ideally, after restoring the Lightsail snapshot, the website should work correctly. But, this do not happen all the time. When we recover the snapshot, the PHP, Apache, and MySQL would start up just fine. But, applications like WordPress can fail due to some inconsistencies.
Here, our Support Engineers manually create backup of the application. For example, the WordPress app can be found in the directory /opt/bitnami. So, to backup everything related to WordPress, we make scheduled copies of this directory.
And, after a normal snapshot recovery, we replace this folder from backup.
Again, for additional security, we also recommend customers to keep the backup file to another backup server or Amazon S3 bucket too.
2. Managed Database snapshots
Yet another challenge happens with Lightsail managed databases.
Although, we can upgrade to Amazon EC2 from Lightsail disk snapshots, it do not currently support Managed database snapshots. And, this can cause database websites like WordPress, Magento, Joomla, etc. to fail.
As a workaround, our Support Engineers always keep a separate backup copy of the mysql database. Additionally, we use cron jobs to periodically get a database backup. This comes really handy during a recovery.
[Need help with automating Lightsail Snapshots? Our experts can help you.]
Conclusion
In short, Lightsail snapshots can work as life savers during website crash. Today, we saw how our Support Engineers setup Lightsail snapshots and fix the typical challenges in production websites.
0 Comments