DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

LAB: Amazon RDS Amazon Aurora Amazon ElastiCache

PART 1 — Amazon RDS (Relational Database Service)

1. What is RDS?

Amazon RDS is a managed relational database service.

Instead of installing MySQL/PostgreSQL on EC2 manually, AWS manages:

  • OS patching
  • Backups
  • Failover
  • Monitoring
  • Scaling

Supported engines:

  • MySQL
  • PostgreSQL
  • MariaDB
  • Oracle
  • SQL Server

2. Why We Need RDS (Instead of EC2 + MySQL)

If you install DB on EC2:

  • You manage OS
  • You manage backups
  • You configure replication
  • You handle crashes
  • You configure monitoring
  • You secure everything

With RDS:

  • AWS manages infrastructure
  • You manage database logic

DevOps benefit:

  • Less operational overhead
  • Faster deployment
  • Built-in HA
  • Automated backups
  • Easy scaling

3. RDS Lab

Goal:

Create MySQL RDS and connect from EC2.


Step 1 — Create RDS MySQL

AWS Console → RDS → Create Database

Choose:

  • Standard Create
  • Engine: MySQL
  • Version: latest
  • Templates: Free tier

Settings:

  • DB instance identifier: devops-mysql
  • Username: admin
  • Password: StrongPassword123

Instance:

  • db.t3.micro

Storage:

  • 20 GB (default)

Connectivity:

  • Same VPC as EC2
  • Public access: NO
  • Create new security group

Create database.

Wait 5–10 minutes.


Step 2 — Allow EC2 Access

Go to:
RDS → Security Group

Add inbound rule:

  • Type: MySQL
  • Port: 3306
  • Source: EC2 security group

Why:
RDS is inside VPC and needs permission.


Step 3 — Connect from EC2

SSH into EC2:

Install MySQL client:

sudo apt update
sudo apt install mysql-client -y
Enter fullscreen mode Exit fullscreen mode

Connect:

mysql -h <RDS-ENDPOINT> -u admin -p
Enter fullscreen mode Exit fullscreen mode

Demonstrate:

  • Create database
  • Create table
  • Insert data
  • Select data

we will do together:

  1. Stop EC2 → RDS still works
  2. RDS automatic backup section
  3. Multi-AZ option
  4. Performance insights

DevOps Talking Points

  • CI/CD apps connect to RDS
  • Terraform creates RDS
  • Monitoring with CloudWatch
  • Secret Manager for DB password
  • Blue/Green DB deployments

PART 2 — Amazon Aurora

1. What is Aurora?

Aurora is AWS’s high-performance database engine compatible with:

  • MySQL
  • PostgreSQL

It is:

  • Faster than MySQL on RDS
  • More scalable
  • Auto-replicating

Why Aurora is Special

  • 6 copies of data across 3 AZs
  • Auto failover in seconds
  • Read replicas automatically
  • Storage auto-scales to 128TB

DevOps benefit:

  • Enterprise-grade HA
  • Massive scaling
  • Read-heavy applications
  • SaaS applications

Aurora Lab

Step 1 — Create Aurora MySQL

RDS → Create Database

Choose:

  • Amazon Aurora
  • Aurora MySQL-Compatible

Template:

  • Dev/Test

Instance:

  • db.t3.medium

Connectivity:

  • Same VPC

Create.


Step 2 — Observe Architecture

Go to cluster view.

Explain:

  • Writer endpoint
  • Reader endpoint
  • Replicas

Demonstrate:

  • Add read replica
  • Observe endpoints

Step 3 — Failover Demo

Reboot primary instance.

Show:

  • Failover happens automatically
  • Minimal downtime

Explain:
Traditional MySQL on EC2 cannot do this easily.


DevOps Use Cases

  • High traffic applications
  • Banking systems
  • SaaS multi-tenant apps
  • Large-scale Kubernetes applications

PART 3 — Amazon ElastiCache

1. What is ElastiCache?

It is managed Redis or Memcached.

Used for:

  • Caching
  • Session storage
  • Fast lookups
  • Reducing DB load

Why We Need Cache

Without cache:
App → Database every time

With cache:
App → Redis → Database only if needed

Result:

  • Faster response
  • Lower DB load
  • Lower cost

Redis Lab

Step 1 — Create ElastiCache Redis

AWS Console → ElastiCache

Create:

  • Redis
  • Cluster mode disabled
  • t3.micro
  • Same VPC

Wait to create.


Step 2 — Allow EC2 Access

Modify security group:

  • Port 6379
  • Source: EC2 SG

Step 3 — Install Redis Client on EC2

sudo apt install redis-tools -y
Enter fullscreen mode Exit fullscreen mode

Connect:

redis-cli -h <redis-endpoint>
Enter fullscreen mode Exit fullscreen mode

Test:

SET name Aisalkyn
GET name
Enter fullscreen mode Exit fullscreen mode

Demonstration

Simulate app behavior:

Without cache:

  • Query DB 100 times

With Redis:

  • First request → DB
  • Others → Redis

Explain:
Real applications use Redis for:

  • Login sessions
  • API response caching
  • Rate limiting

Comparison Table for Students

Feature RDS Aurora ElastiCache
Type Managed DB High-performance DB Cache
Storage Single DB Distributed In-memory
HA Multi-AZ Built-in distributed Redis replication
Speed Normal Very Fast Extremely Fast
Use Case Standard apps Enterprise apps Speed optimization

How DevOps Uses These Together

Example Architecture:

App in EKS → Redis (ElastiCache) → Aurora → S3 backups

CI/CD:

  • Jenkins deploys app
  • Terraform provisions RDS/Aurora
  • Secrets Manager stores credentials
  • CloudWatch monitors performance

Real Interview Question

Q: Why use ElastiCache if Aurora is fast?

Answer:
Aurora is fast for relational storage, but Redis is in-memory and much faster for frequent reads. It reduces database load and improves scalability.

Top comments (0)