Skip to content
Home
Cloud Databases: Choose the Right Managed Database Service

Cloud Databases: Choose the Right Managed Database Service

Cloud Computing Cloud Computing 7 min read 1470 words Beginner ExcellentWiki Editorial Team

Choosing the right database in the cloud is one of the most consequential architecture decisions you will make. The wrong choice means expensive re-architecture, poor query performance, or excessive costs. Cloud providers offer managed versions of every popular database engine — PostgreSQL, MySQL, SQL Server, MongoDB — plus cloud-native databases purpose-built for specific workloads: DynamoDB for high-scale key-value access, Aurora for relational performance, Bigtable for wide-column analytics, and Cosmos DB for globally distributed multi-model data. According to DB-Engines 2025 rankings, PostgreSQL is the fastest-growing database in the cloud due to its extensibility ecosystem (PostGIS, TimescaleDB, pgvector).

Managed Relational Databases

Managed relational databases handle backups, patching, replication, failover, and monitoring automatically — capabilities that require significant operational investment when self-managed:

AWS RDS supports MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, and Amazon Aurora. RDS Multi-AZ provides synchronous replication across two Availability Zones with automatic failover under 60 seconds. RDS Custom gives you OS access for legacy applications that need specific database configuration.

GCP Cloud SQL supports MySQL, PostgreSQL, and SQL Server. It provides automatic storage increases (up to 64 TB), point-in-time recovery, and cross-region replicas. Cloud SQL integrates with Cloud Run, App Engine, and GKE via the Cloud SQL Auth Proxy for secure IAM-based authentication.

Azure SQL Database is based on SQL Server with Hyperscale tier supporting up to 100 TB of data. It provides serverless compute (auto-pause during inactivity), geo-replication across any Azure region, and integration with Azure Synapse Analytics for data warehouse workloads.

aws rds create-db-instance \
  --db-instance-identifier excellentwiki-db \
  --db-instance-class db.r6g.large \
  --engine postgres \
  --engine-version 16.3 \
  --master-username dbadmin \
  --master-user-password $(openssl rand -base64 20) \
  --allocated-storage 200 \
  --storage-type gp3 \
  --iops 12000 \
  --storage-encrypted \
  --backup-retention-period 35 \
  --multi-az \
  --auto-minor-version-upgrade \
  --performance-insights \
  --monitoring-interval 60 \
  --enable-cloudwatch-logs-exports '["postgresql"]'

Amazon Aurora — AWS’s cloud-native relational database — provides MySQL and PostgreSQL compatibility with 5x throughput, automatic storage scaling (up to 128 TB), and six-way replication across three Availability Zones. Aurora Serverless v2 scales from 0.5 to 256 ACUs (Aurora Capacity Units) in milliseconds, making it the most cost-effective relational database for variable workloads.

NoSQL Databases

NoSQL databases sacrifice relational features (joins, transactions, strict schemas) for scalability, performance, and flexibility:

Amazon DynamoDB is a fully managed key-value and document database designed for single-digit-millisecond performance at any scale. It powers high-traffic workloads — gaming leaderboards, session stores, shopping carts — for companies like Snapchat, Airbnb, and Lyft. DynamoDB tables have no size limits and scale to millions of requests per second with consistent performance.

Key DynamoDB features:

  • On-demand capacity — zero provisioning, pay-per-request pricing (ideal for variable traffic)
  • DAX (DynamoDB Accelerator) — in-memory cache providing microsecond read latency
  • Global Tables — multi-region, multi-active replication for global applications
  • Streams — capture table changes in order for event-driven processing with Lambda
import boto3
from boto3.dynamodb.conditions import Key

dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('excellentwiki-articles')

# Single-item read (eventually consistent)
response = table.get_item(
    Key={'slug': 'cloud-databases-guide'},
    ConsistentRead=False
)

# Query by GSI (Global Secondary Index)
response = table.query(
    IndexName='category-published-index',
    KeyConditionExpression=Key('category').eq('cloud-computing'),
    ScanIndexForward=False,  # Most recent first
    Limit=20
)

Google Firestore (Datastore mode) — document database with real-time synchronization, ACID transactions, and automatic multi-region replication. Firestore excels at mobile and web application backends — Google Firebase’s primary database.

Azure Cosmos DB — multi-model database supporting document (MongoDB API), key-value, graph (Gremlin), column-family (Cassandra API), and table (Azure Table Storage) data models. Cosmos DB provides guaranteed single-digit-millisecond latency at the 99th percentile and instantaneous global replication.

In-Memory Caching

Caching layers dramatically reduce database load and improve application latency:

ServiceEngineUse Case
AWS ElastiCacheRedis / MemcachedSession store, API cache, rate limiting
GCP MemorystoreRedis / MemcachedReal-time leaderboards, message queues
Azure Cache for RedisRedis (enterprise)Vector search, JSON caching, RediSearch

Redis provides data structures (sets, sorted sets, lists, hashes) beyond simple key-value caching — sorted sets power leaderboards, streams provide event processing, and RediSearch enables secondary indexing.

import redis

r = redis.Redis(host='cache.redis.internal', port=6379, decode_responses=True)

# Cache API response with TTL
r.setex(f'article:{slug}', 3600, serialized_content)

# Fetch with cache-aside pattern
content = r.get(f'article:{slug}')
if not content:
    content = database.fetch_article(slug)
    r.setex(f'article:{slug}', 3600, serialized_content)

Scaling Strategies

Vertical Scaling (Scale Up)

