Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 16: Amazon RDS

Practice Questions and Lab Exercises

Now do this lab yourself. When you finish, delete the instance and delete the manual snapshot too.

  1. Give three jobs RDS does for you, and three jobs that stay with you.
  2. Why must a DB subnet group have subnets in two Availability Zones even for a single-AZ database?
  3. Which package installs the MySQL client on Amazon Linux 2023, on Ubuntu, and on CentOS Stream 9? Which package must you not install if you only want the client?
  4. Why does the application store the RDS endpoint, and not the IP address that name resolves to?
  5. A restore succeeded, but the website still shows the old data on the old host. What was missed?
  6. Explain Multi-AZ and a read replica in four lines, including what happens to the endpoint.
  7. Lab: Create the MySQL instance from section 16.3 (public access No, gp3, autoscaling off, deletion protection off). Restrict port 3306 to your EC2 security group. From EC2, install the client and run the students table. Change one Chapter 10 application's DB_HOST to the endpoint and read a row through the website. Take a manual snapshot, then stop the instance. When the lab is finished, delete the instance without a final snapshot, and delete the manual snapshot.

Understood? RDS is a managed database: you write the SQL, AWS handles backups and patches, and the endpoint and the security group stay in your hands. Now repeat the lab without looking at the notes.

Quick Revision

  • RDS is managed MySQL, MariaDB, PostgreSQL, Oracle, SQL Server, or Aurora. You still write SQL. The lab is MySQL on gp3, in a DB subnet group, not on the EC2 disk.
  • Create: identifier appdb, master user admin (never rdsadmin), db.t3.micro or db.t4g.micro only if the free-tier note on the page says so, public access No, port 3306 only from the EC2 security group, initial database appdb, deletion protection off for the lab.
  • Connect: sudo yum install -y mariadb105 on Amazon Linux 2023, sudo apt install -y mysql-client on Ubuntu, sudo yum install -y mariadb on CentOS, then mysql -h ENDPOINT -P 3306 -u admin -p appdb.
  • Applications: change the host from 127.0.0.1 to the endpoint (PHP DSN, Flask and Node DB_HOST, WordPress DB_HOST). Create users on RDS. wpuser@localhost is not copied across.
  • An automated backup gives point-in-time restore inside the retention window. A manual snapshot lasts until you delete it. Restore creates a new instance and a new endpoint. The snapshot is data, not the parameter group or the option group.
  • Multi-AZ is a synchronous standby on the same endpoint, for failover. A read replica is asynchronous, has its own endpoint, and can be promoted.
  • Stop: storage is still charged, and the instance starts again after 7 days. Delete the lab instance without a final snapshot, then delete manual snapshots.