||Integration of Amazon RDS with the WordPress||
Amazon Relational Database Service (Amazon RDS) makes 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.
Amazon RDS is available on several database instance types — optimized for memory, performance or I/O — and provides you with six familiar database engines to choose from, including Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and SQL Server. You can use the AWS Database Migration Service to easily migrate or replicate your existing databases to Amazon RDS.
WordPress is a free, open-source website creation platform. On a more technical level, WordPress is a content management system (CMS) written in PHP that uses a MySQL database. In non-geek speak, WordPress is the easiest and most powerful blogging and website builder in existence today.
WordPress is an excellent website platform for a variety of websites. From blogging to e-commerce to business and portfolio websites, WordPress is a versatile CMS. Designed with usability and flexibility in mind, WordPress is a great solution for both large and small websites.
Let’s start with the actual task
🔅 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.
Step I : Create AWS EC2 instance
I launched the Amazon Linux -2 OS. You can launch it by GUI or by the CLI. The command used to launch by CLI is
aws ec2 run-instances — image-id ami-08e0ca9924195beba — count 1 — instance-type t2.micro — key-name new2 — user-data file://my_script.txt
Step II: Configure instance with Apache webserver
Install the Apache httpd
yum install httpd -y
Start the service
systemctl start httpd
Stop the SElinux
Step III : Download the php Application called “WordPress”
amazon-linux-extras install php7.2 -y
Download the Wordpress
tar -xzf latest.tar.gz
OR instead of doing Step II,III manually, we can do it by the CLI also. So in the terminal create the user-data file and write the commands which we have to run after OS boots up
yum install php-mysqlnd php-fpm mariadb-server httpd tar curl php-json wget -y
amazon-linux-extras install php7.3
curl https://wordpress.org/latest.tar.gz --output wordpress.tar.gz
tar xf wordpress.tar.gz
cp -r wordpress /var/www/html
systemctl start httpd
systemctl enable httpd
Write above content in the file and save it with .txt extenssion. And then run the following command
aws ec2 run-instances --image-id ami-08e0ca9924195beba --count 1 --instance-type t2.micro --key-name <key_pair_name> --security-groups <security_group_name> --user-data file://<file_name>.txt
Step IV: Setup a MySQL server using AWS RDS service using Free Tier.
Go to the RDS(Relational Database Service) page
Database is created
You can also create the database through CLI by the command
aws rds create-db-instance --db-name "taskdb" --db-instance-identifier "mydbinstance" --master-username "admin" --master-user-password "bvcoew123" --db-instance-class "db.t2.micro" --allocated-storage "20" --max-allocated-storage "1000" --vpc-security-group-ids "sg-014b635a5ac473dbd" --availability-zone "ap-south-1a" --engine mysql
Step V: Provide the endpoint/connection string to the WordPress application to make it work.
Copy the endpoint url
Now enter the
in the browser and the webpage of the wordpress will come up.
Click on the Let’s go!
Now you will see the another page , put the database name which we have created already , put username , password and put the database host as a endpoint which we have copied earlier and click on Submit.
Here,it is not able to create wp-config.php file. Let’s create it manually. Copy the content from here.
# vim /var/www/html/wordpress/wp-config.php
And paste the content as it is inside this
After this restart the httpd service
systemctl restart httpd
Again go the webpage and click on Run Installation and now you will see the following page
Here create the username and password for the wordpress and put some required login credentials
After log-in , you will see this page and from here you can use the Wordpress