<?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: Bolaji A. Adetoye</title>
    <description>The latest articles on DEV Community by Bolaji A. Adetoye (@badetoye).</description>
    <link>https://dev.to/badetoye</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%2F169272%2F20572e57-ea76-446a-8be4-4de9e54ab0e0.jpg</url>
      <title>DEV Community: Bolaji A. Adetoye</title>
      <link>https://dev.to/badetoye</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/badetoye"/>
    <language>en</language>
    <item>
      <title>Simple Ubuntu Nginx Web server setup on AWS</title>
      <dc:creator>Bolaji A. Adetoye</dc:creator>
      <pubDate>Sat, 01 Feb 2025 23:34:14 +0000</pubDate>
      <link>https://dev.to/badetoye/simple-ubuntu-nginx-web-server-setup-on-aws-131c</link>
      <guid>https://dev.to/badetoye/simple-ubuntu-nginx-web-server-setup-on-aws-131c</guid>
      <description>&lt;p&gt;My humble beginning to becoming a DevOps Engineer through HNG 12 cohort internship.&lt;br&gt;
The first task fondly called "stage0" came with setting up and configuring NGINX on a fresh Ubuntu server. This task will demonstrate the ability to work with basic web server configurations and deliver a functional web server, in this case, a static webpage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task Requirements:&lt;/strong&gt;&lt;br&gt;
NGINX Installation and Configuration&lt;br&gt;
• Install the NGINX web server and ensure it is running.&lt;br&gt;
• Configure NGINX to serve a custom HTML page as the default page (/var/www/html/index.html) with the message:&lt;br&gt;
“Welcome to DevOps Stage 0 - [Your Name]/[SlackName]”&lt;br&gt;
(Replace [Your Name] with the name and [SlackName] with your Slack Username).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Spin Up an Ubuntu EC2 instance (free tier)&lt;/li&gt;
&lt;li&gt;Create an account on the Amazon Web Services platform (I will assume you have one already as this is beyond the scope of this blog).&lt;/li&gt;
&lt;li&gt;Search for EC2 in the services search box.&lt;/li&gt;
&lt;/ol&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%2Foitsivuy8t2nyo2n445f.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%2Foitsivuy8t2nyo2n445f.png" alt="Image description" width="800" height="174"&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%2Fl5wwevmlktcq6kfw5tg7.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%2Fl5wwevmlktcq6kfw5tg7.png" alt="Image description" width="800" height="125"&gt;&lt;/a&gt;&lt;br&gt;
Click on the launch instance 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%2Fhq3z8slhxddtbz61gk2z.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%2Fhq3z8slhxddtbz61gk2z.png" alt="Image description" width="492" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specify a suitable name for the server and select Ubuntu image icon from the list of the AMIs under Application and OS Images (Amazon Machine Image). Ensure that the AMI is free tier eligible to avoid unnecessary charges.&lt;/li&gt;
&lt;/ul&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%2F0rd48f1f89yw7jueiwty.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%2F0rd48f1f89yw7jueiwty.png" alt="Image description" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keypair is not required as we would be using Amazon EC2 Connect to connect to the server. So select the "Proceed without a keypair" option from the drop-down list.&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%2Fhdfyt93kzfuxc8l36i01.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%2Fhdfyt93kzfuxc8l36i01.png" alt="Image description" width="800" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ensure "Allow HTTP traffic from the internet" is checked as this would allow port 80 to access the static website. Leave other default settings as is and click "launch instance" at the right-hand side of the summary window.&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%2F1oeugbnisuzxdqfztc1t.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%2F1oeugbnisuzxdqfztc1t.png" alt="Image description" width="516" height="661"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the provisioned server and click the connect button at the top of the window to connect to the server. This would take us to the page below.&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%2Ft9s40ghqoxf8x8tq11rz.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%2Ft9s40ghqoxf8x8tq11rz.png" alt="Image description" width="800" height="289"&gt;&lt;/a&gt;&lt;br&gt;
Click on Connect again.&lt;br&gt;
This takes us to the Ubuntu terminal where Nginx server would be installed.&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%2Fzcdrknqpnkoyt8vbfxjo.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%2Fzcdrknqpnkoyt8vbfxjo.png" alt="Image description" width="800" height="681"&gt;&lt;/a&gt;&lt;br&gt;
Run &lt;code&gt;sudo apt-get update&lt;/code&gt; to update the current Ubuntu version packages.&lt;br&gt;
&lt;code&gt;sudo apt install nginx -y&lt;/code&gt; to install the Nginx. After the successful installation of the web server. We would need to configure our web server to serve a custom HTML page as the default page by navigating to the server page directory (/var/www/html).&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%2Fbdapu7v0x61jks5xnvmo.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%2Fbdapu7v0x61jks5xnvmo.png" alt="Image description" width="800" height="182"&gt;&lt;/a&gt;&lt;br&gt;
Note that I encountered a "permission denied" error while trying to write to the directory. Ensure that you are in privileged mode to write to the directory. Start the Nginx server and enable the Nginx service which will persist and start the service automatically at boot times with the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl start nginx
systemctl enable nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the Public IPv4 address of the server and paste it into a browser address bar.&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%2F5qjsiyh2ei017syqkre9.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%2F5qjsiyh2ei017syqkre9.png" alt="Image description" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We finally have our custom static web page as seen below.&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%2Fbdtu25pjw3hp1enifqxp.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%2Fbdtu25pjw3hp1enifqxp.png" alt="Image description" width="519" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;br&gt;
•     DevOps Engineers - &lt;a href="https://hng.tech/hire/devops-engineers" rel="noopener noreferrer"&gt;https://hng.tech/hire/devops-engineers&lt;/a&gt;&lt;br&gt;
•     Cloud Engineers - &lt;a href="https://hng.tech/hire/cloud-engineers" rel="noopener noreferrer"&gt;https://hng.tech/hire/cloud-engineers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you find this informative and I will see you in the next one.&lt;br&gt;
Cheers!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>On-premises workload (application and its database) migration to AWS using Amazon EC2 and RDS services.</title>
      <dc:creator>Bolaji A. Adetoye</dc:creator>
      <pubDate>Sat, 17 Jun 2023 19:57:36 +0000</pubDate>
      <link>https://dev.to/badetoye/on-premises-workload-application-and-its-database-migration-to-aws-using-amazon-ec2-and-rds-services-2ia1</link>
      <guid>https://dev.to/badetoye/on-premises-workload-application-and-its-database-migration-to-aws-using-amazon-ec2-and-rds-services-2ia1</guid>
      <description>&lt;p&gt;Introduction:&lt;br&gt;
