A Comprehensive Guide: Deploying WordPress on AWS using Apache, MySQL, and RDS

Pramod Kumar Gupta
4 min readAug 2, 2023

Step 1 :

Access your AWS Management Console using your login credentials.

Go to the EC2 Dashboard and locate the “Launch Instance” button.

Pick the desired Amazon Machine Image (AMI), such as Amazon Linux 2, from the available options.

Select an appropriate instance type that suits your needs, like t2.micro, which is eligible for the AWS Free Tier.

Configure the instance details, including the network, subnet, security group, and IAM role as per your requirements.

Review all the settings you’ve selected to ensure they’re accurate.

Finally, click on the “Launch” button to initiate the creation of your EC2 instance.

Now connect to the ec2 instance and install apche sevrer using the following commands .

yum install httpd 

Also start and enable the service using following command -

systemctl start httpd

systemctl enable httpd

Go to the following folder .

cd /var/www/html

Now downlaod wordpress and extract it .

sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
sudo rm latest.tar.gz

To configure permissions for WordPress use the following command …

sudo chown -R apache:apache /var/www/html/wordpress

Now let’s setup AWS RDS MySQL database -

  1. Navigate to the AWS RDS Dashboard and click on “Create Database.”
  2. Select “MySQL” as the preferred database engine and choose the desired version.
  3. Configure the database settings, providing a unique DB instance identifier, master username, and a secure password.
  4. Customize advanced settings like the database instance size, storage capacity, and backup preferences as needed.
  5. Double-check all the settings to ensure they are accurate, and then proceed to create the RDS instance.

Now Provide the endpoint to wordpress.

Go to the AWS RDS Dashboard and locate your newly created RDS instance.

Find and note down the “Endpoint” (connection string) from the RDS Dashboard. This endpoint will typically look like “your-database-name.xxxxxxxx.region.rds.amazonaws.com”.

Access your WordPress installation files and locate the “wp-config.php” file.Open the “wp-config.php” file in a text editor of your choice.

cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
sudo vi wp-config.php
  • Modify the following lines with your RDS endpoint, username, password, and database name:
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_database_username');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'your_rds_endpoint');

Now we need to Complete Wordpress setup

Access your WordPress site by visiting your EC2 instance’s public IP in a web browser.

Complete the WordPress installation by providing a site title, admin username, password, and email.

Thanks for reading …..

--

--