Setup WordPress on Lightsail
Step 2: Select Operation System I am Using (Linux)
Setup VPC Peering
Click Advanced Tab and Click Virginia (us-east-1) or you may choose your VPC Region.
It May Takes 30/40 Seconds and Blue Tick Will Come
Now Go To Your AWS Console and Search RDS & Click on RDS
Now Click Create Database
Now Choose Aurora and Select Amazon Aurora with MySQL compatibility
Now Choose a Aurora Mysql Version
Now Put a Database Name and Set Password
Now Select your instance size for your database and replica option if you need. Here i select a Small instance and no replica option hence i don't need any Replica.
How Choose your VPC. Choose the VPC which you select During Peering Option
For Other Configurations Please go through AWS Aurora Documentation. (keep This as it is)
Our Database is Created Successfully
Now Store the Credentials in Safe Place we need it later.
Setup Security Group Inbound Rules
Here we select Mysql Instance Option a instance is created. Now Click on this instance.
Now Click On The Security Group
Click Inbound Rule
Click Edit Inbound Rule
Now Add Lightsail Private IP Block to Mysql Aurora Port to Access the Database
Ligthsail Environment Private IP
Add in the Security Group
Export WP Database
First Access Your Instance With your Browser
Now Run this command To Export Database & Use Your Password
mysqldump -u root -p bitnami_wordpress > wpdatabase.sql --databases --add-drop-database
Import Database into AWS Aurora RDS
Access The Database From Terminal
Command : sudo mysql -u admin -p -h 'Your Host Link'
Data Base Import Command : /. dbname.sql (Put Your DB Name)
Update WP Configuration File to Point the RDS
Now Press Crtl+X and Type 'Y' For Save and Hit Enter.
Now Check Your Site.
Stop local Mysql Service
Now You Can Stop Local Mysql Server. Because we don't need it Anymore. All Request Now Serve from Amazon RDS.
Check Running Services:
Command: sudo /opt/bitnami/ctlscript.sh status
Now Run This Command to Stop MariaDB Services
Now Check again Running Services
Now Prevent MariaDB to start again When you server restart. Just you have to rename the ctlscript.sh file.
When you need to run the script file again just rename again and remove the '.disable' from the filename.
Now you can do the same thing on your another instance to add the RDS End Point. Now Both of your instance sharing the same RDS.
Thanks for Reading This Article.
Top comments (0)