- Lab
- A Cloud Guru
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
Path Info
Table of Contents
-
Challenge
Create the managed database, load balancer, and LAMP instance.
Create a LAMP Instance
- Make sure the region is set to
us-east-1
. - Select the LAMP (PHP 5) blueprint.
- Select the 2 GB instance plan.
- Name the instance
PHP-fe-1
.
Create a Lightsail Database Instance
- Ensure the region is set to
us-east-1
. - Pick the default MySQL version.
- Check the box next to Specify Login Credentials and enter your credentials. Use the password
taskstasks
. - Select the High Availability plan.
- Select the 2 GB instance size.
- Name the database
todo-db
.
Create a Lightsail Load Balancer
- Ensure the region is set to
us-east-1
. - Name the load balancer
todo-lb
.
- Make sure the region is set to
-
Challenge
Configure and deploy the application on a single instance.
- Log in to the
PHP-fe-1
instance using SSH. - Follow the steps listed at https://github.com/linuxacademy/aws-lightsail-deep-dive/blob/master/Scenario3/learning_activity_3/1_fe_monolith_commands.sh.
- Complete the application installation at http://INSTANCEIP/install.php.
- Verify that the application is functional at http://INSTANCEIP.
- Create the task
remember to buy a cat
.
- Log in to the
-
Challenge
Migrate the application to the managed database instance.
- 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.
- Log in to the
-
Challenge
Scale and load balance the front-end tier.
- Create a snapshot of the
PHP-fe-1
instance.
- Use the snapshot to create two additional instances:
PHP-fe-2
andPHP-fe-3
. - Verify that both new instances function at http://INSTANCEIP.
- Attach
PHP-fe-1
,PHP-fe-2
, andPHP-fe-3
to thetodo-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 interruption.
- Create a snapshot of the
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.