15. Amazon RDS for MySQL: Create, Connect, Back Up and Keep It Private
15.3 Creating an RDS MySQL Instance Step by Step
Console chi UI vela-velela badalte; settings chi naave tich rahtat. Free tier ani prices sathi official AWS pricing page bagha – ithe kontyahi kimati dilelya nahit.
- RDS → Databases → Create database → Standard create.
- Engine: MySQL; choose a current MySQL 8.x version.
- Templates: Free tier (or Dev/Test for learning). Production would use Multi-AZ.
- DB instance identifier:
reels-db. Master username:admin(or your own). Credentials management: Managed in AWS Secrets Manager or a strong self-managed password stored in a password manager. - Instance class: a small burstable class such as
db.t3.microordb.t4g.micro. Storage: General Purpose SSD, 20 GiB, storage autoscaling with a sensible maximum. - Connectivity: your VPC, the DB subnet group, Public access: No, VPC security group: choose existing
db-sg(removedefault). - Database authentication: Password authentication.
- Additional configuration: Initial database name
reelsdb; Backup retention 7 days; Encryption enabled; Enable deletion protection ticked; enable Enhanced monitoring / log exports (error, slow query) if you like. - Create database and wait until Status = Available. Copy the Endpoint, e.g.
reels-db.abcdefgh1234.ap-south-1.rds.amazonaws.com.
The same with the CLI:
aws rds create-db-instance --db-instance-identifier reels-db \
--engine mysql --db-instance-class db.t3.micro --allocated-storage 20 \
--master-username admin --manage-master-user-password \
--db-name reelsdb --vpc-security-group-ids sg-0db11111 \
--db-subnet-group-name reels-db-subnets --no-publicly-accessible \
--backup-retention-period 7 --storage-encrypted --deletion-protection
aws rds wait db-instance-available --db-instance-identifier reels-db
aws rds describe-db-instances --db-instance-identifier reels-db \
--query "DBInstances[0].[Endpoint.Address,PubliclyAccessible,StorageEncrypted]"
Ravindra Bagale's Tip
If you leave "Initial database name" empty, RDS creates the server but not the reelsdb database – then the app gives an "Unknown database" error and students get confused. Fill in that field, or run CREATE DATABASE reelsdb; yourself after connecting. And copy the Endpoint – not the IP, because the RDS IP can change.
Ravindra Bagale's Tip – मराठी
"Initial database name" रिकामं सोडलं तर RDS server बनतो पण reelsdb database बनत नाही – मग app "Unknown database" error देतं आणि students गोंधळतात. ते field भरा, किंवा connect झाल्यावर CREATE DATABASE reelsdb; स्वतः चालवा. आणि Endpoint copy करा – IP नाही, RDS चा IP बदलू शकतो.
Ravindra Bagale's Tip – हिंदी
"Initial database name" ख़ाली छोड़ा तो RDS server बन जाता है पर reelsdb database नहीं बनता – फिर app "Unknown database" error देता है और students उलझ जाते हैं. वह field भरो, या connect होने के बाद CREATE DATABASE reelsdb; ख़ुद चलाओ. और Endpoint copy करो – IP नहीं, RDS का IP बदल सकता है.
Lab
Create reels-db with public access No, encryption on, deletion protection on and 7-day backups. Run the describe-db-instances query and confirm PubliclyAccessible is false.