Install MySQL Database in AWS and WordPress

Sep 5, 2019 20:32 · 360 words · 2 minute read Amazon Web Services AWS EC2 Wordpress

Welcome in the next post in the WordPress series.

Today I will continue with WordPress article series.

In a previous post https://www.funwithcloud.com/install-lemp-stack-on-ubuntu-linux/ I described how to create a fully working LEMP stack on Ubuntu.

In this post we will stick to WordPress being hosted on Linux EC2 virtual machine, but we will use an external database. I already created a Ubuntu based EC2 instance which is up and running.

Install MySQL Database in AWS 1

Create Database in AWS

  1. Login to AWS console.
  2. Once logged in navigate to services menu and choose Amazon RDS. Install MySQL Database in AWS 2
  3. Click Create databse.
  4. Now you can choose between Standard Create or Easy Create. The difference between those two is simply more advanced configuration options for the database. I will choose Easy Create. You can choose something else for production deployment.
  5. Choose engine. MySQL or MariaDB. Both will work fine with WordPress.
  6. I’ve selected MySQL with Free Tier to avoid any extra costs. Install MySQL Database in AWS 3
  7. Enter the name for the WordPress database alongside with username and password. Install MySQL Database in AWS 4
  8. As this is a test deployment we are fine with Burstable class of our database. Install MySQL Database in AWS 5
  9. Choose apropriate databse size. Default 20 GiB is more than enought for a WordPress instance. Install MySQL Database in AWS 6
  10. We use burstable database so we kind of can’t change anything in Availability & durability section :).
  11. I think this might be the most important part of the deployment so far. We have to choose following settings:
    • Default VPC
    • Subnet group
    • Publicly accessible - 99% choose no
    • VPC Security Group
    • Database port Install MySQL Database in AWS 7
  12. Once finished click the button to create a database.
  13. After some time your database will be created and you will see a notification to check the credentials. Install MySQL Database in AWS 8
  14. Click the notification and note your username, password and database endpoint. Install MySQL Database in AWS 9

Configure WordPress with AWS Database

  1. One additional step is to connect from our EC2 instance to RDS Database and create database. bash sudo mysql -h your.endpoint.us-west-2.rds.amazonaws.com -u YOURUSERNAME –p Once connected simply create new database with this command mysql create database wordpressdb;
  2. Once we have all the necessary information we can configure WordPress wp-config.php file.
  3. We need to enter previously noted username, password and database endpoint. Install MySQL Database in AWS 11
  4. If the configuration is fine you should see the WordPress installation prompt. Install MySQL Database in AWS 12
Tweet Share