AWS Fundamentals RDS + Aurora + ElastiCache
vs RDS Databases ports:
PostgreSQL: 5432
MySQL: 3306
Oracle RDS: 1521
MSSQL Server: 1433
MariaDB: 3306 (same as MySQL)
Aurora: 5432 (if PostgreSQL compatible) or 3306 (if MySQL compatible)



AWS RDS Overview
β’ RDS stands for Relational Database Service
β’ Itβs a managed DB service for DB use SQL as a query language.
β’ It allows you to create databases in the cloud that are managed by AWS
β’ Postgres
β’ MySQL
β’ MariaDB
β’ Oracle
β’ Microsoft SQL Server
β’ Aurora (AWS Proprietary database)
Advantage over using RDS versus deploying DB on EC2
β’ RDS is a managed service:
β’ Automated provisioning, OS patching
β’ Continuous backups and restore to specific timestamp (Point in Time Restore)!
β’ Monitoring dashboards
β’ Read replicas for improved read performance
β’ Multi AZ setup for DR (Disaster Recovery)
β’ Maintenance windows for upgrades
β’ Scaling capability (vertical and horizontal)
β’ Storage backed by EBS (gp2 or io1)
β’ BUT you canβt SSH into your instances
RDS Backups
β’ Backups are automatically enabled in RDS
β’ Automated backups:
β’ Daily full backup of the database (during the maintenance window)
β’ Transaction logs are backed-up by RDS every 5 minutes
β’ => ability to restore to any point in time (from oldest backup to 5 minutes ago)
β’ 7 days retention (can be increased to 35 days)
β’ DB Snapshots:
β’ Manually triggered by the user
β’ Retention of backup for as long as you want
RDS β Storage Auto Scaling
β’ Helps you increase storage on your RDS DB instance dynamically
β’ When RDS detects you are running out of free database storage, it scales automatically
β’ Avoid manually scaling your database storage
β’ You have to set Maximum Storage Threshold (maximum limit for DB storage)
β’ Automatically modify storage if:
β’ Free storage is less than 10% of allocated storage
β’ Low-storage lasts at least 5 minutes
β’ 6 hours have passed since last modification
β’ Useful for applications with unpredictable workloads
β’ Supports all RDS database engines (MariaDB, MySQL, PostgreSQL, SQL Server, Oracle)

RDS Read Replicas for read scalability
β’ Up to 5 Read Replicas
β’ Within AZ, Cross AZ or Cross Region
β’ Replication is ASYNC, so reads are eventually consistent
β’ Replicas can be promoted to their own DB
β’ Applications must update the connection string to leverage read replicas

RDS Read Replicas β Use Cases
β’ 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)

RDS Read Replicas β Network Cost
β’ In AWS thereβs a network cost when data goes from one AZ to another
β’ For RDS Read Replicas within the same region, you donβt pay that fee

RDS Multi AZ (Disaster Recovery)
β’ SYNC replication
β’ One DNS name β automatic app failover to standby
β’ Increase availability
β’ Failover in case of loss of AZ, loss of network, instance or storage failure
β’ No manual intervention in apps
β’ Not used for scaling
β’ Multi-AZ replication is free
β’ Note: The Read Replicas be setup as Multi AZ for Disaster Recovery (DR)

RDS β From Single-AZ to Multi-AZ
β’ Zero downtime operation (no need to stop the DB)
β’ Just click on βmodifyβ for the database
β’ The following happens internally:
β’ A snapshot is taken
β’ A new DB is restored from the snapshot in a new AZ
β’ Synchronization is established between the two databases

RDS Security - Encryption
β’ At rest encryption
β’ Possibility to encrypt the master & read replicas with AWS KMS - AES-256 encryption
β’ Encryption has to be defined at launch time
β’ If the master is not encrypted, the read replicas cannot be encrypted
β’ Transparent Data Encryption (TDE) available for Oracle and SQL Server
β’ In-flight encryption
β’ SSL certificates to encrypt data to RDS in flight
β’ Provide SSL options with trust certificate when connecting to database
β’ To enforce SSL:
β’ PostgreSQL: rds.force_ssl=1 in the AWS RDS Console (Parameter Groups)
β’ MySQL: Within the DB: GRANT USAGE ON . TO 'mysqluser'@'%' REQUIRE SSL;
RDS Encryption Operations
β’ Encrypting RDS backups
β’ Snapshots of un-encrypted RDS databases are un-encrypted
β’ Snapshots of encrypted RDS databases are encrypted
β’ Can copy a snapshot into an encrypted one
β’ To encrypt an un-encrypted RDS database:
β’ Create a snapshot of the un-encrypted database
β’ Copy the snapshot and enable encryption for the snapshot
β’ Restore the database from the encrypted snapshot
β’ Migrate applications to the new database, and delete the old database
RDS Security β Network & IAM
β’ Network Security
β’ RDS databases are usually deployed within a private subnet, not in a public one
β’ RDS security works by leveraging security groups (the same concept as for EC2 instances) β it controls which IP / security group can communicate with RDS
β’ Access Management
β’ IAM policies help control who can manage AWS RDS (through the RDS API)
β’ Traditional Username and Password can be used to login into the database
β’ IAM-based authentication can be used to login into RDS MySQL & PostgreSQL
RDS - IAM Authentication
β’ IAM database authentication works with MySQL and PostgreSQL
β’ You donβt need a password, just an authentication token obtained through IAM & RDS API calls
β’ Auth token has a lifetime of 15 minutes
β’ Benefits:
β’ Network in/out must be encrypted using SSL
β’ IAM to centrally manage users instead of DB
β’ Can leverage IAM Roles and EC2 Instance profiles for easy integration

