Guide: Create an AWS EC2 instance and set up a MySQL server using the AWS RDS service, Connection to the WordPress application.

Guide: Create an AWS EC2 instance and set up a MySQL server using the AWS RDS service, Connection to the WordPress application.

Case :

🔅 Create an AWS EC2 instance.

🔅 Configure the instance with Apache Webserver.

🔅 Download php application name “WordPress”.

🔅 WordPress stores data at the backend in the MySQL Database server. Therefore, you need to set up 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 dive into each step in more detail:

This guide outlines a step-by-step process to establish a robust web infrastructure on Amazon Web Services (AWS).

It covers the creation of an EC2 instance, the setup of a MySQL server utilizing AWS RDS, and the integration of a WordPress application.

Following these steps will enable you to deploy a functional website with scalable and reliable database services, leveraging the power of AWS’s cloud computing capabilities.

  1. Create an EC2 Instance

  • Launch Instance:

  • Navigate to the EC2 Dashboard.

  • Click on “Launch Instance”.

  • Choose an Amazon Machine Image (AMI):

  • Select an AMI (Amazon Linux, Ubuntu, etc.) and click “Select”

Here, I have made Amazon Linux as AMI,

Note: I have used Amazon Linux 2 AMI, as some other AMI may not be yum and dependencies configured. You might not be able to install the software later in some cases

  • Choose an instance type based on your requirements (e.g., t2.micro for free tier).

  • Click “Next: Configure Instance Details”: Create a new security group or use an existing one.

  • Select Ket for Secure Login (if required): Select an existing key pair or create a new one. Download the .pem file and keep it in a secure location.

  • Configure details like VPC, Subnet, and IAM roles (if needed).

  • Go with the default settings

  • Click “Next: Add Storage”.

Review your settings and click “Launch”.

  • Use an SSH client to connect to your EC2 instance using the .pem key.

Get the required Software, in the Linux

Required Softwares:

  • httpd (Apache)

  • MySQL

  • php

  • WordPress Applications

  • With the amazon-linux-extras software as it contains many software get the php7.2 software. It downloads all the dependencies

  • As all the WordPress files have been downloaded

  • Now, We need to copy the files into the httpd server (Apache Server) host files folder

  • Set the Permission and make the file executable by the following commands

  • And restart the Apache httpd server and enable it

Step 2: Set Up AWS RDS (MySQL)

Navigate to RDS:

  • Go to the RDS service from the AWS Console.

  • Launch a Database Instance:

  • Click on “Create database

Select Engine:

  • Choose MySQL.

  • Select the version and click “Next”.

  • Select Easy or Standard Create for more customizations

  • Setup the Database Authentication part

  • Give the database name

  • Master username

  • Set the password to login to MySQL you own

  • Note: Remember the Password which you giving here

  • Fill in the necessary details (DB instance identifier, master username, password, etc.).

  • Now you can connect the Instance directly (or) we can manually connect the database

  • Select the EC2 and choose the Instance ID

  • Note: Here, you need to set the database and EC2 in the same VPC, Region, and Security Group ID. Adjust settings as needed (VPC, subnet, security groups, etc.).

  • Click on “Create Databases”

DB identifier: Database-1 will be created, it may take a while to get the endpoints.

  • All the Setup of RDS is Complete

  • Copy the Endpoint URL

  • Follow the on-screen instructions to complete the WordPress installation.

  • For the Database Host field: Copy the EndPoint URL and insert it in the field.

If this issue occurs try the below,

Now we need to make some changes inside httpd config file

  • Set: AllowOverride All

  • If the above not working do the next,

  • Rename the wp-config-sample.php file: sudo mv wp-config-sample.php wp-config.php.

  • Open wp-config.php and provide the database details (RDS endpoint, username, password, database name).

  • Configure WordPress: Customize the WordPress configuration file (wp-config.php) with RDS database details.

Now we have the page to connect to RDS credentials.

  • Bravo..!, Successfully connected to the RDS

  • Now make the Complete WordPress Setup:

  • Follow the on-screen instructions to complete the WordPress installation.

That’s it! You’ve now set up an AWS EC2 instance, configured a MySQL server using RDS, and connected it to a WordPress application.

Thank you for reading!!!!!

To view or add a comment, sign in

Others also viewed

Explore topics