<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joel Johnson</title>
    <description>The latest articles on DEV Community by Joel Johnson (@lastaur0ch).</description>
    <link>https://dev.to/lastaur0ch</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1000970%2F2c9422b4-a1d8-4655-b64b-b3845c64cb3a.png</url>
      <title>DEV Community: Joel Johnson</title>
      <link>https://dev.to/lastaur0ch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lastaur0ch"/>
    <language>en</language>
    <item>
      <title>Simple WordPress website on AWS using EC2 and RDS</title>
      <dc:creator>Joel Johnson</dc:creator>
      <pubDate>Fri, 17 Feb 2023 15:37:06 +0000</pubDate>
      <link>https://dev.to/lastaur0ch/simple-wordpress-website-on-aws-using-ec2-and-rds-293c</link>
      <guid>https://dev.to/lastaur0ch/simple-wordpress-website-on-aws-using-ec2-and-rds-293c</guid>
      <description>&lt;p&gt;The goal of this project is to build an accessible website for everyone using the cloud. I will use the following technologies to accomplish this task.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;WordPress - The most popular CMS on the internet.&lt;/li&gt;
&lt;li&gt;AWS EC2 - The server hosting the website.&lt;/li&gt;
&lt;li&gt;AWS RDS - The database host for the WordPress MySQL.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Creating the Database
&lt;/h2&gt;

&lt;p&gt;On the AWS dashboard, search for RDS and continue to the RDS dashboard. Click on the 'Create database' button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb68w3t6n46c46jqt7hd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb68w3t6n46c46jqt7hd8.png" alt="Click on 'Create database' button" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the standard option and select MySQL database engine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faur07o7aq6macf2lfw9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faur07o7aq6macf2lfw9n.png" alt="Pick database engine" width="800" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have selected the free tier template to avoid charges on my account. You can select any of the others depending on your use case. Note that this will affect the default configuration of your database instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhrsd1hzh2jty3goy3op.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdhrsd1hzh2jty3goy3op.png" alt="Pick a sample template" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the settings section, enter the DB instance name and Master credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0iflpc4ozxsmig1hl4ey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0iflpc4ozxsmig1hl4ey.png" alt="Enter DB instance name and credentials" width="800" height="708"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select your database instance configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frh7j5chwuyhizctzca08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frh7j5chwuyhizctzca08.png" alt="DB instance configuration options" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the storage type and size of the database instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5xecks9ktslawjtc4mr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff5xecks9ktslawjtc4mr.png" alt="DB storage config" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, enter network and connectivity settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhe7wbxjdnc0thapqeb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhe7wbxjdnc0thapqeb9.png" alt="Network settings" width="383" height="744"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the additional configuration section, enter a database name. This automatically creates a database when the database instance is launched.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7utkk3fg2qr1qfdt3ltd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7utkk3fg2qr1qfdt3ltd.png" alt="Additional configuration section" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The final step is to click the 'Create database' button.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1w7qdm2rx3mm91sc6x3s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1w7qdm2rx3mm91sc6x3s.png" alt="Complete RDS database creation" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After your RDS instance has been created, you should then see it running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw753ts58wyzx85l136j3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw753ts58wyzx85l136j3.png" alt="Creating RDS DB instance" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Provisioning the server
&lt;/h2&gt;

&lt;p&gt;Good job! We will now create an EC2 instance that will host the WordPress application. All packages and dependencies required to get the CMS running and communicating to the RDS instance will also be installed. They are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Apache (httpd) web server&lt;/li&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, go to the EC2 instance dashboard and click the 'Launch instance' button. Enter your preferred server name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3btchj59931qw4u29qwu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3btchj59931qw4u29qwu.png" alt="Enter EC2 server name" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, select your operating system image. I have used Amazon Linux 2 here. Note that for another AMI the installation process might be slightly different.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbfydb9e5szj5lo5yaoeb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbfydb9e5szj5lo5yaoeb.png" alt="Select AMI" width="800" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now select the instance type. Since we are in the free tier, I have selected the eligible t2.micro.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3qspa0xfevol2ej73yr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3qspa0xfevol2ej73yr.png" alt="Select Instance type" width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a key-pair. They are used for making secure connection from a client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frt7r21zayfl5jvcwqf88.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frt7r21zayfl5jvcwqf88.png" alt="Create key-pair for SSH" width="666" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe2cbjvro5xhejipciig6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe2cbjvro5xhejipciig6.png" alt="Key-pair created!" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, configure your network settings and security group information. I have only allowed SSH (port 22) and HTTP (port 80) to communicate to the server. And for the secure connection I have selected only my IP address to have access, which will be done using the key pair I created above. You can click on 'Edit' to make more changes, also security groups can always be modified later on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21d5okuhouoo2e1ecy5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21d5okuhouoo2e1ecy5p.png" alt="Network settings" width="784" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To provision the server, go to the 'Advanced details' section and modify the 'User Data' with a script that installs &amp;amp; starts an Apache server.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqn0fclpq3ugiwcprkj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftqn0fclpq3ugiwcprkj5.png" alt="Advance details" width="781" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr85i8864fzjjeuzhm9ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr85i8864fzjjeuzhm9ap.png" alt="Custom script to install and run Apache web server" width="599" height="397"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  User data script:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;That is the last configuration for now. You can now launch the EC2 instance by clicking the 'Launch instance' button in the summary section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x4u7i5e7gt7nh18amr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x4u7i5e7gt7nh18amr0.png" alt="Launch EC2 instance" width="377" height="725"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now see the instance running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk2iv5lcwe00811xhobw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsk2iv5lcwe00811xhobw.png" alt="EC2 instance running" width="800" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visit the EC2 public IP address and you should see a sample Apache page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx87e4cds21i8k1m6c5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmx87e4cds21i8k1m6c5d.png" alt="Apache web server works" width="800" height="211"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h2&gt;
  
  
  RDS Connection Configurations
