Migrate the WordPress Database to AWS RDS
Explore the process of migrating a WordPress MariaDB database from an EC2 instance to AWS RDS. Learn how to launch new instances, connect via SSH, backup your database, and prepare it for scalable cloud deployment.
In this chapter, we’ll migrate the MariaDB database, which is currently hosted on the same EC2 instance as WordPress, to an external RDS MariaDB database.
Doing so allows us to separate the components of the WordPress application and scale them individually. By using RDS, we gain access to all of the options AWS provides to scale and operate databases efficiently.
Migration steps
Let’s take a look at the steps involved to migrate the database.
Step 1: Launch WordPress instance from launch template
The first step is to recreate the WordPress instance. To do so, we can use the new launch template.
Execute the following command in the terminal:
The command starts a new instance based on the launch template with the name custom-wordpress-vpc.
- The
--queryparameter filters the output to only display theInstanceIdand thePublicIpAddress. We’ll usePublicIpAddressto connect to the WordPress instance via SSH. --output textformats the output as text.
Run the command above. The output should look similar to this:
Now, it seems that instead of a PublicIpAddress, we got None. This can happen because the public IP address will only be assigned once the instance is ready.
Therefore, let’s wait a bit and run the following command after a few minutes:
We’re using the describe-instances command with the --filters parameter and only select instances that have the team tag with the wordpress ...