In this project, we will go through the process of migrating a python web application and its database data using the Lift &amp;amp; Shift (rehost) model to AWS following these migration steps of Planning, Execution and Go-live as required.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s0_IcTWW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cn64swdzrdypspyjlx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s0_IcTWW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0cn64swdzrdypspyjlx2.png" alt="Image description" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Solution Architecture Diagram.&lt;br&gt;
Before creating our EC2 and RDS instances, we need to create a VPC and its subnets(public and private subnets). Let's follow the steps below.&lt;br&gt;
Creating VPC and the Subnets:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bfWT0Qf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyhr1w8eubyy3y4a4hdj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bfWT0Qf4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eyhr1w8eubyy3y4a4hdj.png" alt="Image description" width="800" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u3QbtLh9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gc2o68010aomv2ox5l5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u3QbtLh9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gc2o68010aomv2ox5l5y.png" alt="Image description" width="800" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Virtual Private Cloud (VPC) createdPublic and Private SubnetsPlease note that AWS RDS Subnet Group is a collection of subnets that you can use to deploy your RDS database in a VPC.&lt;br&gt;
Your VPC must have at least 2 subnets and these subnets must be in different Availability Zones.&lt;br&gt;
Now, we need an internet gateway which will allow the traffic from the internet to reach our Application server (EC2 instance) and vice versa. This means our corporate users (clients) will be able to access the application server over the internet and the server will also be able to download required packages or updates from the internet when initiated. The internet gateway must be attached to the VPC.&lt;br&gt;
Creating an Internet Gateway, attaching it to a VPC and creating a Route&lt;/p&gt;

