Database Specialty - RDS Flashcards
Instance Class Types in RDS
Standard, Memory-optimized, Burstable performance
Storage Type
General Purpose, Provisioned IOPS
Parameter groups important points
> Define configuration values specific to the select DB engine
Default parameter group cannot be edited
To make config changes, you must create a new parameter group
New parameter group inherits settings from the default parameter group
Can be applied to any DB instances within the AWS region
Restoring from a snapshot points
- By default, restored cluster gets applied with
- New security group
- Default parameter group
- Option group that was associated with the snapshot
- While restoring from a snapshot, be sure to
- Choose the correct security group to
ensure connectivity for the restored DB - Choose correct parameter group for the
restored DB - Recommended to retain parameter group
of the snapshot to help restore with the
correct parameter group
- Choose the correct security group to
PITR with RDS
- Point-In-Time Recovery
- Can only restore to a new instance
- The backup retention period controls the
PITR window - Can restore to any point in time during your
backup retention period - RDS uploads DB transaction logs to S3 every
5 minutes (affects latest restorable time) - You can move/restore a DB instance from
outside VPC to inside VPC with PITR (but not
other way round)
Exporting DB Snapshot Data to S3
- All types of backups can be exported (automatic/manual
or those created with AWS Backup service) - How to export?
- Setup an S3 bucket with appropriate IAM
permissions and create a KMS key for SSE - Export the snapshot using console (Actions à Export to Amazon S3) or using start-export-task CLI command
- Setup an S3 bucket with appropriate IAM
- Export runs in the background
- Doesn’t affect the DB performance
- Data exported in Apache Parquet format (=compressed and consistent)
- Allows you to analyze the DB data using Athena or Redshift Spectrum
Multi-AZ Deployments in RDS
- For high availability, data durability and fault-tolerance (not used for scaling)
- Offers SYNC replication to standby instance in another AZ over low latency links
- Performs automatic failover to standby instance in another AZ in case of planned or unplanned outage
- Uses DNS routing to point to the new master (no need to update connection strings)
- Failover times (RTO) are typically 60-120 seconds (minimal downtime)
- Backups are taken from standby instead of primary to ensure performance level
during backup activity - Recommended for production use cases
- To force a failover or simulate AZ-failure, reboot the master instance and choose Reboot with failover
RDS Read Replicas
- Read-only copies of master (primary) DB instance
- Up to 5 Read Replicas
- Within AZ, Cross AZ or Cross Region
- Replication is ASYNC, so reads are eventually
consistent - Applications must update the connection string to leverage read replicas
RDS Read Replicas 2
- Boost DB performance
and durability - Useful for scaling of read- heavy workloads
- Can be promoted to primary (complements
Multi-AZ) - To create a replica, you must enable automatic backups with at least one
day retention period - Replica can be Multi-AZ (= a replica with its own standby instance)
RDS Read Replicas as Multi-AZ
- Supported for MySQL / MariaDB / PostgreSQL / Oracle
- Works as a DR target. When promoted to primary, it works as Multi-AZ
- There’s added network cost when data goes from one AZ to another
RDS Read Replicas – Use Case
- You have a production database that is
taking on normal load - You want to run a reporting application
to run some analytics - You create a Read Replica to run the new
workload there - The production application is unaffected
- Read replicas are used for SELECT (=read) only kind of statements (not INSERT, UPDATE, DELETE)
Promoting a Read Replica to a Standalone DB
Instance
- Promoted instance is rebooted and becomes an independent DB instance
(separate from its source) - Will no longer work as a replica. Does not affect other replicas of the original DB
instance - You cannot promote a replica to a standalone instance while a backup is running
Promoting a Read Replica to a Standalone DB
Instance – Use cases
- Use as a DR strategy
- Avoid performance penalty of DDL operations (like rebuilding indexes)
- Perform DDL ops on a read replica and promote it to a standalone instance. Then
point your app to this new instance. - Sharding (splitting a large DB
into multiple smaller DBs)
Enabling writes on a read replica
- For MySQL / MariaDB read replica, set
the parameter read_only = 0 for the read replica to make it writable - You can then perform DDL operations on the read replica as needed without affecting the source DB
- Actions taken on the read replica don’t
affect the performance of the source DB instance - You can then promote the replica to a standalone DB
RDS Read Replica capabilities
- Can create multiple read replicas in quick succession
- Can use DB snapshot to perform PITR of a Read Replica
- Can create a replica from an existing replica
- reduces replication load from the master DB instance
- second-tier replica can have higher replication lag
Cross-Region Read Replicas in RDS
- Supported for MariaDB, MySQL, Oracle, and PostgreSQL
- Not supported for SQL Server
- Advantages
- Enhanced DR capability
- Scale read operations closer to the
end-users - Limitations
- Higher replica lag times
- AWS does not guarantee more than
five cross-region read replica instances