Increase the database instance size. Simple — no application changes required. Limits: instance types have maximum sizes (e.g., db.r6g.16xlarge with 512 GB RAM, 64 vCPUs). Cost grows linearly with size.

Horizontal Scaling — Read Replicas

Offload read traffic to replica instances. Aurora supports up to 15 read replicas; RDS supports 5 (MySQL) or 15 (PostgreSQL). Read replicas can be in different regions for geographic latency reduction:

aws rds create-db-instance-read-replica \
  --db-instance-identifier wiki-db-replica-eu \
  --source-db-instance-identifier wiki-db-primary \
  --region eu-west-1 \
  --db-instance-class db.r6g.large

Horizontal Scaling — Sharding

Distribute data across multiple database instances, each holding a subset (shard). Each shard handles a portion of read and write traffic. Sharding is architecturally complex — route queries to the correct shard, handle resharding, manage cross-shard transactions.

Approaches: application-level sharding (routing logic in code), proxy-based sharding (Vitess, ProxySQL), or native sharding (Cosmos DB partition keys, DynamoDB partition strategy).

Backups and Disaster Recovery

Managed databases provide automated backups with point-in-time recovery (PITR):

  • RDS: automated daily backups with 35-day retention, transaction logs for PITR within 5 minutes
  • Cloud SQL: automated backups with configurable retention (7-365 days), PITR via write-ahead log archival
  • Azure SQL: automated full backups weekly, differential backups every 12 hours, log backups every 10 minutes

Cross-region disaster recovery:

  • RDS: cross-region read replicas with promotion to primary
  • Aurora: Aurora Global Database — one primary region with up to five secondary regions, failover in 1 minute
  • Cosmos DB: multi-region writes with automatic failover (zero data loss)
  • Cloud Spanner: globally distributed with synchronous replication across regions
# Restore RDS to point in time
aws rds restore-db-instance-to-point-in-time \
  --source-db-instance-identifier excellentwiki-db \
  --target-db-instance-identifier excellentwiki-db-restored \
  --restore-time 2025-06-15T14:00:00Z \
  --db-instance-class db.r6g.large \
  --storage-type gp3

Best Practices

Use managed services — avoid self-managing databases on VMs. The operational cost of patching, backup management, and failover engineering exceeds the premium for managed services.

Connection pooling — database connections are expensive to establish. Use PgBouncer (PostgreSQL), ProxySQL (MySQL), RDS Proxy, or GCP Cloud SQL Connector to manage connection pools.

Slow query monitoring — enable slow query logs and Performance Insights (AWS), Query Insights (GCP), or Query Performance Insight (Azure). Identify and optimize queries with full table scans, inefficient joins, or missing indexes.

Data encryption — encrypt data at rest (AES-256) and in transit (TLS 1.2+). AWS RDS and Aurora encrypt data at rest by default as of 2024. Use customer-managed KMS keys for compliance requirements.

Regular backups — test backup restoration quarterly. A backup that has never been restored is not a backup.

FAQ

When should I choose DynamoDB over RDS? Choose DynamoDB for workloads requiring single-digit-millisecond latency at any scale, with simple access patterns (key-value lookups or queries with a single partition key). Choose RDS for complex queries with joins, aggregations, transactions across multiple tables, and ad-hoc analytical queries.

What is the difference between Aurora Serverless and standard RDS? Aurora Serverless v2 scales compute capacity automatically (from 0.5 to 256 ACU) based on demand, while RDS requires manual instance resizing. Aurora Serverless is ideal for variable workloads; RDS is better (and cheaper) for predictable, steady-state workloads.

How do I migrate an on-premises database to the cloud with minimal downtime? Use AWS DMS, GCP Database Migration Service, or Azure DMS. These tools perform continuous replication from the source database during the migration window. When ready, you stop writes to the source, verify replication lag is zero, and switch connections to the target.

What is the best database for globally distributed applications? Aurora Global Database (relational, multi-region) or DynamoDB Global Tables (NoSQL, multi-region) for AWS. Cosmos DB (multi-model, multi-master) for Azure. Cloud Spanner (strongly consistent, globally distributed) for GCP. Cosmos DB and Spanner provide the strongest global consistency guarantees.

How do I handle schema changes in a managed cloud database? Use online schema migration tools (gh-ost, pt-online-schema-change for MySQL; pgroll for PostgreSQL). Apply backward-compatible changes first (add columns, add indexes), deploy new application code, then remove old schema elements after confirming the old code is no longer running.

What is DynamoDB auto-scaling and how does it work? DynamoDB auto-scaling adjusts provisioned throughput capacity based on actual traffic using AWS Application Auto Scaling. Define target utilization (e.g., 70% of provisioned capacity) and the service scales up during traffic spikes and down during lulls. On-demand mode eliminates provisioning entirely but costs more per request — use on-demand for unpredictable traffic and provisioned + auto-scaling for predictable patterns.

Should I use a multi-region database for disaster recovery? For disaster recovery across regions, use Aurora Global Database (1-second RPO, ~1-minute failover), DynamoDB Global Tables (multi-active, sub-second replication), Cosmos DB multi-master (any-region writes, 99.999% availability), or Cloud Spanner (strong consistency across regions). Multi-region databases add latency and cost — justify the investment with clear RTO/RPO requirements.

Cloud Storage GuideCloud Architecture PatternsCloud Security Guide

Section: Cloud Computing 1470 words 7 min read Beginner 756 articles in section Report inaccuracy Back to top