Deploy WordPress with Amazon RDS
How to deploy WordPress with Amazon RDS
In this blog, I will demonstrate how to perform the following operations:
- Create an AWS EC2 Instance.
- Configure the EC2 Instance with Apache Webserver and a PHP (PHP 7.2) application named “WordPress”.
- Configure AWS RDS to set up the MySQL database server (MySQL 5.7) for the WordPress application.
- Provide the endpoint/ connection string to the WordPress application to make it work.
Step 1: Create an AWS EC2 Instance.
AWS Management Console → EC2 → Instances → Launch Instances
Select Amazon Linux 2 AMI
Add tags:
name: wordpress-app
env: test
Select a Security Group that has inbound rules for HTTP, HTTPS, and SSH from anywhere. Or create a new one in case you don’t have one.
Select a key pair that will be later used for SSH to the Instance
Step 2: Configure the EC2 Instance with Apache Webserver and a PHP application named “WordPress”.
Connect to the Instance using SSH Protocol:
$ ssh -i “[key_pair_name]” ec2-user@[PUBLIC_IP or Public IPv4 DNS]$ sudo su -
Install required packages:
$ yum install -y httpd
Start and enable the httpd service:
$ systemctl enable httpd — now
Install the application dependencies you need for WordPress
$ amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
Download the WordPress application
$ wget https://wordpress.org/latest.tar.gz
$ tar -xzf latest.tar.gz
$ ls$ cp -r wordpress/* /var/www/html/$ ls /var/www/html$ systemctl restart httpd
Step 3: Configure AWS RDS to set up the MySQL database server for the WordPress application.
AWS Management Console → Amazon RDS → Create database
Select the following configurations:
At last, select create database
Step 4: Provide the endpoint/ connection string to the WordPress application to make it work.
First, let’s check if we can connect to the database endpoint:
$ mysql -h [endpoint_of_rds_instance] -P 3306 -u admin -p
Hurray, we can connect to it. Now let's move forward…
Browse to your EC2 instance public IP where httpd webserver is running:
Now follow these configuration steps:
$ vim wp-config.php
Now hit Run the installation
Finally, the connection of WordPress with Amazon RDS running MySQL server is established and our application is up and running perfectly fine
🎉🎉
That’s all for today! I’ll be back with some new articles very soon, thanks! 🤗
Muhammad Tabish Khanday
LinkedIn: https://www.linkedin.com/in/mtabishk/
More content at plainenglish.io