Amazon RDS (Relational Database Service) - Overview.
Focus:
- Tailored for Cloud / DevOps / DevSecOps Engineers.
Scope:
- Intro,
- What RDS is & why use RDS,
- Supported databases,
- Core concepts & architecture,
- Deployment models,
- Security,
- Scaling,
- Backups,
- Integrations with AWS ecosystem,
- Best practices,
- Common pitfalls,
- Advanced topics,
- Insights,
- Key Differences Between SQL and MySQL.
Intro:
- Amazon RDS (Relational Database Service) is a managed cloud service by Amazon Web Services (AWS)
- Amazon RDS (Relational Database Service) simplifies the process of setting up, operating, and scaling relational databases.
- Amazon RDS (Relational Database Service) handles routine administrative tasks, such as:
- Provisioning,
- Patching,
- Backup,
- Recovery,
- Failure detection, allowing users to focus on application development and schema design
1. The Concept: RDS
- Amazon RDS is a managed relational database service that automates time-consuming database administration tasks such as provisioning, patching, backups, monitoring, and scaling.
- Instead of managing a DB engine on EC2 (self-managed), RDS abstracts infrastructure management, letting twtect to focus on schema design and queries.
2. Supported Databases
RDS supports multiple relational DB
engines:
- Amazon Aurora (MySQL/PostgreSQL-compatible, AWS-built, cloud-native)
- MySQL
- PostgreSQL
- MariaDB
- Oracle (BYOL or License Included)
- SQL Server
Aurora is optimized for cloud workloads,
offers up to 15 read replicas, distributed storage, and generally
preferred for high-performance use cases.
3. Core Concepts & Architecture
a) Instance vs Database
- DB Instance = Managed VM (with CPU, RAM, storage, engine, networking).
- Database
= The actual schema(s) within the DB engine running on the instance.
b) Storage
- General Purpose SSD (gp3/gp2) → balanced performance/cost.
- Provisioned IOPS SSD (io1/io2) → high-performance workloads.
- Magnetic (deprecated).
Storage is EBS-backed with automatic replication in the same AZ.
Amazon Relational Database Service (RDS) provides
several storage options depending on the workload requirements:
1. Storage Types
General
Purpose (SSD) [gp3 / gp2]
o Balanced
price/performance.
o gp3
is newer and cheaper than gp2.
o Great
for most workloads.
Provisioned
IOPS (SSD) [io1 / io2]
o High-performance,
low-latency.
o Designed
for I/O-intensive workloads (e.g.,
large-scale OLTP).
o twtech
can provision up to hundreds of thousands of IOPS.
Magnetic (Standard),
legacy, not recommended.
o Old
HDD-based option.
o Slower
and cheaper, but being phased out.
2. Storage Autoscaling
- RDS can automatically
scale storage when twtech approaches its allocated limit (helps avoid “storage full” errors).
3. Storage Size
- Minimum: 20 GB (varies by engine).
- Maximum: Up to 64 TB depending on DB engine and storage type.
4. Backup Storage
- Automated backups for up to 35 days and manual snapshots are stored as configured in Amazon S3, separate from twtech allocated DB storage.
- Backup storage is free up to the size of twtech provisioned DB storage.
5. Performance Considerations
- IOPS: Higher with io1/io2 than gp3.
- Throughput: Increases with storage size for gp2, but decoupled in gp3.
- Latency: Lowest with SSD-based storage.
c) Multi-AZ vs Read Replica
- Multi-AZ → synchronous replication for HA (standby
in another AZ, automatic failover).
- Read Replicas → asynchronous replication for
scaling reads (within Region or Cross-Region).
d) Monitoring
- CloudWatch metrics (CPU, storage, IOPS).
- Enhanced Monitoring (per-process metrics).
- Performance Insights (query-level performance debugging).
4. Deployment Models
- Single-AZ → low cost, dev/test workloads.
- Multi-AZ (HA) → automatic failover, production workloads.
- Read Replicas → scaling reads, reporting, DR.
- Aurora Cluster
→ writer node + up to 15 reader nodes, distributed 6-way replicated
storage.
5. Security
- At rest: AWS KMS integration.
- In transit: SSL/TLS.
- IAM auth for MySQL & PostgreSQL (temporary tokens,
no password rotation headache).
- Deploy in VPC (best practice).
- Use security groups to restrict access.
- Traditional username/password.
- IAM authentication.
- Kerberos authentication (for
PostgreSQL/Oracle).
6. Scaling & Performance
- Vertical Scaling (change instance size, downtime
for most engines except Aurora).
- Horizontal Scaling (read replicas, Aurora replicas).
- Storage Auto-scaling (up to max configured).
- Aurora Serverless v2
→ autoscaling clusters down to 0.5 ACU.
7. Backup & Recovery
- Automated Backups
- Daily snapshot + transaction logs.
- PITR (Point-in-Time Recovery).
- Manual Snapshots
- Manual Snapshots (user-created, persist until deleted).
- Cross-Region Snapshots for DR.
8. AWS Ecosystem Integrations
- Lambda
→ event-driven DB triggers.
- DMS (Database Migration Service) → migrate from on-prem or between engines.
- CloudWatch / CloudTrail → monitoring + auditing.
- Secrets Manager / Parameter Store → credential management.
- Kinesis / S3 / Redshift → analytics pipelines.
- Always use Multi-AZ for production.
- Use Read Replicas for analytics/reporting, not main DB.
- Enable Performance Insights for troubleshooting.
- Rotate credentials with AWS Secrets Manager.
- Enable encryption at rest + in transit.
- Use parameter groups for tuning engine config.
- Plan for connection pooling (e.g., RDS Proxy for Lambda-heavy apps).
10. Common Pitfalls(mistakes or traps that often
lead to problems)
- Scaling
downtime – changing instance
class often requires downtime (Aurora minimizes this).
- Long backup restore – restoring a 10TB DB from snapshot can take hours.
- Replica lag – async read replicas may have replication delay.
- Storage limits – forgetting to enable auto-scaling can lead to “storage full” errors.
- Security misconfigs – leaving DB public-facing without proper SG rules.
11. Advanced Topics
- RDS Proxy: Connection pooling layer, reduces DB exhaustion (esp. for Lambda/microservices).
- Aurora Global Database: Single DB cluster across multiple regions (<1s replication lag).
- Aurora Backtrack: Rewind database to a previous point (without full snapshot restore).
- Aurora Parallel Query: Pushes queries down to storage layer for performance boost.
- Custom Engine Versions (CEV): For Oracle & PostgreSQL, customize engine binaries.
key takeaway:
- Amazon RDS removes heavy lifting for relational databases. Its gives twtech built-in HA, scaling, backups, and security.
- For modern workloads, Aurora (Serverless v2) is usually the best option, while RDS standard engines are great for compatibility and migration.
- There’s often confusion between SQL and MySQL, but they’re not the same thing. T
- his is twtech clear comparison of SQL and MySQL.
Key Differences Between SQL
and MySQL
|
Feature |
SQL |
MySQL |
|
Definition |
Structured Query Language — a language used to query and manage relational
databases. |
An open-source relational
database management system (RDBMS) that uses SQL as its query language. |
|
Type |
A standardized language
(like English grammar for databases). |
A software/application
(like a book written in that language). |
|
Usage |
Used to interact with many RDBMSs
(MySQL, PostgreSQL, SQL Server, Oracle, MariaDB, etc.). |
Specifically a database system
where SQL is the main language for querying and managing data. |
|
Scope |
Abstract — a set of rules/commands
(e.g., SELECT, INSERT, UPDATE). |
Practical — an implementation that
lets twtech store and query actual data. |
|
Variants |
ANSI SQL standard, but different
databases have slight variations/extensions (e.g., T-SQL for MS SQL Server,
PL/SQL for Oracle). |
MySQL follows SQL standards but
also has its own extensions and limitations. |
|
Ownership |
SQL is an ISO/ANSI standard,
not owned by anyone. |
MySQL was originally created by
MySQL AB, now owned by Oracle Corporation. |
|
Examples |
SELECT * FROM Customers;
works in any SQL-based DB (with slight variations). |
MySQL runs queries written in SQL,
but supports MySQL-specific functions (e.g., LIMIT instead of TOP). |
Simple Analogy (think of it as this)
- SQL = The language (like English).
- MySQL = A book written in that language.
- So when twtech says “SQL database,” it usually mean any database that supports SQL language,
- whereas “MySQL” is a specific database product that uses SQL.
No comments:
Post a Comment