Now a days big discussion going on serverless architecture, I have tested my database serverless scalable architecture for LAMP applications.

If you are looking to build serverless architecture for LAMP. Here is the guide how to design serverless architecture for any LAMP application.

So here is how to design / use scalable serverless MySQL database architecture.

I have divided my stack architecture in two part:

1.) Application Servers

2.) Database serversaws-aurora-serverless-mysql

 

I have used AWS EC2 for application server and AWS Aurora Serverless MySQL for database server.

 

So AWS EC2 instance stack look like below:

–Apache
–PHP
–Mysql client
–phpMyAdmin 
As I use Amazon Aurora Serverless MySQL, so don’t bother about database stack and scaling as Amazon Aurora Serverless MySQL automatically scales up & down and pause if not used.
You just have to configure min and max ACUs only else everything handles by amazon, means depending upon workload and number of concurrent connection you have to decide the min and max ACUs only.
I have used this tutorial for my application architecture.

 

I didn’t use Client Environment with Cloud9, instead I use EC2 micro instance with MySQL client only enough to connect aws aurora serverless.

 

Note : Mysql client only not mysql server

 

But I also used phpMyAdmin to verify it working properly for LAMP application.

 

So need to install Apache, PHP and phpMyAdmin and configured phpMyAdmin to connect database server remotely.

 

Here is how to install and configure Apache, PHP

 

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

https://websiteforstudents.com/installing-apache2-mariadb-on-ubuntu-16-04-17-10-18-04-with-php-7-2-support-lamp/

And here is how to install and configured phpMyAdmin to connect database server remotely.

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04

https://websiteforstudents.com/manage-remote-mysql-databases-via-phpmyadmin-on-ubuntu-17-04-17-10/

https://stackoverflow.com/questions/16801573/how-to-access-remote-server-with-local-phpmyadmin-client

Advantages of Aurora Serverless:
Aurora Serverless provides the following advantages:

Simpler
Aurora Serverless removes much of the complexity of managing DB instances and capacity.

Scalable
Aurora Serverless seamlessly scales compute and memory capacity as needed, with no disruption to client connections.

Cost-effective
When you use Aurora Serverless, you pay for only the database resources that you consume, on a per-second basis.

Highly available storage
Aurora Serverless uses the same fault-tolerant, distributed storage system with six-way replication as Aurora to protect against data loss.

How Aurora Serverless works?
aurora-serverless-arch
Full detail can be found here : how it works

Aurora Capacity Units (ACUs) 

Database Capacity

In Aurora Serverless, database capacity is measured in Aurora Capacity Units (ACUs). 1 ACU has approximately 2 GB of memory with corresponding CPU and networking, similar to what is used in Aurora Standard instances. You pay a flat rate per second of ACU usage, with a minimum of 5 minutes of usage each time the database is activated. 

1 Aurora Capacity Unit (ACU) $0.06 per ACU Hour
As your database capacity is automatically scaled up or down, ACUs are added or removed. Aurora Serverless can scale from a minimum of 2 ACUs to a maximum of 256 ACUs. You can specify the minimum and maximum ACUs your database can consume.

Database Storage & I/O

Storage consumed by your Amazon Aurora database is billed in per GB-month increments and I/Os consumed are billed in per million request increments. You pay only for the storage and I/Os your Amazon Aurora database consumes and do not need to provision in advance. Amazon Aurora storage and I/O prices are the same for Standard and Serverless configurations.

Storage Rate $0.10 per GB-month
I/O Rate $0.20 per 1 million requests
Full details can be found here:

Limitations of Aurora Serverless

The following limitations apply to Aurora Serverless:

Note

You can access an Aurora Serverless DB cluster from AWS Lambda. For more information about working with AWS Lambda, see Configuring a Lambda Function to Access Resources in an Amazon VPC in the AWS Lambda Developer Guide.

 

More information can be found here:

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html

https://aws.amazon.com/rds/aurora/serverless/

https://aws.amazon.com/rds/aurora/

https://aws.amazon.com/blogs/aws/aurora-serverless-ga/

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.create.html

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html

https://www.jeremydaly.com/aurora-serverless-the-good-the-bad-and-the-scalable/

View story at Medium.com

 

Advertisements