Understanding the fundamentals of RDS, Aurora, and ElastiCache is crucial for building scalable and performant applications in the cloud.
Amazon Relational Database Service (RDS)
Amazon RDS is a managed service that makes it easy to set up, operate, and scale a relational database in the cloud. It supports various popular SQL database engines.
- Operates using SQL.
- Allows you to set a Maximum Storage Threshold, defining the upper limit for your database storage.
RDS Storage Auto Scaling
RDS offers an automated storage scaling feature to dynamically adjust storage capacity based on your application's needs.
Automatically modifies storage if:
- Free storage is less than 10% of allocated storage.
- Low storage condition lasts for at least 5 minutes.
- 6 hours have passed since the last storage modification.
Useful for applications with unpredictable workloads, ensuring your database doesn't run out of space unexpectedly.
* The Read Replicas can be setup as Multi AZ for Disaster Recovery (DR), providing enhanced resilience and availability.
Amazon Aurora
Amazon Aurora is a proprietary technology from AWS, designed to be a fully MySQL and PostgreSQL-compatible relational database that combines the performance and availability of high-end commercial databases with the simplicity and cost-effectiveness of open-source databases.
- Generally costs more than RDS but offers significant performance and efficiency benefits.
- Features an Aurora Reader Endpoint, which connects to a load balancer that automatically scales read replicas horizontally, supporting up to 15 replicas.
- Offers Aurora Global Database, allowing for one primary region and up to five read-only secondary regions with typical cross-region replication latency of less than 1 second.
- Provides Automated backups. Important Note: If you plan on stopping an RDS or Aurora instance to save costs, it's recommended to take a snapshot and restore it later, as direct stopping might still incur storage charges.
Amazon RDS Proxy
Amazon RDS Proxy is a fully managed database proxy for RDS and Aurora, allowing applications to pool and share database connections.
- Helps to enforce IAM Authentication and securely store database credentials in AWS Secrets Manager.
- Reduces failover time by up to 66% by maintaining persistent database connections.
- Improves database efficiency by reducing stress on database resources and minimizing connection timeouts.
- Is accessible ONLY from within a VPC (Virtual Private Cloud), enhancing security.
Amazon ElastiCache
Amazon ElastiCache is a fully managed in-memory data store and caching service designed to help reduce READ workloads on your databases, improving application performance by retrieving data from fast, in-memory caches.
Using ElastiCache often involves heavy application code changes to implement caching logic.
Cache Security
- ElastiCache for Redis supports IAM Authentication, providing secure access control to your cache clusters.
Caching Patterns
- Lazy Loading: Only data that is read is cached. This can lead to initial cache misses and potential stale data if not managed properly.
- Write Through: Data is added or updated in the cache whenever it is written to the database, ensuring no stale data in the cache.
- Session Store: Temporary session data is stored in the cache, often utilizing Time-To-Live (TTL) features to automatically expire outdated session information.
Redis sorted sets provide a data structure that guarantees both uniqueness and element ordering, useful for leaderboards or range-based queries.
Remember that network communication involves specific ports, such as HTTPS on port 443 for secure web traffic and database-specific ports like PostgreSQL on port 5432.