简体   繁体   中英

Updating an Aurora serverless from MySQL 5.6 to 5.7 with CloudFormation without loss

Context

I need to upgrade a production Aurora serverless database from MySQL 5.6 to 5.7. All my resources are deployed as Infrastructure as a Code, with CloudFormation.

Problem

Updating the engine version in the CloudFormation template would result in the database replacement, thus downtime and data loss. I also have a lot of dependent resources that rely on the database ARN to connect. (The ARN is currently exported as a cross-stack reference).

Question

What would be a clean way to achieve that kind of maintenance, viable on the long-run?

Thanks in advance !

If you take a look in any CloudFormation documentation each parameter will be labelled with Update requires . This will identify if there is a definitive replacement or a conditional replacement of your resource (or none at all).

For an Aurora Serverless cluster the documentation has many parameters that will force a replacement of this.

How you handle this depends on the importance of the resource, remember that even starting from a snapshot will involve potential downtime in which time any data written to the original cluster would also be lost.

Personally I would recommend looking at the following factors:

  • Can your system run without this database for any period of time? If no then you should run both databases simultaneously. Then use a service like DMS to synchronise between. Once you're happy perform the switchover.
  • Can your application run in a read-only mode? If so stop writes to the original DB and then take a snapshot. Create the new DB as an additional resource and launch from the snapshot.

I would suggest trying to create this as an additional resource, as unlike most resources losing your DB might not be as simple to rollback if it has been deleted. Once you're confident only then remove the previous DB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM