Go back to home page of Unsolicited Advice from Tiffany B. Brown

Setting up WordPress on AWS Elastic Beanstalk with RDS

The information in this post may no longer be accurate or relevant.

I recently had to spin up a development environment for a WordPress project, and I decided to use Amazon Elastic Beanstalk to do so. I mostly did it to get my feet wet with Amazon Beanstalk. After doing it, I can say that it's pretty easy to set up.

Now although it is easy. Set up does take some time, and involves a lot of clicking Next buttons.

You'll need an Amazon Web Services account, obviously. If you haven't done so, create an EC2 key pair (a .pem file). You'll need it to create your Elastic Beanstalk instance, and later to SSH into your server and manage your database.

You'll also need the latest version of WordPress.

Once you log in to the AWS management console, go to the Elastic Beanstalk screen.

  1. Create New Application using the link in the top-right corner.
  2. Enter an Application name and, optionally, a description and click Next.
  3. Select Create web server from the following screen. Use the default role, and click Next.
  4. Use the PHP predefined configuration option.
  5. Choose an Environment type. You can always change it later. Once you make your choice, click Next.
  6. Re-compress WordPress. Beanstalk does not allow directories in the ZIP root, so to speak. But the ZIP archives from http://wordpress.org/ are structured just this way. In order to upload it, we need to repackage it.
    • Expand the WordPress ZIP archive.
    • Enter the expanded wordpress directory, and compress the files within it as a ZIP archive. This is what we'll upload.
  7. On the Application Version screen, select the Upload your own option as the source. Upload the ZIP file you created in Step 6 (and click Next). It will take a while to get the files in place.
  8. Once it's uploaded, you'll need to enter an Environment name and Environment URL. Click Next.
  9. On the Additional Resources screen, choose Create an RDS DB Instance with this environment to create a MySQL database.
  10. Pick an instance type based on how large you expect your database to become eventually.
  11. Select a key pair. Fill in the other options as you'd wish. Click Next.
  12. Add Environment Tags if you'd like. Proceed to the next screen.
  13. On the RDS Configuration screen, select mysql from the DB engine menu. Change your instance class and allocated storage if you'd like.
  14. Enter a user name and password. Pick good ones and make a note of them. You'll need them to configure WordPress. Click Next.
  15. Review all of your settings. Then click Launch. Launching takes several minutes. Go make a sandwich or have a cocktail, then come back.
  16. When your Beanstalk instance is ready, you'll have a URL. Go to it, then begin the WordPress setup process.
    • Use ebdb for the database name. It's always ebdb.
    • Enter the user name and password you chose in Step 14.
    • Use your RDS endpoint — including the port number — as the database host name. You can find this on the RDS administration screen. It will be something long and weird such as aa9831ekphmzwbn1890ew92323cu.cjm0909090325.us-east-1.rds.amazonaws.com:3306. (Apologies if that's your actual endpoint URL.)

That's all there is to it.

Now in order to manage files or the database, you need to SSH into your server.

ssh -i path/to/your/ec2keyfile.pem ec2user@yourapplicationsubdomain.elasticbeanstalk.com

Use the mysql command-line utility to manage your database.

You can view the other details of your Elastic Beanstalk instance from the Elastic Beanstalk or EC2 screens in the AWS console. Your database details can be found under the RDS console.

Adding themes, plugins, etc.

The convenient thing about WordPress, is that plug-ins, themes and files, can be managed through the administrative and publishing interface. You can, however, also upload themes and plug-ins as part of your initial application upload.

What happens if your *elasticbeanstalk.com URL doesn't work?

When you create an Blastic Beanstalk instance, it's supposed to be available at yourapplicationsubdomain.elasticbeanstalk.com. But, as I experienced, this does not always work.

All is not lost, however. Visit your EC2 dashboard. There you'll see how many instances are running, including your Elastic Beanstalk instance. From that screen, you can find the public DNS entry (the URL) for your instance.