AWS Laravel

Laravel application with MySQL using AWS Elastic Beanstalk – Part 2

In the previous tutorial, we have successfully created a Laravel application and deployed into AWS using Elastic Beanstalk. In this tutorial, we will show you the step by step of how to configure the Laravel application with MySQL using AWS Elastic Beanstalk and RDS.

Go to the Elastic Beanstalk, navigate to the Configuration on the left-hand side. In the Database category, click Modify button.

Laravel application MySQL AWS
Configure MySQL database in Elastic Beanstalk

Ensure you choose MySQL on Engine selection. Fill up username and password, then click Apply button.

Go back to AWS Management Console, select RDS, click on DB instances to view the created database details. You will see one of DB instance has been created successfully.

Laravel application MySQL AWS
Database instance in RDS

Next, click on the DB identifier to view the configuration details. Copy down the endpoint, this will be the hostname.

Laravel application MySQL AWS
Database Configuration in RDS

Finally, navigate to the Configuration tab, copy down the dbname and username.

Laravel application MySQL AWS
Database Configuration in RDS

Now, you have done created a database called “ebdb”.

Connect MySQL to your Laravel project

Now, we are ready to connect the database to the Laravel project. Go back to Elastic Beanstalk and navigate to Configuration, under Software category click Modify button. Scroll down to the Environment properties section, fill up the database properties as below. These properties will override the value in the .env environments file.

Laravel application MySQL AWS
Database properties in Elastic Beanstalk

Congratulation, you have successfully hosted a Laravel project on AWS cloud.

Leave a Reply