Install MySQL Database in AWS

Sep 5, 2019 20:32 · 448 words · 3 minute read

Welcome in the next post in the WordPress series.

Today I will continue with WordPress article series.

In a previous post 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][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][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][3]
  7. Enter the name for the WordPress database alongside with username and password. ![Install MySQL Database in AWS 4][4]
  8. As this is a test deployment we are fine with Burstable class of our database. ![Install MySQL Database in AWS 5][5]
  9. Choose apropriate databse size. Default 20 GiB is more than enought for a WordPress instance. ![Install MySQL Database in AWS 6][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][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][8]
  14. Click the notification and note your username, password and database endpoint. ![Install MySQL Database in AWS 9][9]

Configure WordPress with AWS Database

  1. One additional step is to connect from our EC2 instance to RDS Database and create database.
sudo mysql -h  -u YOURUSERNAME –p

Once connected simply create new database with this command

create database wordpressdb;
  1. Once we have all the necessary information we can configure WordPress wp-config.php file.
  2. We need to enter previously noted username, password and database endpoint. ![Install MySQL Database in AWS 11][11]
  3. If the configuration is fine you should see the WordPress installation prompt. ![Install MySQL Database in AWS 12][12] [1]: /uploads/2019/09/install-mysql-in-aws-1.png [2]: /uploads/2019/09/install-mysql-in-aws-2.png [3]: /uploads/2019/09/install-mysql-in-aws-3.png [4]: /uploads/2019/09/install-mysql-in-aws-4.png [5]: /uploads/2019/09/install-mysql-in-aws-5.png [6]: /uploads/2019/09/install-mysql-in-aws-6.png [7]: /uploads/2019/09/install-mysql-in-aws-7.png [8]: /uploads/2019/09/install-mysql-in-aws-8.png [9]: /uploads/2019/09/install-mysql-in-aws-9.png [10]: /uploads/2019/09/install-mysql-in-aws-10.png [11]: /uploads/2019/09/install-mysql-in-aws-11.png [12]: /uploads/2019/09/install-mysql-in-aws-12.png
Tweet Share