&lt;p&gt;VPC - Internet Gateway: igw-web-infrastructure01 | Action: Attach to VPC (vpc-web-infrastructure01)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8J4IQ8W8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hw2kfnlmr6gmqth9bzc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8J4IQ8W8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0hw2kfnlmr6gmqth9bzc.png" alt="Image description" width="800" height="94"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GDCWLqT_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njvqm1yknpr92wkbh39h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDCWLqT_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/njvqm1yknpr92wkbh39h.png" alt="Image description" width="800" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Internet Gateway created&lt;/p&gt;

&lt;p&gt;VPC - Route Table | Routes | Edit routes&lt;br&gt;
Add route: 0.0.0.0/0 | Target: Internet Gateway (igw-web-infrastructure01)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cxXGUSgM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mihfs3pd923tlid1w6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cxXGUSgM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mihfs3pd923tlid1w6c.png" alt="Image description" width="800" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Route added&lt;/p&gt;

&lt;p&gt;Any traffic from the internet will now be routed through the internet gateway.&lt;br&gt;
Creating the EC2 Instance:&lt;/p&gt;

&lt;p&gt;Now, we can create our EC2 instance using a free-tier eligible (t2.micro) Ubuntu server, create a key-pair to securely connect to the instance, edit the "Network setting" and select the appropriate VPC and public subnet for the instance. Enable "Auto-assign Public IP". Create a set of firewall rules (security group) that control the traffic for the instance.&lt;br&gt;
Accept the default storage configuration settings as this is sufficient for the application to be deployed. Then launch the instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ClHimns7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0u240yqxlduauxi67t9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ClHimns7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p0u240yqxlduauxi67t9.png" alt="Image description" width="777" height="821"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OqKzPPqL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tofagd8ruoa2nhy8sexu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OqKzPPqL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tofagd8ruoa2nhy8sexu.png" alt="Image description" width="778" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that in this demo project, rules with source of 0.0.0.0/0 allow all IP addresses to access the instance. For best practice, I recommend setting security group rules to allow access from known or trusted IP addresses only. You should not do this in a production environment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vbu5B1ST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/do5ybtmenwj3m41pie3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vbu5B1ST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/do5ybtmenwj3m41pie3p.png" alt="Image description" width="800" height="49"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;EC2 Instance created&lt;/p&gt;

&lt;p&gt;Creating RDS:&lt;/p&gt;

&lt;p&gt;RDS - Choose a database creation method - Standard create&lt;br&gt;
Engine type: MySQL | Engine version: MySQL 5.7.xx | Template: Free tier&lt;br&gt;
Choose a name for the database instance "web-infra-db01". choose a password for the default Master username "admin". For the purpose of this demo project, ensure db.t2.micro is selected for the DB instance class. Accept the default storage and connectivity settings. Ensure the project's VPC is selected. Keep the default security group. Select the Availability zone of the EC2 instance "us-east-1a".Accept all other default settings and click "create database".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--skyLdu8M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7m8lf744ejw2lvssyrg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--skyLdu8M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7m8lf744ejw2lvssyrg.png" alt="Image description" width="800" height="106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RDS MySQL instance created&lt;/p&gt;

&lt;p&gt;Connecting to the EC2 instance:&lt;/p&gt;

&lt;p&gt;Incase you do not have git bash installed already, download it from here &lt;a href="https://git-scm.com/downloads"&gt;https://git-scm.com/downloads&lt;/a&gt;&lt;br&gt;
To securely connect to the EC2 instance, run the comand below from the git bash. Ensure that you are currently in the directory where the private key was saved before running the secure shell command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i "your-pivate-key-name" ubuntu@"EC2-public-IP-address"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this runs successfully, you will be welcomed with a similar window with system information of your EC2 instance as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wcHc-Dol--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msrfschvu3kl9qn0b5yq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wcHc-Dol--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msrfschvu3kl9qn0b5yq.png" alt="Image description" width="704" height="679"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Installing the dependencies for the web application:&lt;/p&gt;

