All Cheat Sheets

Databases Cheat Sheet

Multi-cloud reference for AWS, Azure, and Google Cloud Databases services

Amazon Aurora / RDS

AWS
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
aws rds create-db-cluster --db-cluster-identifier prod-cluster --engine aurora-postgresql --engine-version 15.4 --master-username dbadmin --master-user-password SECRET --database-name appdbProvision Aurora PostgreSQL cluster
aws rds create-db-instance --db-instance-identifier prod-reader-1 --db-cluster-identifier prod-cluster --engine aurora-postgresql --db-instance-class db.r6g.xlargeAdd low-latency read replica
aws rds failover-db-cluster --db-cluster-identifier prod-clusterTrigger immediate cluster failover
aws rds modify-db-cluster --db-cluster-identifier prod-cluster --serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=32.0Enable Aurora Serverless v2 auto-scaling

Architectural Key Facts

  • Cloud-native relational engine delivering up to 5x throughput of standard MySQL and 3x of standard PostgreSQL.
  • Decouples compute from storage; data is replicated 6 ways across 3 Availability Zones with a 4-of-6 write quorum.
  • Up to 15 auto-scaling read replicas share the same underlying distributed 10 GB segment storage fleet with sub-10ms lag.
  • Aurora Serverless v2 scales compute instantly in fine-grained 0.5 ACU increments without dropping client connections.
  • Aurora Global Database replicates physical redo logs to secondary regions with <1 second replication latency.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max database volume size128 TiB with automatic self-healing and growth
Max read replicas per cluster15 replicas
Aurora Serverless v2 max ACUUp to 128 ACUs (256 GB RAM)

Amazon DynamoDB

AWS
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=UserId,AttributeType=S --key-schema AttributeName=UserId,KeyType=HASH --billing-mode PAY_PER_REQUESTCreate On-Demand NoSQL table
aws dynamodb put-item --table-name Users --item '{"UserId":{"S":"usr_100"},"Email":{"S":"dev@cloud.com"}}'Insert document item
aws dynamodb query --table-name Orders --key-condition-expression 'CustomerId = :c AND OrderDate >= :d' --expression-attribute-values '{":c":{"S":"cust_1"},":d":{"S":"2026-01-01"}}'Query with partition and sort key
aws dynamodb update-continuous-backups --table-name Users --point-in-time-recovery-specification PointInTimeRecoveryEnabled=trueEnable continuous PITR backups

Architectural Key Facts

  • Fully managed serverless NoSQL key-value and document database delivering consistent single-digit millisecond latency.
  • Partition keys are hashed with MD5 to distribute data across internal partitions; automatic splits at 1,000 WCU / 3,000 RCU / 10 GB.
  • Global Secondary Indexes (GSIs) allow querying by alternative partition/sort keys with asynchronous projection.
  • DynamoDB Streams captures an ordered 24-hour changelog (CDC) for event-driven triggers via AWS Lambda.
  • Global Tables provides multi-region active-active masterless replication with Last-Writer-Wins conflict resolution.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max single item size400 KB (including attribute names and values)
Max operations per transaction100 items or 4 MB per `TransactWriteItems`
GSIs per table (default)20 GSIs (expandable to 500 via soft limit)

Amazon ElastiCache

AWS
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
aws elasticache create-replication-group --replication-group-id cache-cluster --replication-group-description 'Redis Cache' --engine redis --cache-node-type cache.r6g.large --num-node-groups 3 --replicas-per-node-group 2 --automatic-failover-enabledCreate 3-shard Redis cluster with HA
aws elasticache describe-replication-groups --replication-group-id cache-clusterView primary and replica cluster endpoints
redis-cli -h CLUSTER_ENDPOINT -p 6379 -c SET session:user_99 '{"role":"admin"}' EX 3600Set key with 1-hour TTL via cluster mode client

Architectural Key Facts

  • In-memory data store service providing sub-millisecond response times for Redis OSS / Valkey and Memcached engines.
  • Cluster Mode Enabled partitions data across 16,384 hash slots using CRC16 hashing for linear horizontal scaling.
  • Multi-AZ deployment with automatic failover detects primary failure and promotes a read replica in under 60 seconds.
  • Cache-Aside (Lazy Loading) and Write-Through caching patterns prevent database overload and cache stampedes.
  • ElastiCache Global Datastore provides cross-region active-passive replication with <1 second latency.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max shards per clusterUp to 500 shards in Cluster Mode
Max nodes per clusterUp to 500 nodes
Max memory per nodeUp to 419 GiB on `cache.r6g.16xlarge`

Azure SQL Database

Azure

Key Commands & CLI Operations

CommandDescription
az sql server create -g myrg -n sqlsrv-prod -u sqladmin -p 'ComplexP@ss1' -l eastusProvision logical Azure SQL Server
az sql db create -g myrg -s sqlsrv-prod -n appdb --service-objective GP_Gen5_4Create General Purpose 4-vCore database
az sql db create -g myrg -s sqlsrv-prod -n scale-db --tier Hyperscale --capacity 4Create Hyperscale database auto-scaling to 100TB
az sql db failover -g myrg -s sqlsrv-prod -n appdbTrigger failover to secondary replica

