How to encrypt a production unencrypted RDS Aurora MySQL 8 cluster

0

I have a running RDS Aurora MySQL 8.0.23 cluster running in production. The database is unencrypted and I need to enable encryption for it. As far as I understand, this is not possible to do directly. The procedure I am evaluating is:

  1. Create a read replica on the current cluster.
  2. Stop replication on replica and annotate binlog filename and position.
  3. Promote the read replica to a new encrypted cluster (maybe it requires to do a snapshot before).
  4. Set up back replication with the original cluster using binlog file and position annotated before.
  5. Wait until replication lag is zero.
  6. Redirect production traffic to the new cluster.
  7. Stop replication.
  8. [Optional] Delete old cluster.

I have two issues with the above procedure:

  • Once created the replica, running commands like 'SHOW SLAVE STATUS' or 'SHOW REPLICA STATUS' return empty set, so I can't annotate binlog file and position. Please note that replication is enabled on the original cluster (binlog_format is set to ROW).
  • It seems I can't promote the Aurora read replica to a new cluster, the options is missing on the available actions. But according to the documentation it should be possible.

Has anyone have feedback about the issues above? What is the current up-to-date procedure to encrypt and Aurora MySQL cluster with minimum downtime and no data loss?

3 Answers
0

Hi, thanks for the answer!

According from here https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Replication.MySQL.html Aurora does support native binlog replication, although it does not use it apparently for read replicas. Would be possible to promote a read replica to a new cluster and enable MySQL binlog replication between the original cluster and the new one? Then I could redirect traffic to the new one once the replica lag is zero, minimizing the downtime

Ludo
answered a year ago
0

From the documentation : https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Overview.Encryption.html

  • You can't convert an unencrypted DB cluster to an encrypted one. However, you can restore an unencrypted snapshot to an encrypted Aurora DB cluster. To do this, specify a KMS key when you restore from the unencrypted snapshot.
  • You can't create an encrypted Aurora Replica from an unencrypted Aurora DB cluster.

So the process could be something similar to below

  • Schedule some down time for the application
  • Stop all traffic to the database
  • Create a final snapshot from the current unencrypted cluster
  • Import that snapshot into a new encrypted cluster
  • Bring up your application now pointing to the new cluster

Also note that Aurora does not use bin log replication - the replication is done on the storage layer and not within MySQL.

profile picture
answered a year ago
0

Alternative process to the one I mentioned above to minimize downtime by creating a new encrypted cluster and replicating data to it before cutting over.

We are mostly following guidance here : https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Replication.MySQL.html

  1. Enable binary loggong on unencrypted Aurora cluster (note this requires a reboot as we are changing the cluster parameter group)

  2. Enable binary log retention on the unencrypted cluster. You do this by setting a configuration as Aurora does not allow you access to underlying logs

  3. Create a snapshot of the unencrypted database. This is a fairly straightforward process with the console or aws cli

  4. Create a new encrypted cluster from snapshot Key step here is to make sure you have a KMS key and you use that kms key id when restoring the snapshot (https://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-cluster-from-snapshot.html shows the --kms-key-id parameter to use)

  5. Create a replication user on unencrypted cluster

  6. enable replication on encrypted cluster

  7. continue to replicate till ready to migrate

  8. When ready to migrate stop all traffic to unencrypted cluster

  9. monitor replication to ensure its complete to the encrypted cluster

  10. Stop replication (on both encrypted cluster and unencrypted cluster)

  11. do some sanity checks, maybe shutdown unencrypted cluster cleanly

  12. Migrate application to new encrypted cluster

Please make sure you accept the answer if it helps!

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions