0
0
AWScloud~5 mins

Why managed databases matter in AWS - Why It Works

Choose your learning style9 modes available
Introduction
Managing databases yourself can be hard and time-consuming. Managed databases take care of setup, backups, and scaling automatically, so you can focus on your app instead of the database.
When you want to avoid spending time on database maintenance tasks like backups and updates.
When you need your database to automatically handle more users or data without manual changes.
When you want built-in security and automatic software patching for your database.
When you want to quickly create a reliable database without deep database knowledge.
When you want your database to be highly available and recover quickly from failures.
Commands
This command creates a managed MySQL database instance on AWS RDS with basic settings, including storage, username, password, and backup retention. It is not publicly accessible for security.
Terminal
aws rds create-db-instance --db-instance-identifier example-db --db-instance-class db.t3.micro --engine mysql --allocated-storage 20 --master-username adminuser --master-user-password AdminPass123! --backup-retention-period 7 --no-publicly-accessible
Expected OutputExpected
{ "DBInstance": { "DBInstanceIdentifier": "example-db", "DBInstanceClass": "db.t3.micro", "Engine": "mysql", "DBInstanceStatus": "creating", "MasterUsername": "adminuser", "AllocatedStorage": 20, "BackupRetentionPeriod": 7, "PubliclyAccessible": false } }
--backup-retention-period - Sets how many days backups are kept automatically
--no-publicly-accessible - Ensures the database is not open to the internet
This command checks the status and details of the database instance to confirm it is created and available.
Terminal
aws rds describe-db-instances --db-instance-identifier example-db
Expected OutputExpected
{ "DBInstances": [ { "DBInstanceIdentifier": "example-db", "DBInstanceStatus": "available", "Engine": "mysql", "Endpoint": { "Address": "example-db.abcdefg12345.us-east-1.rds.amazonaws.com", "Port": 3306 }, "AllocatedStorage": 20 } ] }
This command updates the backup retention period to 14 days immediately, showing how managed databases let you change settings easily.
Terminal
aws rds modify-db-instance --db-instance-identifier example-db --apply-immediately --backup-retention-period 14
Expected OutputExpected
{ "DBInstance": { "DBInstanceIdentifier": "example-db", "BackupRetentionPeriod": 14, "DBInstanceStatus": "modifying" } }
--apply-immediately - Applies changes right away without waiting for maintenance window
This command deletes the managed database instance without taking a final snapshot, cleaning up resources when no longer needed.
Terminal
aws rds delete-db-instance --db-instance-identifier example-db --skip-final-snapshot
Expected OutputExpected
{ "DBInstance": { "DBInstanceIdentifier": "example-db", "DBInstanceStatus": "deleting" } }
--skip-final-snapshot - Deletes the database without saving a final backup
Key Concept

Managed databases handle complex tasks like backups, scaling, and security automatically so you can focus on your app.

Common Mistakes
Creating a database instance without setting backup retention.
Without backups, you risk losing data if something goes wrong.
Always set a backup retention period to keep automatic backups.
Making the database publicly accessible without restrictions.
This exposes your database to the internet and potential attacks.
Use the --no-publicly-accessible flag and control access with security groups.
Deleting the database without a final snapshot when data is still needed.
You lose all data permanently without a backup.
Take a final snapshot before deleting if you want to keep data.
Summary
Use 'aws rds create-db-instance' to launch a managed database with backups and security.
Check database status with 'aws rds describe-db-instances' to confirm it is ready.
Modify settings like backup retention easily with 'aws rds modify-db-instance'.
Clean up resources by deleting the database with 'aws rds delete-db-instance'.