jannevuori's avatar

RDS MySQL upgrade to 8.4

AWS has now been bombing to upgrade the RDS MySQL from 8.0.40 to 8.4.6 on my Vapor application. Tried to figure out what would be the best way to do it and somehow got into the Amazon RDS Blue/Green deployments. If someone is already familiar how to do this within the Vapor application (I've already created the green database for my staging) your help is appreciated here.

Now what next? Should I just switch the b/g db and test the app with the staging?

0 likes
2 replies
jannevuori's avatar

No more Larry answers.

Gave up with the b/g deployment.

Tried with the Vapor CLI database:upgrade -command and found out that it thought "No possible upgrades were found for the given database" and by taking a look at the code of the CLI it really is so that the MySQL 8.0 is the latest Vapor supports.

So should I stick with the 8.0 or start again the b/g upgrade and then connect to the new database manually or what do you suggest? Or could it just work after the upgrade after the switch over b/g?

LaryAI's avatar
Level 58

Certainly! Here’s a step-by-step solution tailored for a Laravel Vapor application using Amazon RDS Blue/Green deployments for upgrading MySQL from 8.0.40 to 8.4.6:


1. Confirm Blue/Green Deployment Setup

You’ve already created the Green database (the upgraded environment). Make sure:

  • The Green environment is fully synced with your Blue (current production) database.
  • The Green environment is running MySQL 8.4.6.
  • Replication lag is minimal.

2. Update Vapor Environment Configuration

In your Laravel Vapor project, each environment (production, staging, etc.) has its own .env file or environment variables set via the Vapor dashboard.

  • Go to your Vapor dashboard.
  • Select your project and environment (e.g., staging).
  • Update the database connection variables (DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD) to point to the Green database endpoint.

3. Test the Application

Before switching production, test your application thoroughly on staging:

  • Deploy your application to the staging environment.
  • Ensure the .env or Vapor environment variables are pointing to the Green database.
  • Run your test suite and manually test critical flows.

4. Prepare for Production Cutover

Once you’re confident everything works on staging:

  • Repeat the environment variable update for your production environment in Vapor, but do not switch yet.
  • Schedule a maintenance window if needed.

5. Perform the Blue/Green Switch

When ready:

  • In the AWS RDS console, initiate the Blue/Green switchover. This will promote the Green database to be the new production database.
  • The endpoint for the Green database will become the new primary endpoint.

6. Update Vapor Production Environment

If the endpoint changes after the switchover, update the DB_HOST in your Vapor production environment to the new endpoint.

7. Deploy and Verify

  • Deploy your application to production (if needed).
  • Monitor logs and application health.
  • Verify that the application is connecting to the new database and everything is functioning as expected.

Example: Updating Vapor Environment Variables

You can update your environment variables via the Vapor dashboard or using the CLI:

vapor env:edit production

Then update:

DB_HOST=your-green-db-endpoint.rds.amazonaws.com
DB_DATABASE=your_db_name
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password

Summary

  1. Test your app with the Green database in staging.
  2. When ready, perform the Blue/Green switch in RDS.
  3. Update Vapor’s production environment variables to point to the new database endpoint if needed.
  4. Deploy and monitor.

Tip: Always back up your database and test thoroughly before switching production traffic!

Let me know if you need more specific code or configuration examples!

Please or to participate in this conversation.