&lt;/h2&gt;

&lt;p&gt;After setting up both the EC2 web server and RDS database instances. We now want both of them to communicate directly. We would do this by modifying the security group of the RDS instance.&lt;/p&gt;

&lt;p&gt;Go back to the RDS instance page. Click on the WordPress database to view the details page. In the 'connectivity &amp;amp; security' tab, click the link to the default security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklqprqpi3je75l6pp8ih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fklqprqpi3je75l6pp8ih.png" alt="RDS instance details" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under 'Inbound rules' tab, select 'Edit inbound rules'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe1g4ri27giszbc7zzxxv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe1g4ri27giszbc7zzxxv.png" alt="Select Edit inbound rules" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Modify the only inbound rule to allow MYSQL/Aurora type connection. In the source, search for the security group of your EC2 instance and select it. This will allow inbound MySQL connection from the WordPress EC2 instance. Save the rules.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b9owabmi0d0yvxqyvyj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b9owabmi0d0yvxqyvyj.png" alt="Modify inbound rule" width="800" height="207"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  EC2 MySQL configuration
&lt;/h2&gt;

&lt;p&gt;To connect the EC2 instance, copy the public ipv4 address of the WordPress server in the EC2 instances page. You will also need a CLI tool and the key you previously created and downloaded. Remember that the server allows SSH connection from only your IP address, so as long as your IP address has not changed you should be fine. If it has, modify your EC2 instance inbound rule &lt;/p&gt;

&lt;p&gt;I will be using Git Bash on Windows. Feel free to use any other command line tool.&lt;/p&gt;

&lt;p&gt;Now connect to the WordPress locally using the following. &lt;br&gt;
&lt;code&gt;$ ssh -i wordpress-key.pem ec2-user@&amp;lt;ipv4 address&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6czc8gfnfhs0iqdbpp4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp6czc8gfnfhs0iqdbpp4.png" alt="Successful SSH connection to EC2 instance." width="683" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, install MySQL on the WordPress server.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo yum install -y mysql&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When the installation is completed, modify the MySQL Host with the endpoint address of your RDS instance. Get the endpoint address from your RDS instance details page. It will look something like this.&lt;br&gt;
&lt;code&gt;$ export MYSQL_HOST=wordpress.cdjuc7xlsvu.us-east-1.rds.amazonaws.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remember the Master user name and password you created earlier, you'll need to use them to establish connect with the RDS wordpress database that was created earlier.&lt;br&gt;
&lt;code&gt;$ mysql --user=admin --password=adminadmin wordpress&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now create a normal database user with credentials that will have access to the wordpress database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE USER 'wordpress' IDENTIFIED BY 'wp12345';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress;
FLUSH PRIVILEGES;
Exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note: Always use better passwords/credentials to secure your systems&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Download and Configure WordPress
&lt;/h2&gt;

&lt;p&gt;Download the latest WordPress package from the official source.&lt;br&gt;
&lt;code&gt;$ wget https://wordpress.org/latest.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Uncompress the downloaded archive.&lt;br&gt;
&lt;code&gt;$ tar -xzf latest.tar.gz&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a wordpress directory, change directory to the wordpress directory and duplicate the config file.&lt;br&gt;
&lt;code&gt;$ cd wordpress&lt;/code&gt;&lt;br&gt;
&lt;code&gt;$ cp wp-config-sample.php wp-config.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, use a text editor to modify the config file.&lt;br&gt;
&lt;code&gt;$ nano wp-config.php&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Edit the default configuration with their respective values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyis11a4o9qpzjiamsxx7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyis11a4o9qpzjiamsxx7.png" alt="Update config file" width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, update the key and salts with unique values found &lt;a href="https://api.wordpress.org/secret-key/1.1/salt/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Then save and exit the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fndwlrjd963rskj8ctu0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fndwlrjd963rskj8ctu0x.png" alt="Key and Salts configuration" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Update Apache Web Server with WordPress files
&lt;/h2&gt;

&lt;p&gt;Install WordPress PHP dependencies.&lt;br&gt;
&lt;code&gt;$ sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy WordPress files to Apache root directory.&lt;br&gt;
&lt;code&gt;$ sudo cp -r /home/ec2-user/wordpress/* /var/www/html/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's it. Restart Apache service to update.&lt;br&gt;
&lt;code&gt;$ sudo service httpd restart&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Reload the WordPress website. Also, do the preliminary setup to get the full experience.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4245pbuikmfi8rvt7zf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4245pbuikmfi8rvt7zf3.png" alt="Initial WordPress Setup page" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7d00iidkv47pio44eu49.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7d00iidkv47pio44eu49.png" alt="WordPress Welcome page" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mission accomplished! What's next? Use this setup to host your website. Or terminate resources to avoid charges. Be aware that RDS snapshots may incur charges to your account. &lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>motivation</category>
      <category>gratitude</category>
    </item>
  </channel>
</rss>