Architectural Key Facts

  • Fully managed relational database engine based on the latest stable enterprise Microsoft SQL Server.
  • Purchasing models: vCore-based (recommended for transparency) and DTU-based (bundled compute/storage).
  • Hyperscale tier features a decoupled multi-tier architecture supporting databases up to 100 TB with rapid backups and restore in minutes.
  • Serverless compute tier automatically scales compute based on workload demands and pauses during periods of inactivity to save costs.
  • Active Geo-Replication creates up to four readable secondary databases in different Azure regions for disaster recovery.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max database size (Hyperscale)100 TB with rapid storage allocation
Max vCoresUp to 128 vCores
Point-in-time restore (PITR) retention1 to 35 days (up to 10 years with Long-Term Retention)

Azure Cosmos DB

Azure

Key Commands & CLI Operations

CommandDescription
az cosmosdb create -g myrg -n cosmos-prod --capabilities EnableServerless --default-consistency-level SessionCreate serverless Cosmos DB account
az cosmosdb sql database create -g myrg -a cosmos-prod -n AppDBCreate SQL (Core) API database
az cosmosdb sql container create -g myrg -a cosmos-prod -d AppDB -n Users --partition-key-path '/userId' --throughput 1000Create container with partition key and provisioned RU/s

Architectural Key Facts

  • Globally distributed, multi-model NoSQL database service guaranteeing single-digit millisecond latency at the 99th percentile.
  • Throughput is measured in Request Units (RU/s); supports Provisioned Throughput, Autoscale RU/s, and Serverless pay-per-request.
  • Offers 5 distinct, well-defined consistency levels: Strong, Bounded Staleness, Session (default), Consistent Prefix, and Eventual.
  • Multi-region write capability allows writing to any deployed replica worldwide with automatic conflict resolution.
  • Multi-model support: SQL (Core) API, MongoDB API, Apache Cassandra API, Gremlin (Graph) API, and Table API.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max single document item size2 MB
Max physical partition storage50 GB per physical partition
Max RU/s per physical partition10,000 RU/s

Azure Cache for Redis

Azure

Key Commands & CLI Operations

CommandDescription
az redis create -g myrg -n prod-cache --sku Premium --vm-size P1 --enable-non-ssl-port false --shard-count 2Create clustered 2-shard Redis cache
az redis show -g myrg -n prod-cache --query 'hostName'Get Redis SSL connection hostname

Architectural Key Facts

  • Fully managed in-memory data store based on the open-source Redis engine for low-latency, high-throughput caching.
  • Tiers: Basic (single node), Standard (two-node primary/replica with 99.9% SLA), Premium (clustering, persistence, VNet injection), and Enterprise.
  • Enterprise tiers run Redis Enterprise software featuring RedisBloom, RediSearch, and Active-Active Geo-Distribution (CRDTs).
  • Data persistence via RDB backup and append-only file (AOF) protects cached data across reboots.
  • Cluster mode horizontally shards data across multiple nodes to exceed single VM memory limits.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max cache size (Enterprise)Up to 2 TB RAM
Max client connectionsUp to 100,000 concurrent connections
Max shards per clusterUp to 10 shards in Premium; 30 in Enterprise

Cloud SQL

Google Cloud
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
gcloud sql instances create my-instance --tier=db-custom-2-7680 --region=us-central1Create instance
gcloud sql databases create my-db --instance=my-instanceCreate database
gcloud sql backups create --instance=my-instanceTrigger on-demand backup
gcloud sql export sql my-instance gs://bucket/export.sql --database=my-dbExport data to GCS

Architectural Key Facts

  • Fully managed relational database service supporting MySQL, PostgreSQL, and SQL Server.
  • Automates backups, replication, patches, and capacity management.
  • Supports High Availability (HA) through synchronous replication to a standby zone.
  • Cross-region read replicas available for disaster recovery and scaling read workloads.
  • Cloud SQL Auth Proxy provides secure, IAM-authenticated connections.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max storage capacity64 TB
Max concurrent connectionsDepends on instance memory
Max instances per project100 (soft quota)

Firestore

Google Cloud
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
gcloud firestore databases create --region=us-centralInitialize Firestore database
gcloud firestore indexes composite create --collection-group=users --field-config...Create composite index
gcloud firestore export gs://my-bucketExport Firestore data

Architectural Key Facts

  • Flexible, scalable NoSQL document database for web, mobile, and server development.
  • Successor to Datastore; strongly consistent globally.
  • Real-time updates and offline support for mobile/web apps.
  • Organized in collections and documents; documents can contain subcollections.
  • ACID transactions across multiple documents.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max document size1 MB
Max writes per second per document1
Max documents returned in a queryDepends on timeout/memory, pagination recommended
Max composite indexes per db200

Spanner

Google Cloud
Explore Deep Dive Guide

Key Commands & CLI Operations

CommandDescription
gcloud spanner instances create my-instance --config=regional-us-central1 --nodes=1Create Spanner instance
gcloud spanner databases create my-db --instance=my-instanceCreate a database
gcloud spanner databases execute-sql my-db --instance=my-instance --sql='SELECT 1'Execute SQL

Architectural Key Facts

  • Fully managed, globally distributed, horizontally scalable relational database.
  • Provides ACID transactions and strong consistency globally using TrueTime.
  • Combines relational structure (schemas, SQL queries) with non-relational scale.
  • 99.999% SLA for multi-region instances.
  • Interleaved tables help colocate related child rows with parent rows for extreme performance.

Production Limits & Quotas

Item / DimensionLimit / Quota
Max nodes per instanceNo hard limit
Max database sizeVirtually unlimited
Max databases per instance100
Storage per node limit4 TB