Skip to content

AWS RDS MySQL Setup Guide

Overview

Amazon RDS provides managed MySQL (or Aurora MySQL) instances. For Superloom projects, RDS is used when a relational database is needed alongside or instead of DynamoDB.

Instance Configuration

Key decisions when creating an RDS instance:

SettingSandboxProduction
EngineMySQL 8.0+ or Aurora MySQLAurora MySQL (recommended)
TemplateFree Tier or Dev/TestProduction
Instance Classdb.t3.micro or db.t4g.microBased on workload
Storage20 GB General Purpose SSDAuto-scaling, General Purpose
Multi-AZNoYes
Public AccessYes (if Lambda outside VPC)Depends on architecture

Database User Strategy

Create separate database users for different access levels:

UserPrivilegesUsed By
Admin (master)Full controlDatabase administration
Application userSELECT, INSERT, UPDATE, DELETELambda functions
Read-only userSELECT onlyReporting, monitoring

Read Replicas

For production, create a read replica to distribute read traffic:

  • Reader endpoint is used for read-heavy queries
  • Writer endpoint for all write operations
  • Both endpoints stored in SSM Parameter Store

Connection from Lambda

  • Lambda outside VPC: RDS must have public access enabled with security group restrictions
  • Lambda inside VPC: RDS can remain private (see networking guide)
  • Use connection pooling or short-lived connections (Lambda functions are ephemeral)

Administration Tools

  • MySQL Workbench (GUI)
  • DBeaver (cross-database GUI)
  • mysql CLI

Security

  • Never use the master/admin user in application code
  • Enforce SSL connections
  • Rotate passwords periodically
  • Store all credentials in SSM Parameter Store, actual values in __dev__/secrets/

Released under the MIT License.