Ravindra BagaleCourses & study guides

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.

  1. RDS → Databases → Create database → Standard create.
  2. Engine: MySQL; choose a current MySQL 8.x version.
  3. Templates: Free tier (or Dev/Test for learning). Production would use Multi-AZ.
  4. 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.
  5. Instance class: a small burstable class such as db.t3.micro or db.t4g.micro. Storage: General Purpose SSD, 20 GiB, storage autoscaling with a sensible maximum.
  6. Connectivity: your VPC, the DB subnet group, Public access: No, VPC security group: choose existing db-sg (remove default).
  7. Database authentication: Password authentication.
  8. 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.
  9. 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.