Databases Flashcards
DynamoDB
- Fully managed, nosql, massive scale (1000000 rps)
- Max object size 400KB
- Capacity provisioned (WCU, RCU & autoscaling) or on-demand
- Reads can be eventually or strongly consistent
- Supports transactions across multiple tables (ACID)
- Backups and point-in-time recovery available
- Integrated with IAM for security
DynamoDB - Primary Keys
- Must be unique
- Partition key only
- Partition key + sort key
- Data grouped by partition key, the timestamp is an example of the good sort key
DynamoDB - Indexes
- In order to query an attribute must create an index of it
- LSI - Local Secondary Index
- Same partition key, the alternative sort key
- Must be added at creation
- GSI - Global Secondary Index
- Different partition and sort key
- Can be defined after the table creation
- Needs provisioned throughput per index, extra $
DynamoDB - TTL
Can expire rows
DynamoDB - Streams
- React to change in tables in real time
- 24-hour retention
- Can send to lambda, sqs, sns, ec2 and more
DynamoDB - Global Tables
- Active Active xregion replication, many regions
- Must enable streams
- Good for low latency, DR
DynamoDb - DAX
- DynamoDB Acceleration, aka cache
- No application code, directly integrated with DynamoDB
- Good for handling hot key problem
- 5 min TTL by default
- Multi AZ, recommended min 3 node for PROD
- Secure (KMS, IAM, VPC, CloudTrail)
- Up to 10 nodes in the cluster
Amazon ElasticSearch (ES)
- Not serveless, need to provision servers
- Must specify instance types, must be Multi-AZ
ElasticSearch + DynamoDB
Searching + Fast key-value store and retrieval
Store in Elasticsearch using streams and lambda
ES + CW
cw + subscription filter + lambda + es - real time
cw + subscription filter + kinesis + es - near real time
build own analytics and dashboard using kibana
RDS
- PostgreSQL, MySQL, MariaDB, Oracle, MS SQL Server
- Managed but requires provisioned servers
RDS VPC
Must be in VPC in private subnet, access controlled using SGs
RDS Storage
EBS (gp2 or io1), can enable auto-scaling
RDS Recovery
- Automated backups, pit recovery. Backups expire.
- Snapshots manual, can make copies of snapshots xregion
RDS Events
- Get notified via SNS about operations, outages, backups etc
RDS Multi AZ
- Master + Standby (Sync replication)
- One dns name
- Reads/writes only to master
- In case of failover, dns automatically will failover to standby
RDS Read Replicas
- Increase Read throughput
- Eventual consistency, so async replication to read replicas
- Can be xregion
Aurora
- PostgreSQL and MySQL
- Backup/restore/snapshot same as RDS
Aurora Storage
- Automatically grows in 10GB increments up to 64TB
- 6 copes of data across 3 AZ
- 4 out of 6 needed for writes
- 3 out of 6 needed for reads
Aurora Replication
- Up to 15 RR with Read endpoint to access them all
- Xregion replication, entire database (Unlike DynamoDb)
- Self-healing with Peer to Peer replication
Aurora + S3
- Efficiently load/offload to/from S3
Aurora Master
- Can failover within 30 seconds
- Can write only to master, using writer endpoint