Upgrading Drupal Instance in AWS Lightsail

By edgar, 7 December, 2022
Servers

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.

  1.  Connect to your current Drupal instance through your AWS console.
  2. Go to your application directory by running:
    cd /stack/drupal/
  3. Create database backup of your site(s) using drush
    drush sql:dump --result-file=../db-backups/SITE.sql
  4. Download the database backups to your machine by using your FTP client.
  5. Download files directory
  6. Create new Drupal Lightsail instance (New Lightsail instances use the latest Drupal recommended PHP,MySQL, Drush versions).
  7. Setup a static IP for your new instance
  8. Connect to server via console
  9. 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
  10. Connect FTP client to new instance
  11. Copy your database backup(s)
  12. Import back up by running:
    drush sql:cli DATABASE_DUMP.sql
  13. Import files from old to new instance
  14. Load site on browser and verify that everything loads
  15. Sometimes you need to clear the cache on your site
    drush cr

 

Hope this was helpful, until next time. 

Alias
upgrading-drupal-instance-aws-lightsail

Comments