Launching WordPress in EC2 with RDS backend


Content of this Blog


Part 1 : Creation of EC2 Instance

Click on Launch
Generation of new key i.e., “wordpress” and then click on Launch Instances

Part 2 : Creation of MySQL Database with RDS

Part 3 : Allowing EC2 Instance to Access RDS Instance

RDS Security Group after configuration

Part 4 : Configuration of WordPress on EC2 Instance

ssh -i <path/to/pem/file> ec2-user@<publicIpAddress>
After executing the above command in the terminal
sudo su - rootyum install httpd -y
systemctl enable httpd --now
Use the Instance’s Public IP to check if Apache Httpd server has been setup properly
tar -xzf latest.tar.gz
# WordPress dependency
amazon-linux-extras install -y php7.2
cd wordpress
cp wp-config-sample.php wp-config.php
vi wp-config.php
cd /root
cp -r wordpress/* /var/www/html/
systemctl restart httpd
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpressdb' );
/** MySQL database username */
define( 'DB_USER', 'admin' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password' );
/** MySQL hostname */
define( 'DB_HOST', '' );
DB_HOST in wp-config.php could be obtained by using the RDS Instance Endpoint

WordPress Output