Migrating LAMP applications to AWS Aurora

Sandesh Deshmane
4 min readNov 2, 2020

What is LAMP

LAMP is a open source platform used for web development . It uses Linux as Operating system, Apache as web server , MySQL as relational database and PHP for Objecting Oriented script based programing language for development. Sometime P stands for Perl or Python.

As this platform has four different layers , LAMP sometimes refereed as LAMP stack. Here OS can change. e.g if developer is using Mac OS for development then its refereed as MAMP. if windows is used then its called WAMP.

AWS Aurora

AWS Aurora is managed relational database. it is a MySQL and PostgreSQL-compatible RDBMS built for the cloud. It combines the performance and availability of traditional enterprise databases with the simplicity and cost-effectiveness of open source databases.

Amazon Aurora is up to five times faster than traditional MySQL databases and three times faster than standard PostgreSQL databases. It provides the security, availability, and reliability of commercial databases at 1/10th the cost. Amazon Aurora is fully managed by Amazon RDS, which automates time-consuming administration tasks like hardware provisioning, database setup, patching, and backups.

Amazon Aurora features a distributed, fault-tolerant, self-healing storage system that auto-scales up to 128TB per database instance. It delivers high performance and availability with up to 15 low-latency read replicas, point-in-time recovery, continuous backup to Amazon S3, and replication across three Availability Zones (AZs).

Types of Aurora DB:

There are two types of Aurora databases

  1. Provisioned

when you create Aurora provisioned , you can select the instance type, that will allow you to select required RAM and CPU capacity for your MySQL.

You can also select different config needed for your DB

You need to can add upto 15 read replicas to scale your request for databases from AWS console, within few minutes and few clicks. You do not need to worry about disc/storage capacity. its all managed

2. Serverless

Amazon Aurora Serverless is an on-demand, auto-scaling configuration for Amazon Aurora (MySQL-compatible and PostgreSQL-compatible editions), where the database will automatically start up, shut down, and scale capacity up or down based on your application’s needs. It enables you to run your database in the cloud without managing any database instances. It’s a simple, cost-effective option for infrequent, intermittent, or unpredictable workloads.

This suits when you do not know about what is number of users or application load.

You need to select Minimum and maximum Aurora capacity unit.

Serverless is supported only in VPC and you need to provide multiple zones subnets for deployment of DB so that HA is maintained

In both cases, you can configure DB snapshots to manage backup periodically.

How to Connect to Aurora DB

Most the LAMP application uses frameworks Symfony or Laravel . They directly connect to DB or use ORMs like doctrine or equivalent.

But in general all of them have configuration files like config.php or equivalent where the details about db_host, db_name, db_driver, db_user, db_password etc is stored.

For most of cases pdo_mysql driver is used.

To connect to Aurora MySQL instead of normal or existing MySQL you do not need any changes. Just replace db_host with host-name from AWS console. You can get console name from AWS console by looking at RDS databases.

Use correct db name , db user and db password.

Save the new version of config.php or configuration file. For PHP application you might also need to clean cache folder.

Also you need to create DB schema, and tables needed for your application .

You can need to migrate the existing data to Aurora. You can take a MySQL DB dump and load it to Aurora.

For more details you can check AWS page.

Advantages of Using Aurora

With Managed databases like Aurora, you can easily manage fail-over, High Availability. You can easily add Read Replica and scale reads for your application. If you are new to databases or for startup its every easy to mange load ( as you do not know whats the scale or size of db you need).

You can easily manage security of databases with VPC and IAM . The Encryption is handled at in transit and at rest. This all can done by just few clicks.