I previously wrote about experimenting with AWS Lightsail product which provides a quick out-of-the-box solution to get people up and running.
Lightsail is a simple out-of-the-box solution to get developers up and running with minimal configurations. Although great at first, this can cause some headaches in the future. The biggest one would be the lack of an upgrade path for some essential packages like PHP, MySQL, Drush, etc.
In this tutorial, we will take a look at how we can solve this limitation and still utilize Lightsail as an option to host our Drupal sites.
- Connect to your current Drupal instance through your AWS console.
- Go to your application directory by running:
cd /stack/drupal/
- Create database backup of your site(s) using drush
drush sql:dump --result-file=../db-backups/SITE.sql
- Download the database backups to your machine by using your FTP client.
- Download files directory
- Create new Drupal Lightsail instance (New Lightsail instances use the latest Drupal recommended PHP,MySQL, Drush versions).
- Setup a static IP for your new instance
- Connect to server via console
- Install modules needed via composer
- If a lot of modules and libraries are needed it:
- Download the composer.json file from your old instance
- Drop the file into the Drupal project directory to overwrite the old file
- Run
composer update
- If a lot of modules and libraries are needed it:
- Connect FTP client to new instance
- Copy your database backup(s)
- Import back up by running:
drush sql:cli DATABASE_DUMP.sql
- Import files from old to new instance
- Load site on browser and verify that everything loads
- Sometimes you need to clear the cache on your site
drush cr
Hope this was helpful, until next time.
Comments