16.1 Why RDS instead of MySQL on EC2
In Chapter 10 the database and the website share one virtual machine. That is the right way to learn SQL. In a real project you usually do not want the data to live and die with that one server. Amazon RDS (Relational Database Service) runs a relational database for you.
| MySQL or MariaDB on EC2 (Chapters 10–12) | Amazon RDS | |
|---|---|---|
| Who installs and patches the engine | You, with yum or apt |
AWS |
| Backups | You run mysqldump, or you snapshot the EBS volume |
Automated backups and point-in-time restore |
| Disk full, failover, Multi-AZ | You design it | Built in (you turn it on) |
| SQL, tables, indexes, users | You | You. This does not change |
| Where it runs | On your instance | On AWS-managed hosts, in subnets you choose |
What you still manage: the schema and the queries, the master password, the security group, and the connection string in the application. You do not SSH into RDS and edit my.cnf. Engine settings go in a parameter group (section 16.9).
Ravindra Bagale's Tip
Many students say "I installed MySQL, so the data is on my server." Look: with RDS the data is on a different machine, in a different subnet. Your EC2 only has the client and the password. If the security group does not allow port 3306, the database can be healthy and the app still cannot reach it. The security group is the door. Pay attention!
Ravindra Bagale's Tip – मराठी
बरेच students म्हणतात "MySQL install केला, म्हणजे data माझ्या server वर आहे." बघा — RDS वर data वेगळ्या machine वर आहे, वेगळ्या subnet मध्ये. तुमच्या EC2 कडे फक्त client आणि password आहे. Security group ने port 3306 allow केला नाही तर database healthy असला तरी app पोहोचणार नाही. Security group म्हणजे दरवाजा. ध्यान राखो!
Ravindra Bagale's Tip – हिंदी
बहुत students कहते हैं "MySQL install किया, मतलब data मेरे server पर है." देखो — RDS पर data दूसरी machine पर है, दूसरे subnet में. तुम्हारे EC2 के पास सिर्फ client और password है. Security group ने port 3306 allow नहीं किया तो database healthy हो तब भी app नहीं पहुँचेगा. Security group मतलब दरवाज़ा. ध्यान रखो!