Interview Prep/AWS/RDS, Aurora and DynamoDB

Writes fail on Aurora MySQL with `ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement`.

IntermediateTroubleshootingRDS, Aurora and DynamoDB
Answer

Likely causes → The app is connected to a reader: through the reader endpoint, an instance endpoint that became a reader after failover, or a pooled connection that lived through a failover.

Diagnose →

aws rds describe-db-clusters --db-cluster-identifier orders \
  --query 'DBClusters[].[Endpoint,ReaderEndpoint,DBClusterMembers[].[DBInstanceIdentifier,IsClusterWriter]]'
mysql -h <host> -e "select @@aurora_server_id, @@innodb_read_only;"

Fix →

  1. Point write traffic at the cluster (writer) endpoint, never at an instance endpoint
  2. Recycle pools after failover. The AWS Advanced JDBC Wrapper handles this
  3. Retry the write after a reconnect

Prevent → Use separate writer and reader data sources in the app, and run failover drills (aws rds failover-db-cluster).

aws All AWS questions Roadmap: AWS core services

More on RDS, Aurora and DynamoDB