Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Implementing and Scaling a LAMP App in Lightsail

In this learning activity, we will implement a LAMP stack on a single Lightsail instance and then migrate it to a scalable full-tier architecture. The goal of the learning activity is to gain experience with: * Creating a LAMP Lightsail instance * Creating a Lightsail managed database instance using MySQL * Reconfiguring a LAMP application to use the Lightsail managed database * Cloning a front-end application server * Scaling an application front end * Adding a load balancer to distribute incoming load

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 30m
Published
Clock icon Jan 28, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create the managed database, load balancer, and LAMP instance.

    Create a LAMP Instance

    1. Make sure the region is set to us-east-1.
    2. Select the LAMP (PHP 5) blueprint.
    3. Select the 2 GB instance plan.
    4. Name the instance PHP-fe-1.

    Create a Lightsail Database Instance

    1. Ensure the region is set to us-east-1.
    2. Pick the default MySQL version.
    3. Check the box next to Specify Login Credentials and enter your credentials. Use the password taskstasks.
    4. Select the High Availability plan.
    5. Select the 2 GB instance size.
    6. Name the database todo-db.

    Create a Lightsail Load Balancer

    1. Ensure the region is set to us-east-1.
    2. Name the load balancer todo-lb.
  2. Challenge

    Configure and deploy the application on a single instance.

    1. Log in to the PHP-fe-1 instance using SSH.
    2. Follow the steps listed at https://github.com/linuxacademy/aws-lightsail-deep-dive/blob/master/Scenario3/learning_activity_3/1_fe_monolith_commands.sh.
    3. Complete the application installation at http://INSTANCEIP/install.php.
    4. Verify that the application is functional at http://INSTANCEIP.
    5. Create the task remember to buy a cat.
  3. Challenge

    Migrate the application to the managed database instance.

    1. Log in to the PHP-fe-1 instance.
    • Complete the database migration steps up to and including line 24 at: https://github.com/linuxacademy/aws-lightsail-deep-dive/blob/master/Scenario3/learning_activity_3/2_migrate_to_managed_db.sh
    • Create the database tables on the managed database instance using http://INSTANCEIP/install.php.
    • Verify the application's functionality at http://INSTANCEIP.
    • Complete the database migration steps from line 28 onwards at https://github.com/linuxacademy/aws-lightsail-deep-dive/blob/master/Scenario3/learning_activity_3/2_migrate_to_managed_db.sh
    • Verify the application at http://INSTANCEIP. You should see the remember to buy a cat task.
  4. Challenge

    Scale and load balance the front-end tier.

    1. Create a snapshot of the PHP-fe-1 instance.
    • Use the snapshot to create two additional instances: PHP-fe-2 and PHP-fe-3.
    • Verify that both new instances function at http://INSTANCEIP.
    • Attach PHP-fe-1, PHP-fe-2, and PHP-fe-3 to the todo-lb load balancer.
    • Navigate to the DNS endpoint of the load balancer and ensure it functions correctly. Refresh the page and make sure that the IP address changes between front end servers.
    • Stop two instances and ensure that there is no service interuption.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans