We started this tutorial by setting up the local git environment and configuring the AWS Elastic Beanstalk environment in part 1 and then created the MySQL Database in Amazon RDS in part 2. In the final part of this tutorial, we will export the database to Amazon RDS and deploy WordPress to AWS Beanstalk.
Step 4 – Exporting the database and deploying WordPress
Now that we have the environment configured in AWS Beanstalk and the MySQL database created in Amazon RDS, it is time for us to move WordPress to the Cloud.
First, we will export and import the MySQL Database. I am using the MySQL Workbench for this. But you can use either command line or PHPMyAdmin to export and import the database.
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
With the database exported to RDS, we are all set to move WordPress to AWS Beanstalk. But one final step is to change the wp-config.php to point WordPress to the RDS DB Instance. We will replace localhost with the RDS endpoint in the wp-config.php.
Image may be NSFW.
Clik here to view.
Navigate to the WordPress folder and run the following commands
Git add . Git commit – m “final check-in”
The above command should result in the following indicating that the wp-config.php change is now committed.
1 file changed, 1 insertion(+), 1 deletion(-)
We are almost there! Time to run the last few commands to finish the deployment. Run the following commands to complete the deployment. Carefully enter the details that match with the AWS Elastic Beanstalk configuration that we created earlier.
git aws.config
Image may be NSFW.
Clik here to view.
Finally, take a deep breath and run the following command
git aws.push
This will take a while as it uploads all the files to the AWS Beanstalk environment. After the upload is complete, make sure that the environment is healthy and green.
Image may be NSFW.
Clik here to view.
Clicking on the URL should open the WordPress blog running within AWS Elastic Beanstalk.
Image may be NSFW.
Clik here to view.
Congratulations! You have successfully deployed WordPress on AWS Elastic Beanstalk!
Notice that the URL for the WordPress blog is now available at
Image may be NSFW.
Clik here to view.
PS – If you have issues with rendering the blog correctly in the browser, log into the WordPress dashboard or change the settings in wp_options table to update the site settings to reflect the current URL.
- Janakiram MSV, Chief Editor, CloudStory.in