Configure WordPress on ec2-instance using AWS RDS Service
In this blog we are gonna to discuss how to launch WordPress application in AWS ec2 instance and connect with RDS Database
What is WordPress?
WordPress is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database. it is web publishing software you can use to create your own website or blog.
What is AWS RDS?
Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security and compatibility they need.
Task Description:-
- Create an AWS EC2 instance
- Configure the instance with Apache Webserver.
- Download PHP application name “WordPress”.
- As WordPress stores data at the backend in MySQL Database server. Therefore, you need to setup a MySQL server using AWS RDS service using Free Tier.
- Provide the endpoint/connection string to the WordPress application to make it work.
Let’s start doing our task:-
Create an AWS EC2 instance:-
Login to your AWS management console
After Login click on ec2 then click on “Launch Instances” after it select your configuration like AMI , Instance type , Security Group etc.
Here I am allowing all traffic from anywhere but it is not good for security , You can customize it as per your your requirement
Take a review , attach the key and launch it.
Now our instance launch properly let’s move for next step
Configure the instance with Apache Webserver:-
To configure the apache webserver we have to login inside our instance let’s do it
for login We use SSH
Now in our system we have to install multiple packages like “wget” “tar” “httpd” “php-mysqlnd” “php-fpm” and “php7.3”
Let’s discuss about all these
wget : The wget command is a command line utility for downloading files from the Internet.
tar: The
tar
command is used to compress a group of files into an archive. The command is also used to extract, maintain, or modify tar archives.php-mysqlnd: The MySQL native driver for PHP (mysqlnd) is a drop-in replacement for the MySQL Client Library (libmysql) for the PHP script language.
PHP-FPM:- PHP-FPM (an acronym of FastCGI Process Manager) is a hugely-popular alternative PHP (Hypertext Processor) FastCGI implementation.
Now let’s install all these in our ec2-instance
now we will install PHP version 7.3
we have already install httpd software for apache webserver let’s start the services of it
Now our webserver is working fine let’s go to document root of webserver and download the PHP application
to download the PHP application we use wget command
PHP application downloaded but it is a tar file we have to extract it
for extracting we use tar command
after extract they will create one directory name “wordpress”
now our webserver is configure properly or not let’s check it
paste your ec2-instance ip on your browser
Let’s test our PHP application
http://ec2-instance-ip/wordpress
Now let’s move to another step
As WordPress stores data at the backend in MySQL Database server. Therefore, you need to setup a MySQL server using AWS RDS service using Free Tier.
Let’s create a database for wordpress
- Go to AWS management console and search for RDS
- After open RDS click on “create database”
and now choose your configuration step in my case it is
after selecting your configuration click create database
After some time our Database is ready let’s connect our database with endpoint
In local system run the command
“mysql -h endpoint_of_database -u username -p “
database created now we use this database in our PHP application
http://ec2-instance-ip/wordpress
In my case it is
wow it’s connected to my database , one thing I have to do , that I need to update the wp-config.php file manually , Let’s do it then we will install our wordpress
Now we will install the wordPress
Thanks for reading…