Today we will walk-through the setup of AWS Aurora service with WordPress on Lightsail Instance. I have a video on connecting WordPress with a Lightsail Database Service so if you are interested in that, click on the info card above; however AWS Aurora may be a little cost effective and also has more flexibility in features that will help a website with growing traffic and here reviews that say Aurora is faster than the Lightsail Database.
For those that are wondering why we would even want to do this… Separating your database from your WordPress website helps in scaling you website when you have a increase in traffic. I have made an entire series on how to setup a load balanced WordPress website with Lightsail, click on the card above for those or I will post those links in the description below. Its quite simple to use AWS Aurora Aurora but there a couple of extra steps necessary to have it work with instances in Lightsail and so I’ll cover those in this video. So without further ado, let’s get started.
Steps covered in tutorial:
1. Have a wordpress instance
2. Enable VPC Peering for the region that the instance is running in
3. AWS Console – make sure in the same region as Lightsail
4. Search RDS, goto AWS RDS
5. Create Database
6. Standard Create (Easy Create has a bug for IAM Authentication)
– Aurora
– Serverless
– defaults
7. View Credentials
7a. Find Private IP from lightsail
7b. Add to Security Group as Inbound Rules.
7c. Select MySQL/Aurora for the port and the Private IP from Lightsail.
In the source box, enter 172.26.0.0/16 (this is the CIDR address for the Lightsail subnet)
8. Export database from local
mysqldump -u root -p bitnami_wordpress > wpdatabase.sql --databases --add-drop-database
9. Import to Aurora RDS
mysql -u admin -p -h database-1.cluster-cpra3hy1rb5x.us-east-1.rds.amazonaws.com
Import the mysql database:
\. wpdatabase.sql
- Update wp-config.php
- Stop MySQL
sudo /opt/bitnami/ctlscript.sh stop mysql
sudo mv /opt/bitnami/mysql/scripts/ctl.sh /opt/bitnami/mysql/scripts/ctl.sh.disabled
All videos tutorials on the website as well as the YouTube channel aim to provide a simplified process for a specific scenario; there could be many different factors and unique use cases you may have. The tutorials may not cover every situation; so treat is as a starting point or learning concept to apply to your unique situations, and consider this inspiration but not prescription or explicit direction.