RDS Security: Encryption and Parameter Groups
Encrypt RDS at rest with KMS, control connection-level encryption with parameter groups, and secure with IAM authentication.
RDS Security: Encryption and Parameter Groups is a free AWS Solutions Architect lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Solutions Architect learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
RDS Encryption at Rest
RDS supports encryption at rest using AWS Key Management Service (KMS). When you enable encryption at DB instance creation, all data on the underlying EBS volumes, automated backups, snapshots, and Read Replicas is encrypted using the specified KMS key.
Encryption must be enabled at creation time—you cannot encrypt an existing unencrypted instance in place. The workaround is to take an unencrypted snapshot, copy it with encryption enabled, and restore from the encrypted snapshot. The KMS key can be an AWS-managed key or a Customer-Managed Key (CMK) for additional control and audit.
# Create an encrypted RDS instance
aws rds create-db-instance \
--db-instance-identifier mydb-encrypted \
--engine mysql \
--db-instance-class db.t3.micro \
--master-username admin \
--master-user-password MyPass123! \
--allocated-storage 20 \
--storage-encrypted \
--kms-key-id arn:aws:kms:us-east-1:123456789:key/my-key-idEncrypting an Existing Unencrypted RDS Instance
Since you cannot enable encryption on an existing instance, follow this migration path:
- Create a manual snapshot of the unencrypted instance
- Copy the snapshot and enable encryption during the copy, specifying a KMS key
- Restore a new DB instance from the encrypted snapshot
- Update your application endpoint to the new instance
- Delete the old unencrypted instance
This approach incurs some downtime unless you use DMS to keep the new encrypted instance synchronised before cutover.
# Copy snapshot with encryption enabled
aws rds copy-db-snapshot \
--source-db-snapshot-identifier mydb-unencrypted-snap \
--target-db-snapshot-identifier mydb-encrypted-snap \
--kms-key-id alias/aws/rdsEncryption in Transit with SSL/TLS
RDS encrypts data in transit using SSL/TLS. Each engine provides a downloadable CA certificate that your client driver uses to verify the server's identity. To enforce SSL connections, configure the database engine to reject unencrypted connections.
For MySQL, set the parameter require_secure_transport = ON in the parameter group. For PostgreSQL, set ssl = 1 and optionally rds.force_ssl = 1 to reject non-SSL connections entirely. Many Java and Python database drivers also accept a sslmode=require connection string parameter.
# Connect to RDS MySQL over SSL
mysql -h mydb.abcd1234.us-east-1.rds.amazonaws.com \
-u admin -p \
--ssl-ca=rds-ca-2019-root.pem \
--ssl-verify-server-certParameter Groups: What Are They?
Parameter groups are named collections of engine configuration settings that you attach to an RDS instance. They are the RDS equivalent of editing my.cnf on MySQL or postgresql.conf on PostgreSQL, but managed by AWS and versioned per engine family.
AWS provides a default parameter group for each engine version, but its settings cannot be edited. To customise parameters, create a custom parameter group, modify the desired parameters, and associate it with your DB instance. Changes to static parameters require a reboot; dynamic parameters take effect immediately.
# Create a custom parameter group
aws rds create-db-parameter-group \
--db-parameter-group-name my-mysql8-params \
--db-parameter-group-family mysql8.0 \
--description 'Custom MySQL 8.0 parameters'Modifying Parameter Group Settings
After creating a custom parameter group, you modify individual parameters using the modify-db-parameter-group CLI command or the console. Parameters have an apply method: immediate (takes effect without reboot) or pending-reboot (only takes effect after the next instance restart).
Important parameters to know for the exam: max_connections (limit concurrent connections), innodb_buffer_pool_size (MySQL in-memory cache size), log_bin_trust_function_creators (allow stored functions that write to binary log), and rds.force_ssl (force SSL for PostgreSQL).
# Force SSL in a PostgreSQL parameter group
aws rds modify-db-parameter-group \
--db-parameter-group-name my-postgres-params \
--parameters 'ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=immediate'Option Groups for Additional Features
Option groups are similar to parameter groups but control add-on features for the database engine rather than configuration tuning. They are primarily used with Oracle and SQL Server to enable features like Oracle Application Express (APEX), SQL Server Transparent Data Encryption (TDE), or SQL Server Active Directory authentication.
Each option in an option group may have its own settings. Option groups are versioned per engine family and must be associated with the DB instance. Most open-source engines (MySQL, PostgreSQL, MariaDB) rarely need custom option groups.
IAM Database Authentication
RDS supports IAM database authentication for MySQL and PostgreSQL engines. Instead of a static username/password, your application assumes an IAM role and generates a temporary authentication token (valid for 15 minutes) using the generate-db-auth-token AWS CLI command or SDK call.
Benefits include no long-lived database passwords, automatic credential rotation through IAM policies, and centralised access control. The feature requires enabling --enable-iam-database-authentication on the instance and creating a database user mapped to an IAM role.
# Generate an RDS IAM auth token
aws rds generate-db-auth-token \
--hostname mydb.abcd1234.us-east-1.rds.amazonaws.com \
--port 3306 \
--username mydbuser \
--region us-east-1Secrets Manager Integration with RDS
AWS Secrets Manager can store and automatically rotate your RDS master password and application credentials. When rotation is enabled, Secrets Manager invokes a Lambda function that updates the database password and stores the new value in the secret—your application fetches the latest secret value via the Secrets Manager API, so it always has valid credentials.
When creating an RDS instance in the console, you can opt-in to Secrets Manager management for the master credentials. This eliminates hardcoded passwords in code or environment variables.
# Retrieve RDS credentials from Secrets Manager
aws secretsmanager get-secret-value \
--secret-id rds!db-1234abcd-5678-efgh-ijkl-mnopqrstuvwx \
--query SecretString \
--output text | python3 -m json.toolVPC and Security Group Controls
RDS instances run inside a VPC and use DB subnet groups to define which subnets (across multiple AZs) the instance can be placed in. Best practice is to place RDS in private subnets with no direct internet access.
Security groups control which IP addresses and other security groups can reach the DB port (e.g., TCP 3306 for MySQL). The application tier's security group should be the only allowed source on the RDS security group, enforcing network-level least privilege. Never configure 0.0.0.0/0 (all traffic) as an inbound rule on an RDS security group.
Enhanced Monitoring and Audit Logs
Enhanced Monitoring publishes OS-level metrics (CPU, memory, file system, disk I/O) to CloudWatch Logs every 1–60 seconds, giving finer granularity than the default 60-second CloudWatch metrics. It uses an agent running on the DB host, available for all engines except SQL Server mirroring mode.
Database audit logs (general query log, slow query log for MySQL; pgaudit for PostgreSQL) can be published to CloudWatch Logs for compliance analysis. Enable these through parameter groups, then configure the log exports in the RDS console under Log exports.
# Enable PostgreSQL logs export to CloudWatch
aws rds modify-db-instance \
--db-instance-identifier mydb \
--cloudwatch-logs-export-configuration 'EnableLogTypes=[postgresql,upgrade]' \
--apply-immediatelySecurity Best Practices Summary
Key RDS security best practices for the SAA-C03 exam:
- Enable encryption at rest with a KMS CMK when creating the instance
- Enforce SSL/TLS in transit via parameter group settings
- Place instances in private subnets with restrictive security groups
- Use IAM database authentication or Secrets Manager to avoid static passwords
- Enable CloudTrail to log RDS API calls and CloudWatch Logs for database audit logs
- Use AWS Config rules (e.g.,
rds-instance-public-access-check) to detect misconfigurations
Quick Check
Test your understanding of AWS Solutions Architect (SAA-C03) concepts from this lesson.
Lesson Recap
In this lesson you learned: RDS encryption at rest uses KMS and must be enabled at creation, parameter groups control engine configuration including enforcing SSL/TLS in transit, and IAM database authentication and Secrets Manager eliminate static database passwords. Next up we explore DynamoDB tables, items, and primary key design.
Frequently asked questions
Is the “RDS Security: Encryption and Parameter Groups” lesson free?
Yes — the full text of “RDS Security: Encryption and Parameter Groups” is free to read here on the web, and the AWS Solutions Architect course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Solutions Architect course, upgrade to CoddyKit PRO.
What will I learn in “RDS Security: Encryption and Parameter Groups”?
Encrypt RDS at rest with KMS, control connection-level encryption with parameter groups, and secure with IAM authentication. You practise AWS Solutions Architect with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Solutions Architect?
No prior experience is required. AWS Solutions Architect on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “RDS Security: Encryption and Parameter Groups” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Solutions Architect lesson?
Yes. Every AWS Solutions Architect lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- RDS Engines and Instance Classes
- Multi-AZ and Automated Backups
- Read Replicas for Read Scaling
- RDS Security: Encryption and Parameter Groups