AWS Aurora Serverless MySQL
Aurora v1. Highly Available Serverless MySQL Service At 1/10th The Cost Of Commercial-Grade Databases.
Made by
Massdriver
Official
Yes
Clouds
Tags
AWS Aurora Serverless MySQL
Amazon Aurora Serverless is an on-demand, auto-scaling configuration for Amazon Aurora, where the database automatically starts up, shuts down, and scales capacity up or down based on your application's needs. It provides the full capabilities of Amazon Aurora with a MySQL-compatible database engine and delivers seamless scaling without manual intervention.
Design Decisions
- Engine and Version:
- Uses
aurora-mysql
with a default version5.7
.
- Uses
- Serverless Configuration:
- Engine mode set to
serverless
, allowing automatic start-up, shut-down, and scaling.
- Engine mode set to
- Backup and Retention:
- Backup retention period customizable via variable.
- Copy tags to snapshots enabled.
- Parameter and Security Configurations:
- Utilizes default Aurora MySQL parameter group.
- Storage encrypted and deletion protection enabled.
- Scaling Configuration:
- Fully configurable auto-scaling settings including
auto_pause
,max_capacity
, andmin_capacity
.
- Fully configurable auto-scaling settings including
- Networking:
- Utilizes subnets provided by the VPC configuration.
- Security group and rules set to allow traffic on MySQL port.
- Monitoring and Alarming:
- Automated and custom alarms enabled for database monitoring.
- Employs CloudWatch Alarms for serverless database capacity monitoring.
- Resource Naming and Identification:
- Use of identifiers and metadata for naming and tagging resources appropriately.
Runbook
Unable to Connect to Aurora Serverless MySQL
To troubleshoot connectivity issues to the Aurora Serverless MySQL cluster:
-
Check the RDS Cluster status:
This command ensures the cluster is available and ready to accept connections.
aws rds describe-db-clusters --db-cluster-identifier <your-cluster-identifier>
The status should be
available
. -
Verify VPC and Security Group settings:
Ensure the RDS cluster security group allows inbound traffic on port
3306
from your IP or CIDR range.aws ec2 describe-security-groups --group-ids <your-security-group-id>
Look for rules allowing ingress on MySQL's standard port.
-
Check Database Credentials:
Ensure you are using the correct master username and password.
You can reset the master password via:
aws rds modify-db-cluster --db-cluster-identifier <your-cluster-identifier> --master-user-password <new-password> --apply-immediately
-
Verify Subnet and VPC Configuration:
Ensure the RDS cluster is associated with the appropriate subnets within your VPC.
aws rds describe-db-subnet-groups --db-subnet-group-name <your-subnet-group-name>
Slow Query Performance
To troubleshoot slow queries on your Aurora Serverless MySQL:
-
Review Aurora Performance Insights:
Performance Insights can provide detailed information about query performance.
aws rds describe-resource-metrics --service-type RDS --identifier <your-cluster-identifier> --metric-queries '{"Metric": "db.Load.avg", "Dimensions": [{"Name": "DBClusterIdentifier", "Value": "<your-cluster-identifier>"}]}' --start-time $(date --utc --date='-5 minutes' +%Y-%m-%dT%H:%M:%SZ) --end-time $(date --utc +%Y-%m-%dT%H:%M:%SZ)
-
Enable and Check Slow Query Log:
Ensure that the slow query log is enabled and review entries.
-- Enable slow query log SET GLOBAL slow_query_log = 'ON'; -- View slow queries SELECT * FROM mysql.slow_log ORDER BY start_time DESC;
-
Analyze Query Execution Plans:
Use
EXPLAIN
to analyze how MySQL executes your queries.EXPLAIN SELECT * FROM your_table WHERE your_column = 'value';
This provides insights into index usage and query complexity.
-
Optimize Database Schema and Indexes:
Ensure your database schema is optimized, and proper indexes are in place.
-- View current indexes SHOW INDEX FROM your_table; -- Adding an index example CREATE INDEX idx_your_column ON your_table (your_column);
These runbooks provide essential commands and SQL statements to help diagnose and troubleshoot common issues with AWS Aurora Serverless MySQL.
Variable | Type | Description |
---|---|---|
apply_immediately | boolean | Apply changes immediately or during your cluster's next scheduled maintenance window. |
backup_retention_period | integer | How long to keep backups for in days. |
deletion_protection | boolean | If the DB instance should have deletion protection enabled. |
enable_http_endpoint | boolean | Whether or not to enable the Data API for a serverless Aurora database engine. |
monitoring.mode | string | Enable and customize CloudWatch metric alarms. |
mysql_version | string | Aurora V1 currently only supports MySQL 5.7 |
scaling_configuration.auto_pause | boolean | Whether to enable automatic pause. A DB cluster can be paused only when it's idle (it has no connections). |
scaling_configuration.max_capacity | number | Each capacity unit is equivalent to a specific compute and memory configuration. Based on the maximum capacity unit setting, Aurora Serverless automatically creates scaling rules for thresholds for CPU utilization, connections, and available memory. Aurora Serverless provides more capacity for the DB cluster from warm pool of resources when its workload is above these thresholds. Aurora Serverless can increase capacity to the maximum capacity unit. |
scaling_configuration.min_capacity | number | Each capacity unit is equivalent to a specific compute and memory configuration. Based on the minimum capacity unit setting, Aurora Serverless automatically creates scaling rules for thresholds for CPU utilization, connections, and available memory. Aurora Serverless reduces the resources for the DB cluster when its workload is below these thresholds. Aurora Serverless can reduce capacity down to the minimum capacity unit. |
scaling_configuration.seconds_until_auto_pause | number | The time, in seconds, before an Aurora DB cluster in serverless mode is paused. |
scaling_configuration.timeout_action | string | The action to take when the timeout is reached. Learn more |
skip_final_snapshot | boolean | Determines whether a final DB snapshot is created before the DB cluster is deleted. If true is specified, no DB snapshot is created. |
source_snapshot | string | On creation, restores a database from snapshot. |
subnet_type | string | Deploy the database to internal subnets (cannot reach the internet) or private subnets (internet egress traffic allowed) |
username | string | Administrative (root) DB username |