Tutorial: Deploying WordPress on AWS Elastic Beanstalk and Amazon RDS - Part 3/3
Wednesday May 16, 2012 , 2 min Read
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.
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.
Navigate to the WordPress folder and run the following commands
[crayon lang="shell"]
Git add .
Git commit – m “final check-in”
[/crayon]
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.
[crayon lang="shell"]
git aws.config
[/crayon]
Finally, take a deep breath and run the following command
[crayon lang="shell"]
git aws.push
[/crayon]
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.
Clicking on the URL should open the WordPress blog running within AWS Elastic Beanstalk.
Congratulations! You have successfully deployed WordPress on AWS Elastic Beanstalk!
Notice that the URL for the WordPress blog is now available at .elasticbeanstalk.com
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