Amazon Relational Database Service (Amazon RDS) allows users to easily create, operate, and scale a relational database in the cloud. In this lab, we create an RDS database, install a web server and configure WordPress to connect to the RDS database. We then run the final configuration through the web browser and are presented with a working WordPress blog. By the end of this lab, the user will understand how to create an RDS database and configure WordPress to use it to store data.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create RDS Database
Using the AWS console, create an RDS database with the following configurations:
- Choose a database creation method:
Standard create
- Engine options:
MySQL
- Edition:
MySQL Community
- Version:
MySQL 8.0.28
- Templates:
Free tier
- DB instance class:
db.t2.micro
- DB instance identifier:
wordpress
- Choose a database creation method:
- Install Apache and Dependencies
Connect to your Cloud Server webserver-01 and perform the following tasks:
- Use the apt command to install:
apache2
libapache2-mod-php
php-mysql
- Move the
/wordpress
folder into your/var/www
directory - Move your
/var/www/wordpress/000-default.conf
file to/etc/apache2/sites-enabled/
- Restart
apache2ctl
- Use the apt command to install:
- Configure WordPress
Configure
wp-config.php
to connect to the RDS database we created.- Edit your
/var/www/wordpress/wp-config.php
file and replace'localhost'
by your own RDS endpoint on the linedefine('DB_HOST', 'localhost');
- Save and close the file
- Edit your
- Modify Security Groups
Modify your non-default security group to allow the EC2 instance to connect to the MySQL/Aurora RDS database.
- Complete WordPress Installation and Test
Visit the website and complete the installation, ensuring the website can be visited and the WordPress portal works.