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.
Extended teaching notes
Why this lesson matters
Use this lesson to strengthen systems you own: understand the risk, practise safely in a lab, then write and apply the fix.
Apply the fix across stacks
Same class of bug, same idea in every language.
Java / Spring Boot
Parameterise queries, encode output, CSRF tokens, limited Actuator, dependency scanning.
ASP.NET Core
EF Core / parameterised SQL, Razor encoding, HTTPS, Data Protection.
Node.js / Express
helmet, parameterised SQL, npm audit, avoid eval and shell concat.
Python / Django / Flask / FastAPI
ORM, autoescape, pip-audit, Bandit; never shell=True with user input.
PHP / Laravel
PDO/Eloquent, Blade escaping, composer audit.
Go / Ruby
database/sql placeholders / ActiveRecord; html/template / ERB escaping; govulncheck / Brakeman.
nginx / Apache / Tomcat
Hide versions, TLS, security headers, least-open ports.
MySQL / PostgreSQL / MongoDB / Redis
Private networks, auth on, least-privilege users, no 0.0.0.0/0.
AWS / Azure / GCP
Roles not long-lived keys, private data stores, cloud audit logs on.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.