RDS Security β Summary
β’ Encryption at rest:
β’ Is done only when you first create the DB instance
β’ or: unencrypted DB => snapshot => copy snapshot as encrypted => create DB from snapshot
β’ Your responsibility:
β’ Check the ports / IP / security group inbound rules in DBβs SG
β’ In-database user creation and permissions or manage through IAM
β’ Creating a database with or without public access
β’ Ensure parameter groups or DB is configured to only allow SSL connections
β’ AWS responsibility:
β’ No SSH access
β’ No manual DB patching
β’ No manual OS patching
β’ No way to audit the underlying instance
Amazon Aurora
β’ Aurora is a proprietary technology from AWS (not open sourced)
β’ Postgres and MySQL are both supported as Aurora DB (that means your drivers will work as if Aurora was a Postgres or MySQL database)
β’ Aurora is βAWS cloud optimizedβ and claims 5x performance improvement over MySQL on RDS, over 3x the performance of Postgres on RDS
β’ Aurora storage automatically grows in increments of 10GB, up to 128 TB.
β’ Aurora can have 15 replicas while MySQL has 5, and the replication process is faster (sub 10 ms replica lag)
β’ Failover in Aurora is instantaneous. Itβs HA (High Availability) native.
β’ Aurora costs more than RDS (20% more) β but is more efficient
Aurora High Availability and Read Scaling
β’ 6 copies of your data across 3 AZ:
β’ 4 copies out of 6 needed for writes
β’ 3 copies out of 6 need for reads
β’ Self healing with peer-to-peer replication
β’ Storage is striped across 100s of volumes
β’ One Aurora Instance takes writes (master)
β’ Automated failover for master in less than 30 seconds
β’ Master + up to 15 Aurora Read Replicas serve reads
β’ Support for Cross Region Replication


Features of Aurora
β’ Automatic fail-over
β’ Backup and Recovery
β’ Isolation and security
β’ Industry compliance
β’ Push-button scaling
β’ Automated Patching with Zero Downtime
β’ Advanced Monitoring
β’ Routine Maintenance
β’ Backtrack: restore data at any point of time without using backups
Aurora Security
β’ Similar to RDS because uses the same engines
β’ Encryption at rest using KMS
β’ Automated backups, snapshots and replicas are also encrypted
β’ Encryption in flight using SSL (same process as MySQL or Postgres)
β’ Possibility to authenticate using IAM token (same method as RDS)
β’ You are responsible for protecting the instance with security groups
β’ You canβt SSH

Aurora β Custom Endpoints
β’ Define a subset of Aurora Instances as a Custom Endpoint
β’ Example: Run analytical queries on specific replicas
β’ The Reader Endpoint is generally not used after defining Custom Endpoints

Aurora Serverless
β’ Automated database instantiation and auto
scaling based on actual usage
β’ Good for infrequent, intermittent or unpredictable workloads
β’ No capacity planning needed
β’ Pay per second, can be more cost -effective




Amazon ElastiCache Overview
β’ The same way RDS is to get managed Relational Databasesβ¦
β’ ElastiCache is to get managed Redis or Memcached
β’ Caches are in-memory databases with really high performance, low latency
β’ Helps reduce load off of databases for read intensive workloads
β’ Helps make your application stateless
β’ AWS takes care of OS maintenance / patching, optimizations, setup, configuration, monitoring, failure recovery and backups
β’ Using ElastiCache involves heavy application code changes
ElastiCache Solution Architecture - DB Cache
β’ Applications queries ElastiCache, if not available, get from RDS and store in ElastiCache.
β’ Helps relieve load in RDS
β’ Cache must have an invalidation strategy to make sure only the most current data is used in there.



ElastiCache β Cache Security



Last updated