&lt;p&gt;Here, I will create a bash script to automate the installation of the required libraries and dependecies for the application.&lt;br&gt;
At the EC2 instance secure shell home directory, create a file called "app-requirement.sh" and assign execute permission to the script file. Using a preferred shell enviroment text editor, list all the required commands to be executed in the bash script and run the script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch app-requirement.sh &amp;amp;&amp;amp; sudo chmod u+x app-requirement.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LbmvpL22--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2w157orb2t6etfuqhzc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LbmvpL22--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s2w157orb2t6etfuqhzc.png" alt="Image description" width="481" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go Live section:&lt;br&gt;
Creating a Security Group for RDS&lt;/p&gt;

&lt;p&gt;VPC | Security | SG - Create a new security group e.g EC2–RDS-sg01 which will allow access to MySQL by the application running at EC2 instance.&lt;br&gt;
Select the VPC created while setting up the infrastructure i.e "vpc-web-infrastructure01".&lt;br&gt;
Set the Inbound rules - Inbound rules | Add rule | Type: MYSQL/Aurora | Destination: 0.0.0.0/0.&lt;br&gt;
Associating the SG (EC2-RDS-sg01) to the RDS instance (web-infra-db01):&lt;/p&gt;

&lt;p&gt;RDS | DB Instances | web-infra-db01 | Modify - Connectivity | SG: EC2-RDS-sg01 - Continue.&lt;br&gt;
Select "Apply immediately" and click "Modify DB instance" button.&lt;br&gt;
Confirm this was effected.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connecting to the EC2 instance
Ensure that a test SSH connection to the EC2 instance is successful.
Downloading the Aplication and the 'Dump' files from database:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The deployment files from the application and the database dump files were exported from the on-premises application server and database server to Amazon S3. Therefore, we would need to download these files from the S3 bucket to the EC2 instance home directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ABPcjNfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ercvzwgwmgoptpmdgzbk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ABPcjNfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ercvzwgwmgoptpmdgzbk.png" alt="Image description" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is now time to open a remote connection to MySQL RDS instance replacing the placeholder "rds_endpoint" with the endpoint name from RDS instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql -h &amp;lt;rds_endpoint&amp;gt; -P 3306 -u admin -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s4oGUc-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqyml3eojl9vk46xzntl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s4oGUc-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqyml3eojl9vk46xzntl.png" alt="Image description" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating a DB 'wikidb' and importing data to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;show databases;
create database wikidb;
show databases;
use wikidb;
show tables;
source dump.sql;
show tables;
select * from articles;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Creating a user 'wiki' in the "wikidb"
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE USER wiki@'%' IDENTIFIED BY 'admin123456';
GRANT ALL PRIVILEGES ON wikidb.* TO wiki@'%';
FLUSH PRIVILEGES;
EXIT;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unziping the application deployment file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YKPVp-T_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcqg2j49svwgz4fm5kai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YKPVp-T_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qcqg2j49svwgz4fm5kai.png" alt="Image description" width="595" height="62"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;unzip wikiapp.zip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Editing the file 'wiki.py'&lt;/p&gt;

&lt;p&gt;Change the directory to the app folder and edit the connection strings for the database in the MySQL configuration section of the file. Ensure that the host detail is replaced with the RDS MySQL database endpoint and save the file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd wikiapp/
vi wiki.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's now test or validate the application - Run python3 wiki.py&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gWwVXF83--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v30dxhl3kplehly2ch4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gWwVXF83--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v30dxhl3kplehly2ch4z.png" alt="Image description" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
Copy the public IP address of the EC2 instance to the address bar with the port number 8080. If this is suucessful, application will be displayed. Therefore our application running on the EC2 instance was able to connect to the database. And we are able to login and create content in the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
In this demo project, we created a VPC, private subnet for the RDS and public subnet for EC2 instance. We also created an Internet gateway to allow traffic from the internet to reach the instance. I created an EC2 instance and RDS instance. I connected through secure shell (ssh) to the EC2 instance and installed all the dependencies for the web application using a script file.I downloaded the application deployment files and database dump files from S3 bucket to the EC2 instance, connected to the RDS MySQL database and created a database, imported the data into the database, created a user to connect to the database,edited the app deployment file to replace the endpoint from the op-premises database to point to the RDS database.I validated the application using the EC2 instance IP address with the required port number.&lt;/p&gt;

&lt;p&gt;Thanks for your time and I hope it is worthwhile.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>appmigration</category>
      <category>rds</category>
    </item>
  </channel>
</rss>
