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
"Initial database name" rikama sodla tar RDS server banto pan reelsdb database banat nahi – mag app "Unknown database" error dete aani students gondhaltat. Te field bhara, kiwa connect zalyavar CREATE DATABASE reelsdb; swatah chalva. Aani Endpoint copy kara – IP nahi, RDS cha IP badalu shakto.
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.