<?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: Israel .O. Ayanda</title>
    <description>The latest articles on DEV Community by Israel .O. Ayanda (@oayanda).</description>
    <link>https://dev.to/oayanda</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%2F888107%2F69f293ea-47fc-4ec0-97e6-c0e4b629505b.png</url>
      <title>DEV Community: Israel .O. Ayanda</title>
      <link>https://dev.to/oayanda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oayanda"/>
    <language>en</language>
    <item>
      <title>Hands-on: AWS Elastic Load Balancer</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Fri, 07 Jul 2023 17:25:28 +0000</pubDate>
      <link>https://dev.to/oayanda/hands-on-application-load-balancer-2e6f</link>
      <guid>https://dev.to/oayanda/hands-on-application-load-balancer-2e6f</guid>
      <description>&lt;p&gt;Following up from the previous article, let's dive into configuring a Application Load Balancer in AWS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fk9puew6fqdigxthchy1g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fk9puew6fqdigxthchy1g.jpg" alt="diagram" width="621" height="421"&gt;&lt;/a&gt;&lt;br&gt;
For this tutorial, we will use two web servers (using EC2 instances) and we will configure them to use a single endpoint, which is the Application load balancer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pre-requisite&lt;/strong&gt;&lt;br&gt;
AWS account&lt;br&gt;
Some knowledge of EC2 instance.&lt;/p&gt;

&lt;p&gt;Login into your AWS console, navigate to the EC2 dashboard and let's spin up EC2 instance.&lt;br&gt;
Input the following values&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Number of instance = 2&lt;/li&gt;
&lt;li&gt;OS image = ubuntu&lt;/li&gt;
&lt;li&gt;AMI = Ubuntu Server 20.04 LTS&lt;/li&gt;
&lt;li&gt;Instance type = t2.micro&lt;/li&gt;
&lt;li&gt;Key pair = select your key&lt;/li&gt;
&lt;li&gt;Security groups = Allow SSH traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fm2jw821wzwwo7ih999o0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fm2jw821wzwwo7ih999o0.png" alt="instance" width="800" height="350"&gt;&lt;/a&gt;&lt;br&gt;
Select &lt;em&gt;&lt;strong&gt;Advanced details&lt;/strong&gt;&lt;/em&gt; and scroll down to user data and paste the follow script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
sudo apt update
sudo apt install nginx wget unzip -y
wget https://www.tooplate.com/zip-templates/2133_moso_interior.zip
unzip 2133_moso_interior.zip
sudo mv 2133_moso_interior/* /var/www/html
sudo rm -rf 2*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script simply bootstrap the instances at startup. It updates the ubuntu package, installs three dependencies nginx server to server the website, wget to download a simple static website template, unzips the folder, copies the files to the default folder Nginx servers content from and finally deletes the folders and file from the home directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Flei1ihbj7u7d2azctcs0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Flei1ihbj7u7d2azctcs0.png" alt="EC2" width="800" height="346"&gt;&lt;/a&gt;&lt;br&gt;
click on Lunch instance.&lt;/p&gt;

&lt;p&gt;On the EC2 instance page, enter names for the two instance name, Web01 and Web02, or any name of your choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2qp8b0tydj3z4lbsmh1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2qp8b0tydj3z4lbsmh1k.png" alt="tag" width="800" height="214"&gt;&lt;/a&gt;&lt;br&gt;
Next, To access the website, port 80 have to be allowed. Select the Security group in use for the instances and allow port 80 for inbound rules.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F6kufj6448rego63dzqgo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F6kufj6448rego63dzqgo.png" alt="sg" width="800" height="418"&gt;&lt;/a&gt;&lt;br&gt;
The default port for HTTP traffic on Nginx server is port 80 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxf2e9byblwkdymwsfm5u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxf2e9byblwkdymwsfm5u.png" alt="Port 80" width="800" height="346"&gt;&lt;/a&gt;&lt;br&gt;
Enter the port and click on save rules.&lt;/p&gt;

&lt;p&gt;Now, you should be able to view the website in the browser using the public IP address on both instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fs0n797k84025170aagz4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fs0n797k84025170aagz4.png" alt="Website" width="800" height="363"&gt;&lt;/a&gt;&lt;br&gt;
We are not done yet, next, we would configure the target group.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Target Groups&lt;/strong&gt;&lt;br&gt;
Target Groups are group of instances with health checks configured. Health checks, when configured enables the ELB to route traffic to only the healthy instances&lt;/p&gt;

&lt;p&gt;On the EC2 dashboard, scroll down on the left menu and select target groups.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose a target type = instances&lt;/li&gt;
&lt;li&gt;Enter a name&lt;/li&gt;
&lt;li&gt;Protocol = HTTP&lt;/li&gt;
&lt;li&gt;port = 80&lt;/li&gt;
&lt;li&gt;Health Checks &lt;/li&gt;
&lt;li&gt;Health check protocol = HTTP &lt;/li&gt;
&lt;li&gt;Health check path is used to check if the website is healthy ( available) or not. For our application, path it is &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;/&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;leave the default settings and click next.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Registered targets&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Next, We will register the EC2 instances (in the case two, but it can be more ) for this target group. This implies that all healthy instances (or web servers) in this target group would receive equal or close to equal loads/web traffic, ensuring higher availability, scalability, and reliability of your application.&lt;br&gt;
select the two instances and click on &lt;em&gt;Include as pending below&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.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%2Fib7ijvpq3wqzfhvf3she.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fib7ijvpq3wqzfhvf3she.png" alt="target group setup" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
Review and click on &lt;em&gt;Create target group&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media.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%2Fcyz1amxjvzzjcl8woxc2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcyz1amxjvzzjcl8woxc2.png" alt="target groups" width="800" height="298"&gt;&lt;/a&gt;&lt;br&gt;
Finally, we need to associate the target group a Load balancer. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the target group&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;&lt;em&gt;Actions&lt;/em&gt;&lt;/strong&gt; and select &lt;em&gt;&lt;strong&gt;Associate with new load balancer&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdaubcamejq83ktk8qq4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdaubcamejq83ktk8qq4q.png" alt="tg" width="800" height="231"&gt;&lt;/a&gt;&lt;br&gt;
Load balancer name = Enter your desired name&lt;br&gt;
&lt;strong&gt;Scheme&lt;/strong&gt; = Internet-facing&lt;br&gt;
&lt;strong&gt;IP address type&lt;/strong&gt; = IPv4&lt;br&gt;
&lt;strong&gt;VPC&lt;/strong&gt; =  Same VPC used for the EC2 instances&lt;br&gt;
&lt;strong&gt;Mappings&lt;/strong&gt; = Select 2 more Availability Zones for the application&lt;br&gt;
Security groups = Create another one, allow port 80 and add the security group for the ec2 instances and select it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxlhdnmwvnrxc8jo29k4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxlhdnmwvnrxc8jo29k4s.png" alt="sg" width="800" height="337"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Listeners and routing&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Protocol&lt;/strong&gt; = HTTP&lt;br&gt;
&lt;strong&gt;Port&lt;/strong&gt; = 80&lt;br&gt;
&lt;strong&gt;Default action&lt;/strong&gt; = select the target group you created&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fq3vng6i5p37wtbinu8qo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fq3vng6i5p37wtbinu8qo.png" alt="lb" width="800" height="380"&gt;&lt;/a&gt;&lt;br&gt;
Click on create Load balancer.&lt;br&gt;
Wait for some minutes for the Load balancer state to change from &lt;em&gt;provisioning&lt;/em&gt; to &lt;em&gt;Active&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F75awvqsscmt1c1nzxc2p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F75awvqsscmt1c1nzxc2p.png" alt="lb" width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View in Browser&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the load balancer&lt;/li&gt;
&lt;li&gt;Copy the DNS into the browser. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxvp9p2r5e821556p3oaw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxvp9p2r5e821556p3oaw.png" alt="lb" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This serves as the single external endpoint of access for the two web servers. Also ensure that the security group for the EC2 instances only allows port 22 for SSH or AWS session manager for private access to your instances, this ensure that ec2 instances are not accessible to the public directly but only through the Application Load Balancer. This create layers for security for your application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fo634l3x2p6eijhn6ix1s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fo634l3x2p6eijhn6ix1s.png" alt="web" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>application</category>
      <category>loadbalancer</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>AWS Elastic Load Balancer</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Fri, 07 Jul 2023 10:32:10 +0000</pubDate>
      <link>https://dev.to/oayanda/aws-elastic-load-balancer-3992</link>
      <guid>https://dev.to/oayanda/aws-elastic-load-balancer-3992</guid>
      <description>&lt;p&gt;As it name implies, it's a single point of contact for clients that stabilize or equalize user traffic accessing a service. It ensures delivery of traffic to only healthy targets by monitoring target groups, using health checks configuration. It is simple to integrate with other AWS services to increase the security architecture of your Application, for example, by  allowing or blocking requests based on the rules you set in Web ACL using AWS WAF, more on that later.&lt;/p&gt;

&lt;p&gt;Here is how AWS defines ELB&lt;/p&gt;

&lt;p&gt;Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. It monitors the health of its registered targets and routes traffic only to the healthy targets. You can select the type of load balancer that best suits your needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Elastic Load Balancers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application Load Balancer&lt;/li&gt;
&lt;li&gt;Network Load Balancer&lt;/li&gt;
&lt;li&gt;Gateway Load Balancer&lt;/li&gt;
&lt;li&gt;Classic Load Balancer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next, Hands-on using Application Load Balancer&lt;/p&gt;

</description>
      <category>aws</category>
      <category>elb</category>
      <category>loadbalancer</category>
    </item>
    <item>
      <title>Bash Script: SonarQube and Postgres database Setup for Code Analysis.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Fri, 19 May 2023 14:09:55 +0000</pubDate>
      <link>https://dev.to/oayanda/bash-script-sonarqube-and-postgres-database-setup-for-code-analysis-43i0</link>
      <guid>https://dev.to/oayanda/bash-script-sonarqube-and-postgres-database-setup-for-code-analysis-43i0</guid>
      <description>&lt;p&gt;Here is a simple script to provision SonarQube and Postgres database on a ec2 instance for code analysis to streamline a DevOps process.&lt;/p&gt;

&lt;p&gt;Create and open a file -  and paste the code snippet below. Make sure to change the database password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
sudo cp /etc/sysctl.conf /root/sysctl.conf_backup

# Modify Kernel System Limits for Sonarqube
    sudo sh -c 'cat &amp;lt;&amp;lt;EOF&amp;gt; /etc/sysctl.conf
    vm.max_map_count=262144
    fs.file-max=65536
    ulimit -n 65536
    ulimit -u 4096
EOF'
    sudo apt update -y
    sudo apt-get install openjdk-11-jdk -y

# Postgres Database installation and setup
    wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

    sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" &amp;gt;&amp;gt; /etc/apt/sources.list.d/pgdg.list'
    sudo apt install postgresql postgresql-contrib -y

    sudo systemctl enable postgresql.service
    sudo systemctl start  postgresql.service
    sudo echo "postgres:admin123" | sudo chpasswd
    sudo runuser -l postgres -c "createuser sonar"
    sudo -i -u postgres psql -c "ALTER USER sonar WITH ENCRYPTED PASSWORD 'admin123';"
    sudo -i -u postgres psql -c "CREATE DATABASE sonarqube OWNER sonar;"
    sudo -i -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE sonarqube to sonar;"
    sudo systemctl restart  postgresql

# Sonarqube installation and setup
    sudo mkdir /sonarqube/
    cd /sonarqube/
    sudo curl -O https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-8.3.0.34182.zip
    sudo apt-get install zip -y
    sudo unzip -o sonarqube-8.3.0.34182.zip -d /opt/
    sudo mv /opt/sonarqube-8.3.0.34182/ /opt/sonarqube
    sudo groupadd sonar
    sudo useradd -c "SonarQube - User" -d /opt/sonarqube/ -g sonar sonar

    sudo cp /opt/sonarqube/conf/sonar.properties /root/sonar.properties_backup
    sudo chown sonar:sonar /opt/sonarqube/ -R
    sudo sh -c 'cat &amp;lt;&amp;lt;EOF&amp;gt; /opt/sonarqube/conf/sonar.properties
    sonar.jdbc.username=sonar
    sonar.jdbc.password=admin123
    sonar.jdbc.url=jdbc:postgresql://localhost/sonarqube
    sonar.web.host=0.0.0.0
    sonar.web.port=9000
    sonar.web.javaAdditionalOpts=-server
    sonar.search.javaOpts=-Xmx512m -Xms512m -XX:+HeapDumpOnOutOfMemoryError
    sonar.log.level=INFO
    sonar.path.logs=logs
EOF'
# Setup Systemd service for Sonarqube
    sudo sh -c 'cat &amp;lt;&amp;lt;EOF&amp;gt; /etc/systemd/system/sonarqube.service
    [Unit]
    Description=SonarQube service
    After=syslog.target network.target

    [Service]
    Type=forking

    ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
    ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop

    User=sonar
    Group=sonar
    Restart=always

    LimitNOFILE=65536
    LimitNPROC=4096

    [Install]
    WantedBy=multi-user.target
EOF'
# Enable and restart service
    sudo systemctl daemon-reload
    sudo systemctl enable sonarqube.service
    sudo systemctl start sonarqube.service
    sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Frbejthrwzu2u4zdids1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Frbejthrwzu2u4zdids1m.png" alt="script" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give execute permission&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x sonarqube_setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./sonarqube_setup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fj9citbf2qz8iis4q66jw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fj9citbf2qz8iis4q66jw.png" alt="shell" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the script is completed, the instance takes couple of seconds to reboot. Verify the instance is ready by logging into the instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fa93mo88t0v5pupfngaed.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fa93mo88t0v5pupfngaed.png" alt="logging" width="800" height="187"&gt;&lt;/a&gt;&lt;br&gt;
Make sure to open port 9000 to your IP address or Anywhere IP 0.0.0.0/0, depending on your internet setup in your security group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F0tulzw9l59ay6zht4om9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F0tulzw9l59ay6zht4om9.png" alt="IP" width="800" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify in the browser&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fc72voic1s4kicb8jfaxo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fc72voic1s4kicb8jfaxo.png" alt="browswer" width="800" height="304"&gt;&lt;/a&gt;&lt;br&gt;
Login with default credentials &lt;em&gt;&lt;strong&gt;Login:&lt;/strong&gt; admin &lt;strong&gt;Password:&lt;/strong&gt; admin&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>sonarqube</category>
      <category>postgres</category>
      <category>devops</category>
      <category>analysis</category>
    </item>
    <item>
      <title>Hands-on: Deploy Java Web Application on Kubernetes Cluster on AWS.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Wed, 15 Mar 2023 09:14:21 +0000</pubDate>
      <link>https://dev.to/oayanda/deploy-java-web-application-on-kubernetes-cluster-on-aws-1dl4</link>
      <guid>https://dev.to/oayanda/deploy-java-web-application-on-kubernetes-cluster-on-aws-1dl4</guid>
      <description>&lt;p&gt;In this article explains how you can deploy a containerized java web application into a Kubernetes cluster. This is helpful when your system architecture needs to be high-availability, fault tolerance, easily scalable, portable and platform independent.&lt;/p&gt;

&lt;p&gt;In this setup, I have used &lt;a href="https://kubernetes.io/docs/setup/production-environment/tools/kops/" rel="noopener noreferrer"&gt;KOps&lt;/a&gt; to deploy the k8s cluster on AWS. However, other alternatives includes &lt;a href="https://aws.amazon.com/eks/" rel="noopener noreferrer"&gt;AWS EKS&lt;/a&gt; a managed service on AWS. I wrote a simple &lt;a href="https://dev.to/oayanda/bash-script-how-to-create-a-k8s-cluster-on-aws-eks-5cfc"&gt;script&lt;/a&gt; to provision k8s cluster on AWS EkS using the eksctl tool.&lt;/p&gt;

&lt;p&gt;The web application deployed in this tutorial uses docker images. I have containerized the java application as well as the database and are publicly available on my docker registry. I have also used official docker images for RabbitMQ (as the message broker) and Memcached( to speed up the database by reducing the amount of reads on the database.) and finally used AWS route53 as DNS.&lt;/p&gt;

&lt;p&gt;Click below list to view the docker images&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/layers/oayanda/vprofileapp/v1/images/sha256-b82849c5833d7ba61b136e1bf4f5a6e77dc3102e0c0ba8a9a2ed04fac0d75230?context=repo" rel="noopener noreferrer"&gt;Java Application&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/layers/oayanda/vprofiledb/v1/images/sha256-050a9a08a7bc72cb2a026927f4cc9a9fe9077265efbd528a8140c5fff509c5ef?context=repo" rel="noopener noreferrer"&gt;Database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/_/rabbitmq" rel="noopener noreferrer"&gt;RabbitMQ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/_/memcached" rel="noopener noreferrer"&gt;Memcached&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;AWSCLIv2 is installed and configured&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/oayanda/bash-script-how-to-create-a-k8s-cluster-on-aws-eks-5cfc"&gt;Have k8s Cluster Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;AWS account&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/oayanda/getting-started-docker-container-docker-image-dockerfile-2oj9"&gt;Understanding docker or containers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/oayanda/explained-pod-replicaset-and-deployment-in-kubernetes-2kf"&gt;Basic understanding of K8s objects&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's Begin!!!&lt;/p&gt;

&lt;p&gt;You should skip this step if you are using another cluster setup. This step only starts the cluster and not the cluster setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spin up KOps Cluster in the terminal
&lt;/h2&gt;

&lt;p&gt;Create cluster&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kops create cluster &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kube.oayanda.com &lt;span class="nt"&gt;--state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://oayanda-kops-state &lt;span class="nt"&gt;--zones&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1a,us-east-1b &lt;span class="nt"&gt;--node-count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nt"&gt;--node-size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;t3.small &lt;span class="nt"&gt;--master-size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;t3.medium &lt;span class="nt"&gt;--dns-zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kube.oayanda.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2F56e7o59u7tr3e455c2r9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F56e7o59u7tr3e455c2r9.png" alt="create cluster" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update cluster&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; kops update cluster &lt;span class="nt"&gt;--name&lt;/span&gt; kube.oayanda.com &lt;span class="nt"&gt;--state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://oayanda-kops-state &lt;span class="nt"&gt;--yes&lt;/span&gt; &lt;span class="nt"&gt;--admin&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fcrla1zb7dqv5i8lm1mfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcrla1zb7dqv5i8lm1mfy.png" alt="update cluster" width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Validate cluster&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kops validate cluster  &lt;span class="nt"&gt;--state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;s3://oayanda-kops-state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Ftyztdje9gqku0d0fh5hj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftyztdje9gqku0d0fh5hj.png" alt="validate cluster" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create Persistent EBS volume for DB pod. Copy the volume ID for later use. &lt;em&gt;vol-023c6c76a8a8b98ce&lt;/em&gt; and the AZ &lt;em&gt;us-east-1a&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Copy the following code snippet into your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ec2 create-volume &lt;span class="nt"&gt;--availability-zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1a &lt;span class="nt"&gt;--size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;5 &lt;span class="nt"&gt;--volume-type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gp2 &lt;span class="nt"&gt;--tag-specifications&lt;/span&gt; &lt;span class="s1"&gt;'ResourceType=volume,Tags=[{Key=KubernetesCluster,Value=kube.oayanda.com}]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;/strong&gt; For volume mapping, make sure the value of the tag is the same as your kubernetes cluster.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fuj7bf8hpvy28bcf13roq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fuj7bf8hpvy28bcf13roq.png" alt="validate cluster" width="800" height="301"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify from AWS console&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3tbt4larx1shp79hvnkb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3tbt4larx1shp79hvnkb.png" alt="validate cluster" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify which node is located in us-east-1a, which is where the volume was created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;
&lt;span class="c"&gt;# Get available Nodes&lt;/span&gt;
k get nodes

&lt;span class="c"&gt;# Get more details about a node using the name&lt;/span&gt;
k describe node &amp;lt;name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: You can create an alias for kubectl in your terminal. &lt;code&gt;alias k=kubectl&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2F1khkbrpfewgc3ydm77y0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F1khkbrpfewgc3ydm77y0.png" alt="validate cluster" width="800" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create custom labels for nodes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create label for node&lt;/span&gt;
k label nodes i-033bf8399b48c258e &lt;span class="nv"&gt;zone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1a

&lt;span class="c"&gt;# Verify label creation&lt;/span&gt;
k get node i-033bf8399b48c258e &lt;span class="nt"&gt;--show-labels&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fsacuipl49rnv2ay0tl2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fsacuipl49rnv2ay0tl2s.png" alt="validate cluster" width="800" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing definition Files
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Secret definition File&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The secret object help to keep sensitive data like password. However, by default, stored unencrypted in the API server's underlying data store (etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd. &lt;a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="noopener noreferrer"&gt;Read more from official documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Encode for the application and RabbitMQ passwords with base64.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;password&amp;gt;"&lt;/span&gt; | &lt;span class="nb"&gt;base64&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fe4acknfk92zu3j1fqjjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fe4acknfk92zu3j1fqjjn.png" alt="validate cluster" width="800" height="114"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a file app-secret.yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Secret
metadata:
  name: app-secret
&lt;span class="nb"&gt;type&lt;/span&gt;: Opaque
data:
  db-pass: &lt;span class="nv"&gt;cGFzcw&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;
  rmq-pass: &lt;span class="nv"&gt;Z3Vlc3Q&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# create secret object&lt;/span&gt;
k create &lt;span class="nt"&gt;-f&lt;/span&gt; app-secret.yaml

&lt;span class="c"&gt;# Show secret&lt;/span&gt;
k get secret
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: for production, the secret definition file should not be public because it might be decoded.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2F0s8ex1v4eo5wtz4uz1z1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F0s8ex1v4eo5wtz4uz1z1.png" alt="validate cluster" width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Database definition File&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
For this file, you need the volume ID you created earlier and the zone the volume was created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: vprodb
  labels:
    app: vprodb
spec:
  selector:
    matchLabels:
      app: vprodb
  replicas: 1
  template:
    metadata:
      labels:
        app: vprodb
    spec:
      containers:
        - name: vprodb
          image: oayanda/vprofiledb:v1
          args:
            - &lt;span class="s2"&gt;"--ignore-db-dir=lost+found"&lt;/span&gt;
          volumeMounts:
            - mountPath: /var/lib/mysql
              name: vpro-db-data
          ports:
            - name: vprodb-port
              containerPort: 3306
          &lt;span class="nb"&gt;env&lt;/span&gt;:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: app-secret
                  key: db-pass
      nodeSelector:
        zone: us-east-1a
      volumes:
        - name: vpro-db-data
          awsElasticBlockStore:
            volumeID: vol-023c6c76a8a8b98ce
            fsType: ext4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create DB deployment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k create &lt;span class="nt"&gt;-f&lt;/span&gt; vprodbdep.yaml
k get pod 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fvkaoeqtxj60odb587ixa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fvkaoeqtxj60odb587ixa.png" alt="validate cluster" width="800" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify volume is attached to pod&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k describe pod pod vprodb-58b465f7f-zfth7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Ff12qark9kjfhpzkttxpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ff12qark9kjfhpzkttxpy.png" alt="validate cluster" width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;DB Service Definition&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will only be exposed internally to application and not to the public.&lt;/p&gt;

&lt;p&gt;Create definition file &lt;em&gt;db-cip.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: vprodb 
spec:
  ports:
    - port: 3306
      targetPort: vprodb-port
      protocol: TCP
  selector:
    app: vprodb
  &lt;span class="nb"&gt;type&lt;/span&gt;: ClusterI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Memcached deployment Definition&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will use the official docker image from docker hub.&lt;/p&gt;

&lt;p&gt;Create definition file &lt;em&gt;mcdep.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: vpromc
  labels:
    app: vpromc
spec:
  selector:
    matchLabels:
      app: vpromc
  replicas: 1
  template:
    metadata:
      labels:
        app: vpromc
    spec:
      containers:
        - name: vpromc
          image: memcached
          ports:
            - name: vpromc-port
              containerPort: 11211

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Memcached Service Definition&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will only be exposed internally to application and not to the public as well.&lt;/p&gt;

&lt;p&gt;Create definition file &lt;em&gt;mc-cip.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: vprocache01
spec:
  ports:
    - port: 11211
      targetPort: vpromc-port
      protocol: TCP
  selector:
    app: vpromc
  &lt;span class="nb"&gt;type&lt;/span&gt;: ClusterIP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;RabbitMQ Deployment Definition&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will also use the official docker image from docker hub.&lt;/p&gt;

&lt;p&gt;Create definition file &lt;em&gt;mcdep.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: vpromq01
  labels:
    app: vpromq01
spec:
  selector:
    matchLabels:
      app: vpromq01
  replicas: 1
  template:
    metadata:
      labels:
        app: vpromq01
    spec:
      containers:
        - name: vpromq01
          image: rabbitmq
          ports:
            - name: vpromq01-port
              containerPort: 15672
          &lt;span class="nb"&gt;env&lt;/span&gt;:
            - name: RABBIT_DEFAULT_PASS
              valueFrom:
                secretKeyRef:
                  name: app-secret
                  key: rmq-pass
            - name: RABBIT_DEFAULT_USER
              value: &lt;span class="s2"&gt;"guest"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Rabbitmq Service Definition&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will only be exposed internally to application using the Cluster IP type.&lt;/p&gt;

&lt;p&gt;Create definition file &lt;em&gt;mc-cip.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: vprormq01
spec:
  ports:
    - port: 15672
      targetPort: vpromq01-port
      protocol: TCP
  selector:
    app: vpromq01
  &lt;span class="nb"&gt;type&lt;/span&gt;: ClusterIP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Java Application Deployment&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
I have used two inicontainers which are temporary containers which are dependencies for the Java application. Their job is to make sure the database and memcache container service are ready before the Java application container starts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: vproapp
  labels:
    app: vproapp
spec:
  selector:
    matchLabels:
      app: vproapp
  replicas: 1
  template:
    metadata:
      labels:
        app: vproapp
    spec:
      containers:
        - name: vproapp
          image: oayanda/vprofileapp:v1
          ports:
            - name: vproapp-port
              containerPort: 8080
      initContainers:
        - name: init-mydb
          image: busybox:1.28
          &lt;span class="nb"&gt;command&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'sh'&lt;/span&gt;, &lt;span class="s1"&gt;'-c'&lt;/span&gt;,&lt;span class="s1"&gt;'until nslookup vprodb; do echo waiting for mydb; sleep 2; done;'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        - name: init-memcache
          image: busybox:1.28
          &lt;span class="nb"&gt;command&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'sh'&lt;/span&gt;, &lt;span class="s1"&gt;'-c'&lt;/span&gt;,&lt;span class="s1"&gt;'until nslookup vprocache01; do echo waiting for memcache ; sleep 2; done;'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create Service Load balancer for Java application&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: vproapp-service
spec:
  ports:
    - port: 80
      targetPort: vproapp-port
      protocol: TCP
  selector:
    app: vproapp
  &lt;span class="nb"&gt;type&lt;/span&gt;: LoadBalancer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's deploy all the other definition files&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k apply &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2F2ct40t4c1varehhlkqws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2ct40t4c1varehhlkqws.png" alt="validate cluster" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify deployment and service are created and working&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;k get deploy,pod,svc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: It might sometime for all objects to created including the Load balancer.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fno57fas6vko5fl4ba1qo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fno57fas6vko5fl4ba1qo.png" alt="validate cluster" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the Load balancer URL and view in browser&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fk0br99xcjjk8hejkee5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fk0br99xcjjk8hejkee5g.png" alt="load balancer" width="800" height="310"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.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%2Fz3hs0w5tux0rol92a0kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fz3hs0w5tux0rol92a0kd.png" alt="validate cluster" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Login with the default &lt;em&gt;name:&lt;/em&gt; &lt;strong&gt;&lt;em&gt;admin_vp&lt;/em&gt;&lt;/strong&gt; and &lt;em&gt;password:&lt;/em&gt; &lt;strong&gt;&lt;em&gt;admin_vp&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.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%2Fdj3a03nua04777g1p0hc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdj3a03nua04777g1p0hc.png" alt="validate cluster" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Host on Rout53&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Step 1&lt;/em&gt;&lt;br&gt;
If you are using an external registrar (for example, GoDaddy).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Hosted Zone in Route53&lt;/li&gt;
&lt;li&gt;Copy the NS records and update it on your external registrar.
&lt;em&gt;Step 2&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the Hosted zone on Rout53&lt;br&gt;
Click create record&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8kpar4x1437zgj0dug1c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8kpar4x1437zgj0dug1c.png" alt="create record" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter a name for your application&lt;/li&gt;
&lt;li&gt;Click on the &lt;em&gt;Alias&lt;/em&gt; radio button&lt;/li&gt;
&lt;li&gt;Under the &lt;em&gt;Route traffic to&lt;/em&gt;, select Alias to Application and Classic load balancer&lt;/li&gt;
&lt;li&gt;Select the region your application is deployed&lt;/li&gt;
&lt;li&gt;Select the Load balancer&lt;/li&gt;
&lt;li&gt;Click Create records
&amp;gt; This will take some seconds for propagation. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ffaf1xym7h81ilpcy6cqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ffaf1xym7h81ilpcy6cqv.png" alt="route 53" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View in the browser&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ftyi1wj7zhcyjer6do0u9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftyi1wj7zhcyjer6do0u9.png" alt="domain" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clean Up&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Delete all objects&lt;/span&gt;
k delete &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fpa0j50ppmbhybd2hyrc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpa0j50ppmbhybd2hyrc6.png" alt="clean up" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! you have successfully deploy a java web application on Kubernetes Cluster.&lt;/p&gt;

&lt;p&gt;Project &lt;a href="https://github.com/devopshydclub/vprofile-project" rel="noopener noreferrer"&gt;Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can Clone the project files from my &lt;a href="https://github.com/oayanda/Deploy_Java_Web_Application_on_K8s_Cluster_using_KOps_on_AWS" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to: Deploy a Java Web App on AWS Elastic Beanstalk</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Mon, 27 Feb 2023 15:58:02 +0000</pubDate>
      <link>https://dev.to/oayanda/cloud-native-deploy-a-java-web-app-on-aws-cloud-4hj</link>
      <guid>https://dev.to/oayanda/cloud-native-deploy-a-java-web-app-on-aws-cloud-4hj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Prerequisite&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/free" rel="noopener noreferrer"&gt;AWS account&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Have a VPC (or you may also use the default VPC)&lt;/li&gt;
&lt;li&gt;Have &lt;a href="https://maven.apache.org/" rel="noopener noreferrer"&gt;maven&lt;/a&gt; and &lt;a href="https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html" rel="noopener noreferrer"&gt;JDK8&lt;/a&gt; installed&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;AWS account&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Have a signed certificate (SSL from Certificate Manager)&lt;/li&gt;
&lt;li&gt;You have a domain name &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets Begin!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create Key Pairs for Beanstalk instance&lt;/strong&gt;&lt;br&gt;
Incase of troubleshooting, we need provide a secure way of accessing the EC2 instances.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login into your AWS account.&lt;/li&gt;
&lt;li&gt;Type Key pair in the AWS search bar&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;em&gt;create key pair&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enter &lt;em&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/em&gt;, &lt;em&gt;&lt;strong&gt;Type&lt;/strong&gt;&lt;/em&gt; and &lt;strong&gt;&lt;em&gt;Format&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;&lt;strong&gt;create key pair&lt;/strong&gt;&lt;/em&gt;
&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%2F0amvvxkdt15c58i4ya4o.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%2F0amvvxkdt15c58i4ya4o.png" alt="key pair" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create Security group (SG)&lt;/strong&gt;&lt;br&gt;
Next, create security group for the backend services (RDS MySQL, Amazon MQ and ElastiCache/memcahed ). All services need to be able to communicate between each other. This means we All traffic should route to itself. To do this, you need to add dummy inbound rule, save it and then click on edit, delete it, and then add All traffic and destination would be the name of the security group.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type Security groups in the AW search bar&lt;/li&gt;
&lt;li&gt;Click on create security group&lt;/li&gt;
&lt;li&gt;Enter a &lt;strong&gt;&lt;em&gt;Name&lt;/em&gt;&lt;/strong&gt; and add a &lt;em&gt;&lt;strong&gt;inbound rule&lt;/strong&gt;&lt;/em&gt; and click &lt;em&gt;&lt;strong&gt;create security group&lt;/strong&gt;&lt;/em&gt;
&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%2F27uutyjq25tu7fxod0od.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%2F27uutyjq25tu7fxod0od.png" alt="SG" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;em&gt;&lt;strong&gt;edit inbound rules&lt;/strong&gt;&lt;/em&gt; again, this time, delete it and click on &lt;strong&gt;&lt;em&gt;add rule&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;em&gt;&lt;strong&gt;All traffic&lt;/strong&gt;&lt;/em&gt; and select the SG you just created as the destination.&lt;/li&gt;
&lt;li&gt;Click on &lt;em&gt;&lt;strong&gt;save rules&lt;/strong&gt;&lt;/em&gt;
&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%2F68ma88dwscq8p8slwcrd.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%2F68ma88dwscq8p8slwcrd.png" alt="save rules" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Create Backend Services&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;RDS MySQL Database&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As usual, type RDS in the AWS Search bar&lt;/li&gt;
&lt;li&gt;Select subnet groups&lt;/li&gt;
&lt;li&gt;Select &lt;em&gt;&lt;strong&gt;create DB  subnet group&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter &lt;em&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/em&gt;, select the your VPC and select two AZs as shown in the diagram below&lt;/li&gt;
&lt;li&gt;Select subnets and click &lt;strong&gt;&lt;em&gt;create&lt;/em&gt;&lt;/strong&gt;
&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%2Fu7drplagaz0p2z495cvk.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%2Fu7drplagaz0p2z495cvk.png" alt="Subnet group" width="800" height="554"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, still on this same page, click &lt;em&gt;&lt;strong&gt;Parameter groups&lt;/strong&gt;&lt;/em&gt; and click &lt;em&gt;&lt;strong&gt;create parameter group&lt;/strong&gt;&lt;/em&gt;. This is useful, if some parameter for the database needs some level of customization.&lt;/p&gt;

&lt;p&gt;Enter the following values below&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parameter family: &lt;strong&gt;&lt;em&gt;Mysql5.7&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Type: &lt;strong&gt;&lt;em&gt;DB parameter group&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Group name: &lt;strong&gt;&lt;em&gt;rds-parameter-gp&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Description: &lt;strong&gt;&lt;em&gt;rds parameter group&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;&lt;em&gt;create&lt;/em&gt;&lt;/strong&gt;
&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%2F4xv99t88yy7egtgpfcq8.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%2F4xv99t88yy7egtgpfcq8.png" alt="parameter group" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, still on the same page, click &lt;em&gt;&lt;strong&gt;Databases&lt;/strong&gt;&lt;/em&gt; and click &lt;em&gt;&lt;strong&gt;create database&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standard create&lt;/li&gt;
&lt;li&gt;Engine Options: &lt;em&gt;&lt;strong&gt;MySQL&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Engine version: &lt;em&gt;&lt;strong&gt;5.7.&lt;/strong&gt;*&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Template: Dev/Test (or Free tier for low cost)&lt;/li&gt;
&lt;li&gt;DB instance identifier: &lt;em&gt;&lt;strong&gt;rds-mysql-database&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;master username: &lt;em&gt;&lt;strong&gt;admin&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;&lt;em&gt;Auto generate a password&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;DB instance class: &lt;strong&gt;&lt;em&gt;Burstable classes&lt;/em&gt;&lt;/strong&gt;:&lt;strong&gt;&lt;em&gt;db.t3.micro&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Allocated storage: &lt;em&gt;&lt;strong&gt;20GB&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Select VPC&lt;/li&gt;
&lt;li&gt;Select your &lt;strong&gt;DB subnet group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Public access: &lt;strong&gt;&lt;em&gt;NO&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;VPC security group: vprofile_backend_service SG&lt;/li&gt;
&lt;li&gt;Additional configuration - enter database name: &lt;strong&gt;accounts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Click Create Database&lt;/strong&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click on view credentials to copy your password. &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%2F28il8msmjc41soz1nt0e.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%2F28il8msmjc41soz1nt0e.png" alt="credentials" width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Amazon Elastic Cache&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Like RDS, you need to create parameter group and subnet groups.&lt;br&gt;
For parameter group, enter a name and select &lt;strong&gt;&lt;em&gt;1.4&lt;/em&gt;&lt;/strong&gt; for &lt;strong&gt;family_&lt;/strong&gt;, enter a description and click create.&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%2Fj1f3cphbigf1iyw3mzlr.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%2Fj1f3cphbigf1iyw3mzlr.png" alt="memchached family" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Subnet group, enter a &lt;strong&gt;&lt;em&gt;Name&lt;/em&gt;&lt;/strong&gt;, &lt;em&gt;&lt;strong&gt;VPC&lt;/strong&gt;&lt;/em&gt; and leave the default settings and click &lt;strong&gt;&lt;em&gt;create&lt;/em&gt;&lt;/strong&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%2Fr7id6rn3xrdzssm0ok1u.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%2Fr7id6rn3xrdzssm0ok1u.png" alt="security group" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, Click &lt;em&gt;&lt;strong&gt;Memcached clusters&lt;/strong&gt;&lt;/em&gt; and click create &lt;em&gt;&lt;strong&gt;Memcached clusters&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Location: AWS CLoud&lt;/li&gt;
&lt;li&gt;Name: &lt;strong&gt;&lt;em&gt;vprofile-memcached-cluster&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Engine version: &lt;em&gt;&lt;strong&gt;1.4.5&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Parameter groups: vprofile_memcached-pg&lt;/li&gt;
&lt;li&gt;Node type: &lt;em&gt;&lt;strong&gt;cache.2t.micro&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Subnet group:vprofile_memcached-sg **_ and click next&lt;/li&gt;
&lt;li&gt;select manage under &lt;em&gt;&lt;strong&gt;security group&lt;/strong&gt;&lt;/em&gt;, select backend_service sg, click next to review&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;&lt;strong&gt;create&lt;/strong&gt;&lt;/em&gt;
&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%2Fv66v5ysxq377n19f5r10.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%2Fv66v5ysxq377n19f5r10.png" alt="vprofile-memcached-cluster" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Create Amazon MQ&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Broker engine: &lt;em&gt;&lt;strong&gt;RabbitMQ&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Deployment mode: &lt;em&gt;&lt;strong&gt;single-instance&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter Name: &lt;em&gt;&lt;strong&gt;app-rmq&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Broker instance type: &lt;em&gt;&lt;strong&gt;t3 micro&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter &lt;em&gt;&lt;strong&gt;username&lt;/strong&gt;&lt;/em&gt; and &lt;strong&gt;&lt;em&gt;password&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;em&gt;&lt;strong&gt;additional settings&lt;/strong&gt;&lt;/em&gt;, select &lt;em&gt;&lt;strong&gt;private access&lt;/strong&gt;&lt;/em&gt; below network&lt;/li&gt;
&lt;li&gt;Select the default VPC and the security group we created from the dropdown.&lt;/li&gt;
&lt;li&gt;Enter and click next to review settings&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;em&gt;create broker&lt;/em&gt;&lt;/strong&gt;
&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%2Fy9zf0az3hokiac8mpi81.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%2Fy9zf0az3hokiac8mpi81.png" alt="rabbitmq" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;4. Login into the instance and initialize RDS DB&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
At this point, you add the database &lt;em&gt;&lt;strong&gt;accounts&lt;/strong&gt;&lt;/em&gt; schema to RDS MYSQL. To do this lunch a temporary EC2 instance to initialize the database with the database schema.&lt;/p&gt;

&lt;p&gt;Lunch a EC2 instance&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter instance name&lt;/li&gt;
&lt;li&gt;AMI : ubuntu 20 / free tier&lt;/li&gt;
&lt;li&gt;Instance type: &lt;em&gt;&lt;strong&gt;t2.micro&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Select your key pair&lt;/li&gt;
&lt;li&gt;Create Security group: Name: &lt;em&gt;&lt;strong&gt;mysql-client-sg&lt;/strong&gt;&lt;/em&gt;: Allow &lt;strong&gt;&lt;em&gt;SSH&lt;/em&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;em&gt;MyIP&lt;/em&gt;&lt;/strong&gt; ( in some cases you might need to use &lt;em&gt;&lt;strong&gt;0.0.0.0/0&lt;/strong&gt;&lt;/em&gt; instead)&lt;/li&gt;
&lt;li&gt;Add User data
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# update ubuntu OS and install MySQL client at startup&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;mysql-client &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;em&gt;lunch instance&lt;/em&gt;&lt;/strong&gt;
&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%2Foli17p7fxdzwd5xhkkkb.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%2Foli17p7fxdzwd5xhkkkb.png" alt="Instance" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update backend security group (&lt;em&gt;&lt;strong&gt;backend services&lt;/strong&gt;&lt;/em&gt;) to allow MySQL traffic from the security group of the 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%2Fav6ob91vg3kg4tvwglsz.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%2Fav6ob91vg3kg4tvwglsz.png" alt="access" width="800" height="323"&gt;&lt;/a&gt;&lt;br&gt;
Next, copy the Endpoint of RDS MYSQL database for &lt;strong&gt;_accounts _&lt;/strong&gt; which is the hostname, you will need this to connect to RDS MYSQL and also to update the connection to the application.&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%2F24aq8uuk18yyfy871m0i.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%2F24aq8uuk18yyfy871m0i.png" alt="endpoint" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SSH into the instance and Connect to RDS MYSQL&lt;/p&gt;

&lt;p&gt;Clone the application repo &lt;a href="https://github.com/devopshydclub/vprofile-project" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Make sure git is installed and clone repo&lt;/span&gt;
git clone https://github.com/devopshydclub/vprofile-project

&lt;span class="c"&gt;# navigate to **_src/main/resource_**&lt;/span&gt;

mysql &lt;span class="nt"&gt;-h&lt;/span&gt; &amp;lt;Replace RDS Endpoint&amp;gt; &lt;span class="nt"&gt;-u&lt;/span&gt; admin 
&lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;Replace RDS DATABASE PASSWORD&amp;gt; accounts &amp;lt; db_schema.sql

&lt;span class="c"&gt;# Show all database &lt;/span&gt;
show databases&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c"&gt;# Use databases accounts&lt;/span&gt;
use accounts&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c"&gt;# Show the tables in the database accounts&lt;/span&gt;
show tables&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fvghtuzg9bbuj8vhmjcnq.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%2Fvghtuzg9bbuj8vhmjcnq.png" alt="sql" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the endpoint for Amazon MQ&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%2F95bnq7bmmr3vnqg65ckq.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%2F95bnq7bmmr3vnqg65ckq.png" alt="Amazon MQ" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the endpoint for Memcached Cluster&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%2Fstlhat69a84yh5o3fsor.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%2Fstlhat69a84yh5o3fsor.png" alt="elasticache" width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update web application with backend connection credentials. Navigate to &lt;strong&gt;&lt;em&gt;src/main/resource&lt;/em&gt;&lt;/strong&gt; in the repo and open &lt;em&gt;&lt;strong&gt;application.properties&lt;/strong&gt;&lt;/em&gt; with the editor of your choice.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# update the file with the endpoints, username, and password&lt;/span&gt;
vi application.properties
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F2i99bqt9qz34u7lx44qf.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%2F2i99bqt9qz34u7lx44qf.png" alt="update" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build Artifact with Backend information using Maven on your local machine.&lt;br&gt;
Make sure you are in the top level of the folder where the pom.xml is located.&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%2Fd90nljluduxw3k59ymx2.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%2Fd90nljluduxw3k59ymx2.png" alt=" " width="800" height="57"&gt;&lt;/a&gt;&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%2F30mcp2wum3z7x1z7811l.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%2F30mcp2wum3z7x1z7811l.png" alt="maven" width="800" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;5. Configure Beanstalk&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;em&gt;&lt;strong&gt;Configuration&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Edit &lt;em&gt;&lt;strong&gt;Instances&lt;/strong&gt;&lt;/em&gt;, add EC2 Security Group : Backend service SG and continue.&lt;/li&gt;
&lt;li&gt;Edit &lt;em&gt;&lt;strong&gt;Capacity&lt;/strong&gt;&lt;/em&gt;,
Environment type: &lt;strong&gt;&lt;em&gt;Load balancer&lt;/em&gt;&lt;/strong&gt;
Instances: &lt;em&gt;&lt;strong&gt;Min:2&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;Max:4&lt;/strong&gt;&lt;/em&gt;
Placement: &lt;strong&gt;&lt;em&gt;us-east-1a&lt;/em&gt;&lt;/strong&gt; and &lt;em&gt;&lt;strong&gt;us-east-1b&lt;/strong&gt;&lt;/em&gt;
Click on continue.&lt;/li&gt;
&lt;li&gt; Edit &lt;em&gt;&lt;strong&gt;Load Balancer&lt;/strong&gt;&lt;/em&gt; 
Listeners: add lister &lt;em&gt;&lt;strong&gt;443&lt;/strong&gt;&lt;/em&gt; for HTTPS and select &lt;em&gt;&lt;strong&gt;SSL certificate&lt;/strong&gt;&lt;/em&gt; as shown in the diagram below and click 
&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%2Fy4o0nk4cyr0nw5noy9nn.png" alt="https" width="800" height="685"&gt;
&lt;/li&gt;
&lt;li&gt;Processes: click on action to edit the default process
Scroll down to Health check and add &lt;em&gt;&lt;strong&gt;/login&lt;/strong&gt;&lt;/em&gt; as the endpoint and click save.
-Click continue
&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%2F3n2d3t2erf0y0r7fcgox.png" alt="endpoint" width="800" height="676"&gt;
&lt;/li&gt;
&lt;li&gt;Rolling updates and deployments
Deployment policy: &lt;em&gt;&lt;strong&gt;Rolling&lt;/strong&gt;&lt;/em&gt;
Percentage : &lt;em&gt;&lt;strong&gt;50%&lt;/strong&gt;&lt;/em&gt; and click on continue.&lt;/li&gt;
&lt;li&gt;Security: select key pair and Create instance profile and click Continue. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;The simple application created earlier enable beanstalk to create the instance profile for us.&lt;/em&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%2Foe1rqs461q9cl6g11h11.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%2Foe1rqs461q9cl6g11h11.png" alt="role" width="800" height="474"&gt;&lt;/a&gt;&lt;br&gt;
You should also add an email for notification.&lt;br&gt;
Click on &lt;em&gt;&lt;strong&gt;apply all changes&lt;/strong&gt;&lt;/em&gt; and &lt;em&gt;&lt;strong&gt;confirm&lt;/strong&gt;&lt;/em&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%2Fi7cdzndo2x85b1gph8sz.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%2Fi7cdzndo2x85b1gph8sz.png" alt="save" width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the changes are applied the Health would be serve as shown in the diagram below. This is because of the endpoint /login we added, however the current application does not have this endpoint but our application does.&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%2Fsiadosnw6z6u4tpo9l6g.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%2Fsiadosnw6z6u4tpo9l6g.png" alt="serve" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Deploy the Application&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;em&gt;&lt;strong&gt;Upload and deploy&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Click choose file : Select the build &lt;em&gt;&lt;strong&gt;vprofile-v2.war&lt;/strong&gt;&lt;/em&gt; file from your machine. (located in the targets folder)&lt;/li&gt;
&lt;li&gt;Enter Labal version: v2&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%2F3yqkejjqdgykmxyi551o.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%2F3yqkejjqdgykmxyi551o.png" alt="deploy" width="800" height="612"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next, Update backend security group&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add rabbit MQ, elasticache and RDS MYSQL ports - 3306, 11211 and 5671  to Security Group created by beanstalk.&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%2F17vbnld9zzqa1euqt0kk.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%2F17vbnld9zzqa1euqt0kk.png" alt="SG updated" width="800" height="240"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Note, Elastic beanstalk would create two SGs, check the names and make sure you are not pointing to the Load balancer SG&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Update Entry in Route 53 Hosted Zone&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%2Fv3lcpyhsw5020otldyge.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%2Fv3lcpyhsw5020otldyge.png" alt="Route 53" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Test The URL&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%2F35i9magvm6inf47fp58f.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%2F35i9magvm6inf47fp58f.png" alt="Iwebsite" width="800" height="389"&gt;&lt;/a&gt;&lt;br&gt;
Login&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%2Fm8rfi8ahjgbs325gdi8x.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%2Fm8rfi8ahjgbs325gdi8x.png" alt="Login" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Username: Admin_vp&lt;br&gt;
Password: Admin_vp&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: Incase you face any issues while uploading your artifact, disable your anti-virus software and try the upload again.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Source: visualpath&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>mentalhealth</category>
      <category>discuss</category>
      <category>productivity</category>
      <category>inclusion</category>
    </item>
    <item>
      <title>Bash Script : How to Create a k8s Cluster on AWS EKS using eksctl.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Sun, 19 Feb 2023 20:27:25 +0000</pubDate>
      <link>https://dev.to/oayanda/bash-script-how-to-create-a-k8s-cluster-on-aws-eks-5cfc</link>
      <guid>https://dev.to/oayanda/bash-script-how-to-create-a-k8s-cluster-on-aws-eks-5cfc</guid>
      <description>&lt;p&gt;This article is a simple shell script tutorial about automating your kubernetes cluster setup on Amazon Elastic Kubernetes Service (EKS).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS EKS:&lt;/strong&gt; &lt;em&gt;Amazon Elastic Kubernetes Service (EKS) is a managed service and certified Kubernetes conformant to run Kubernetes on AWS and on-premises.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Eksctl:&lt;/strong&gt; &lt;em&gt;is a simple CLI tool for creating and managing clusters on EKS - Amazon's managed Kubernetes service for EC2.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisite&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://kubernetes.io/docs/tasks/tools/" rel="noopener noreferrer"&gt;Kubectl&lt;/a&gt; is installed&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/eksctl.html" rel="noopener noreferrer"&gt;eksctl&lt;/a&gt;  is installed&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;AWS CLI version 2&lt;/a&gt; is installed&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;AWS account&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;IAM role with EKS permission.&lt;/li&gt;
&lt;li&gt;Have a Key Pair on AWS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create an access key for your IAM user&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login into your AWS account&lt;/li&gt;
&lt;li&gt;Go to IAM dashboard&lt;/li&gt;
&lt;li&gt;Select &lt;em&gt;&lt;strong&gt;Users&lt;/strong&gt;&lt;/em&gt; and click on your IAM user name&lt;/li&gt;
&lt;li&gt;Click on &lt;em&gt;&lt;strong&gt;Security Credential Tab&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Scroll down to Access keys and Click on &lt;em&gt;&lt;strong&gt;Create access key&lt;/strong&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;em&gt;&lt;strong&gt;Command Line Interface (CLI)&lt;/strong&gt;&lt;/em&gt;, agree with recommendation click Next and follow the prompts.&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%2F1of7co69ry5fce8hdngl.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%2F1of7co69ry5fce8hdngl.png" alt="access key" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure AWS CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# In your CLI, configure AWS cli with your access keys&lt;/span&gt;
aws configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fo3v00piqxt678nzt4sgs.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%2Fo3v00piqxt678nzt4sgs.png" alt="aws configure" width="800" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a file with permission&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create file&lt;/span&gt;
vi scriptfile.sh

&lt;span class="c"&gt;# Make execute permission&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x scriptfile.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy and paste the code snippet below. Change the variables to your preferred names and values. Also change the values under the &lt;em&gt;&lt;strong&gt;Creation of EKS cluster&lt;/strong&gt;&lt;/em&gt; to preferred cluster requirements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Variables&lt;/span&gt;
&lt;span class="nv"&gt;CLUSTER_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;my-cluster
&lt;span class="nv"&gt;REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-east-1
&lt;span class="nv"&gt;NODE_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Linux-nodes
&lt;span class="nv"&gt;KEY_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;instance

&lt;span class="c"&gt;# Set AWS credentials before script execution&lt;/span&gt;

aws sts get-caller-identity &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 0 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Credentials tested, proceeding with the cluster creation."&lt;/span&gt;

  &lt;span class="c"&gt;# Creation of EKS cluster&lt;/span&gt;
  eksctl create cluster &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; &lt;span class="nv"&gt;$CLUSTER_NAME&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--version&lt;/span&gt; 1.22 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="nv"&gt;$REGION&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodegroup-name&lt;/span&gt; &lt;span class="nv"&gt;$NODE_NAME&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodes&lt;/span&gt; 2 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodes-min&lt;/span&gt; 1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodes-max&lt;/span&gt; 4 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--node-type&lt;/span&gt; t3.micro &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--node-volume-size&lt;/span&gt; 8 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--ssh-access&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--ssh-public-key&lt;/span&gt; &lt;span class="nv"&gt;$KEY_NAME&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--managed&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt; &lt;span class="nt"&gt;-eq&lt;/span&gt; 0 &lt;span class="o"&gt;]&lt;/span&gt;
  &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Cluster Setup Completed with eksctl command."&lt;/span&gt;
  &lt;span class="k"&gt;else
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Cluster Setup Failed while running eksctl command."&lt;/span&gt;
  &lt;span class="k"&gt;fi
else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Please run aws configure &amp;amp; set right credentials."&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Cluster setup failed."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Make sure the key pair is in the same directory with the script or you specify.&lt;/p&gt;
&lt;/blockquote&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%2Fmmuq9z9d6w02f8mzmxwa.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%2Fmmuq9z9d6w02f8mzmxwa.png" alt="script" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;aws sts get-caller-identity&lt;/code&gt; - checks if the AWS identity is created correctly. &lt;code&gt;if [ $? -eq 0 ]&lt;/code&gt; - check if the last command, in this case &lt;code&gt;aws sts get-caller-identity&lt;/code&gt; succeeded without no error. If it equals 0, it should go ahead and create the cluster. After the cluster is created, print a &lt;em&gt;created message&lt;/em&gt; else inform us the AWS credential was not configured correctly.&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%2Fqzw09nbrwe6gnos0rvng.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%2Fqzw09nbrwe6gnos0rvng.png" alt="eks cluster" width="800" height="137"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cluster Nodes on EC2 dashboard&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%2Fsdzso3j9h5na5vktoxzv.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%2Fsdzso3j9h5na5vktoxzv.png" alt="ec2" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clean Up&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  &lt;span class="c"&gt;# Delete EKS Cluster&lt;/span&gt;
  eksctl delete cluster my-cluster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fhrpjxqj6o3k6oxi1o9vn.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%2Fhrpjxqj6o3k6oxi1o9vn.png" alt="delete cluster" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>mentalhealth</category>
      <category>inclusion</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Getting Started: Pod, Replicaset and Deployment in Kubernetes</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Wed, 15 Feb 2023 16:22:45 +0000</pubDate>
      <link>https://dev.to/oayanda/explained-pod-replicaset-and-deployment-in-kubernetes-2kf</link>
      <guid>https://dev.to/oayanda/explained-pod-replicaset-and-deployment-in-kubernetes-2kf</guid>
      <description>&lt;p&gt;This is a quick tutorial is meant to explore some common objects in kubernetes.&lt;/p&gt;

&lt;p&gt;let's begin!&lt;/p&gt;

&lt;h2&gt;
  
  
  Kubernetes
&lt;/h2&gt;

&lt;p&gt;Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic understanding of docker or containers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pods
&lt;/h2&gt;

&lt;p&gt;A pod is the smallest unit of kubernete cluster. It has a one to one relationship with a container. This means a pod should only hold one container. However, in some case, a pod can hold more than one related containers. To deploy an object in k8s, YAML file manifest is required with specific sections.&lt;/p&gt;

&lt;p&gt;Let's explore how to deploy a simple nginx pod.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying a Nginx Pod&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Create pod manifest yaml file - nginx-pod.yaml&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Kubernetes api version&lt;/span&gt;
apiVersion: v1

&lt;span class="c"&gt;# Type of kubernetes object to created&lt;/span&gt;
kind: Pod

&lt;span class="c"&gt;# Provides information about the resource like name, label&lt;/span&gt;
metadata:
 name: nginx-pod
 labels:
  apps: nginx-pod

&lt;span class="c"&gt;# Consists of the core information about Pod&lt;/span&gt;
spec:
 containers:
  - image: nginx:latest
    name: nginx-pod
    ports:
     - containerPort: 80
       protocol: TCP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use this shortcut for typing kubectl all time&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kubectl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a nginx pod&lt;/span&gt;
k create &lt;span class="nt"&gt;-f&lt;/span&gt; nginx-pod.yaml

&lt;span class="c"&gt;# View the created pod&lt;/span&gt;
k get pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F4c7mf9j2sv1bfydguw1m.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%2F4c7mf9j2sv1bfydguw1m.png" alt="pods" width="800" height="115"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get more information about the pod&lt;/span&gt;
k describe pod nginx-pod
or 
k get pod nginx-pod &lt;span class="nt"&gt;-o&lt;/span&gt; yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The nginx image used in the yaml file is was pull from the docker hub, in some cases the intended repo is explicitly stated.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The nginx pod is created, but it can not be viewed in the browser. Another Kubernetes object called &lt;strong&gt;&lt;em&gt;Service&lt;/em&gt;&lt;/strong&gt; is required to expose to the Pod.&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%2Fmzedzo9kv8grq51yc749.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%2Fmzedzo9kv8grq51yc749.png" alt="pods" width="568" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although, not reliable because of the ephemeral nature of pods, but for internal use &lt;strong&gt;&lt;em&gt;only&lt;/em&gt;&lt;/strong&gt; the container can be viewed by using a &lt;em&gt;curl&lt;/em&gt; container &lt;strong&gt;&lt;em&gt;dareyregistry/curl&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run kubectl to connect inside the container&lt;/span&gt;
kubectl run curl &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dareyregistry/curl &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;--tty&lt;/span&gt;

&lt;span class="c"&gt;# Type curl and your container's ip&lt;/span&gt;
 curl &lt;span class="nt"&gt;-v&lt;/span&gt; 10.244.0.40:80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F9ea9n2l6e17da3rgkkau.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%2F9ea9n2l6e17da3rgkkau.png" alt="pods" width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Service
&lt;/h2&gt;

&lt;p&gt;An abstract way to expose an application running on a set of Pods as a network service.&lt;/p&gt;

&lt;p&gt;The Service manifest file fields are similar to that of the Pod. Let's take a look.&lt;/p&gt;

&lt;p&gt;Create a yaml file for Service - &lt;strong&gt;&lt;em&gt;nginx-service.yaml&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    name: nginx-service
    app: server-service
spec:
  selector:
    app: nginx-pod
  ports:
    - port: 80
      protocol: TCP
      targetPort: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note the &lt;strong&gt;&lt;em&gt;selector field&lt;/em&gt;&lt;/strong&gt;, this must be same as the labels (in this case, &lt;strong&gt;&lt;em&gt;app: nginx-pod&lt;/em&gt;&lt;/strong&gt;) in the pod manifest file. This help the service object to map to particular object since they may be many pod running at any particular instance. The &lt;strong&gt;&lt;em&gt;targetPort&lt;/em&gt;&lt;/strong&gt; is set to the same value as the &lt;strong&gt;&lt;em&gt;port&lt;/em&gt;&lt;/strong&gt; field. Additionally, the Service object can also use a &lt;strong&gt;&lt;em&gt;nodePort&lt;/em&gt;&lt;/strong&gt; field to expose the Pod externally, we will see this later.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create service for nginx&lt;/span&gt;
k apply &lt;span class="nt"&gt;-f&lt;/span&gt; nginx-service.yaml

&lt;span class="c"&gt;# forward the port of the service to free port on your machine localhost&lt;/span&gt;
k port-forward svc/nginx-service 8089:80

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fpo4hi288v96ud8akr25s.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%2Fpo4hi288v96ud8akr25s.png" alt="replicaset" width="800" height="158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify in the browser&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%2Fwbz5776ode2yg5d8nnhv.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%2Fwbz5776ode2yg5d8nnhv.png" alt="browser" width="800" height="304"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clean up service&lt;/span&gt;
k delete svc nginx-service

&lt;span class="c"&gt;# clean up pod&lt;/span&gt;
k delete po nginx-pod
&lt;span class="c"&gt;## ReplicaSet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A ReplicaSet's purpose is to maintain a stable set of replica Pods running at any given time. As such, it is often used to guarantee the availability of a specified number of identical Pods.&lt;/p&gt;

&lt;p&gt;The child field &lt;strong&gt;&lt;em&gt;matchLabels&lt;/em&gt;&lt;/strong&gt; of the &lt;strong&gt;&lt;em&gt;selector&lt;/em&gt;&lt;/strong&gt; field is used to identify the pod and a &lt;strong&gt;&lt;em&gt;replica&lt;/em&gt;&lt;/strong&gt; field is used to indicate how many pods should be maintained. It uses the template field to specify the data for the new Pod(s) it should create when scaling up or to meet the number of replicas criteria.&lt;/p&gt;

&lt;p&gt;Let's see this in action&lt;/p&gt;

&lt;p&gt;Create a replicaset manifest yaml file - rs.yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#Part 1&lt;/span&gt;
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx-rs
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx-pod

&lt;span class="c"&gt;#Part 2&lt;/span&gt;
  template:
    metadata:
      name: nginx-pod
      labels:
         app: nginx-pod
    spec:
      containers:
      - image: nginx:latest
        name: nginx-pod
        ports:
        - containerPort: 80
          protocol: TCP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create replicaset for ngix pod. &lt;/span&gt;
k create &lt;span class="nt"&gt;-f&lt;/span&gt; rs.yaml

&lt;span class="c"&gt;# View replicaset&lt;/span&gt;
k get rs

&lt;span class="c"&gt;# View pods created by replicaset&lt;/span&gt;
k get pods

&lt;span class="c"&gt;# Delete one of the pods&lt;/span&gt;
k delete po nginx-rs-2czdx

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fp87igd66g6bnf387r8b8.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%2Fp87igd66g6bnf387r8b8.png" alt="deployments" width="800" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice replica is set to 3, hence the 3 pods. If a pod is terminates, it recreates another pod from the configuration stated in the &lt;strong&gt;&lt;em&gt;template&lt;/em&gt;&lt;/strong&gt; field hence, it will always maintain 3 available pods unless specified otherwise.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clean up&lt;/span&gt;
k delete rs nginx-rs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deployment
&lt;/h2&gt;

&lt;p&gt;A Deployment is another layer above ReplicaSets and Pods, newer and more advanced level concept than ReplicaSets. It manages the deployment of ReplicaSets and allows for easy updating of a ReplicaSet as well as the ability to roll back to a previous version of deployment. It is declarative and can be used for rolling updates of micro-services, ensuring there is no downtime.&lt;/p&gt;

&lt;p&gt;Officially, it is highly recommended to use Deplyments to manage replica sets rather than using replica sets directly.&lt;/p&gt;

&lt;p&gt;The manifest file for a deployment looks similar to a replicaset but the kind is &lt;strong&gt;&lt;em&gt;deployment&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Create a deployment manifest yaml file - deployment.yaml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    tier: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      labels:
        tier: frontend
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create deployment&lt;/span&gt;
k create &lt;span class="nt"&gt;-f&lt;/span&gt; deployment.yaml

&lt;span class="c"&gt;# view deployment, replicaset and pods&lt;/span&gt;
k get deploy,rs,pod

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fh18b45k2auxd39zx2487.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%2Fh18b45k2auxd39zx2487.png" alt="deployments" width="800" height="258"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clean up&lt;/span&gt;
k delete deploy nginx-deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As always, I look forward to getting your thoughts on this tutorial. Please feel free to leave a comment!&lt;/p&gt;

&lt;p&gt;Read here for more additional &lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;resources&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>writing</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Docker Compose: Deploy a Containerized Application</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Thu, 26 Jan 2023 17:52:31 +0000</pubDate>
      <link>https://dev.to/oayanda/docker-compose-deploy-a-containerized-php-application-52ll</link>
      <guid>https://dev.to/oayanda/docker-compose-deploy-a-containerized-php-application-52ll</guid>
      <description>&lt;p&gt;In the &lt;a href="https://dev.to/oayanda/deploy-a-containerized-application-4l55"&gt;previous project&lt;/a&gt;, we deployed a containerized application with docker, which involved some processes like creating containers (MySQL server, application and Apache Server) separately, use of a Docker file, creating a network and running couple of docker commands on the command line interface (CLI). This process might become too tedious.  Today, we will build on the previous project understanding and deploy our application containers in a more reliable, efficient and more simpler way using Docker Compose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker Composer
&lt;/h2&gt;

&lt;p&gt;Compose is a tool from Docker that is used to build applications that consist of more than one Docker container. &lt;br&gt;
Containers in compose are called services. These services is defined with a YAML file which specify the configuration of your applications (For example, docker-compose.yml) and afterwards, create and start your multi-container with one command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisite&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker and compose&lt;/a&gt; is installed on your ubuntu instance or &lt;a href="https://docs.docker.com/desktop/" rel="noopener noreferrer"&gt;docker desktop&lt;/a&gt; for PC.&lt;/li&gt;
&lt;li&gt;Basic understanding of &lt;a href="https://dev.to/oayanda/getting-started-docker-container-docker-image-dockerfile-2oj9"&gt;docker and containers&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Basic Linux understanding will be helpful.&lt;/li&gt;
&lt;li&gt;AWS free tier &lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's Begin!!!&lt;/p&gt;
&lt;h2&gt;
  
  
  Deployment with Docker Compose
&lt;/h2&gt;

&lt;p&gt;To follow along, clone the repo for the application &lt;a href="https://github.com/darey-devops/tooling" rel="noopener noreferrer"&gt;here&lt;/a&gt; and change the directory to Tooling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone repo&lt;/span&gt;
git clone https://github.com/darey-devops/tooling.git

&lt;span class="c"&gt;# change directory&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;tooling/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fic3vl3dsoid7ue6naemd.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%2Fic3vl3dsoid7ue6naemd.png" alt="clone repo" width="800" height="197"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a file, name it &lt;em&gt;&lt;strong&gt;tooling_app.yaml&lt;/strong&gt;&lt;/em&gt; and paste the following code snippet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;version: &lt;span class="s2"&gt;"3.9"&lt;/span&gt;

services:
  tooling_frontend:
    build: &lt;span class="nb"&gt;.&lt;/span&gt;
    ports:
      - &lt;span class="s2"&gt;"5000:80"&lt;/span&gt;
    volumes:
      - tooling_frontend:/var/www/html
    depends_on:
      - db
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: &amp;lt;The database name required by Tooling app &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      MYSQL_USER: &amp;lt;The user required by Tooling app &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      MYSQL_PASSWORD: &amp;lt;The password required by Tooling app &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      MYSQL_RANDOM_ROOT_PASSWORD: &lt;span class="s1"&gt;'1'&lt;/span&gt;
    volumes:
      - db:/var/lib/mysql
      - ./html/tooling_db_schema.sql:/docker-entrypoint-initdb.d/tooling_db_schema.sql
volumes:
  tooling_frontend:
  db:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Update the MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD in the configuration file above.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;version:&lt;/em&gt;&lt;/strong&gt; Specify the version of docker compose to use&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;services:&lt;/em&gt;&lt;/strong&gt; Containers to be create and run&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;build:&lt;/strong&gt;&lt;/em&gt; specifies the build configuration(the Dockerfile we usee in the previous project) for creating container image from source.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;port:&lt;/strong&gt;&lt;/em&gt; specifies the mapping of the host port to the container port&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;volumes:&lt;/strong&gt;&lt;/em&gt; Specify the storage or data&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;depends_on:&lt;/strong&gt;&lt;/em&gt; Express dependency between services&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;image:&lt;/strong&gt;&lt;/em&gt; Specifies the docker image to run from.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;&lt;strong&gt;restart:&lt;/strong&gt;&lt;/em&gt; restart the container&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under services, you have the frontend application and the MySQL database. The YAML file also use the Dockerfile configuration in the directory.The Dockerfile specifies the configuration for the frontend and Apache Server.&lt;/p&gt;

&lt;p&gt;Make sure the your update the &lt;code&gt;html/db_conn.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;MYSQL_IP mysql ip address "db" from the compose file&lt;br&gt;
MYSQL_USER mysql username for user export as environment variable&lt;br&gt;
MYSQL_PASS mysql password for the user exported as environment varaible&lt;br&gt;
MYSQL_DBNAME mysql databse name "toolingdb"&lt;/p&gt;

&lt;p&gt;&lt;code&gt;html/db_conn.php&lt;/code&gt;&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%2F7rh9e0wtj3ez1rc5el48.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%2F7rh9e0wtj3ez1rc5el48.png" alt="db" width="800" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give permission to docker, exit and login again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo usermod -aG docker ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command to start the containers&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# The f flag specifies the Compose configuration files

docker compose -f tooling_app.yaml  up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F6bdc7o7o1trlea4k8v2n.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%2F6bdc7o7o1trlea4k8v2n.png" alt="compose" width="800" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify that the compose is in the running status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker compose ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F9jrlbvtyxa08tj23q265.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%2F9jrlbvtyxa08tj23q265.png" alt="running" width="800" height="89"&gt;&lt;/a&gt;&lt;br&gt;
Ensure port 5000 is opened in your 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%2Fsq4tadgtmkmn6fxzupqk.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%2Fsq4tadgtmkmn6fxzupqk.png" alt="security group" width="800" height="301"&gt;&lt;/a&gt;&lt;br&gt;
Verify from the browser&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%2Fndc5df99967ff1ott9rq.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%2Fndc5df99967ff1ott9rq.png" alt="browser view" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulation!!! You have successfully deployed a containerized web application using &lt;a href="https://docs.docker.com/compose/" rel="noopener noreferrer"&gt;Docker Compose&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Repo: darey.io&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>leadership</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Deploy a Containerized PHP Web Application with Docker</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Thu, 12 Jan 2023 16:54:24 +0000</pubDate>
      <link>https://dev.to/oayanda/deploy-a-containerized-application-4l55</link>
      <guid>https://dev.to/oayanda/deploy-a-containerized-application-4l55</guid>
      <description>&lt;p&gt;In this project, you will be deploying a simple PHP-based containerized solution backed by a MySQL database application using Docker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-started/overview/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; is an open source platform for shipping, developing and running application on any OS running a docker engine. It is fast, takes less space than VMs and can be distributed or shipped as a Docker image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/oayanda/getting-started-docker-container-docker-image-dockerfile-2oj9"&gt;A quick 2 minutes read about Docker Container, Docker Image &amp;amp; Dockerfile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequiste&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.docker.com/engine/install/ubuntu/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; is installed on your ubuntu instance.&lt;/li&gt;
&lt;li&gt;Basic understanding of docker and containers.&lt;/li&gt;
&lt;li&gt;Basic Linux understanding will be helpful.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;AWS free tier here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's Begin.&lt;/p&gt;

&lt;h3&gt;
  
  
  MySQL in Container
&lt;/h3&gt;

&lt;p&gt;Let us start assembling the application from the backend Database layer – you will use a pre-built MySQL database container, configure it, and make sure it is ready to receive requests from the frontend PHP application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Pull MySQL Docker Image from &lt;a href="https://hub.docker.com/" rel="noopener noreferrer"&gt;Docker Hub Registry&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the termainal,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Search available MySQL image in the docker hub registry&lt;/span&gt;

 docker search mysql-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F7zpw3y7r0k8ahqpqa5pu.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%2F7zpw3y7r0k8ahqpqa5pu.png" alt="docker search" width="800" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, you will pull the first on the list, which is the official and latest version and stored in the docker build cache locally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Download docker image locally from docker hub&lt;/span&gt;
docker pull mysql/mysql-server:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fky60zur7w60ot2qwr5fq.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%2Fky60zur7w60ot2qwr5fq.png" alt="docker image pull" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You made this &lt;em&gt;pull&lt;/em&gt; to make the container creation process faster. Otherwise, skip &lt;em&gt;step one&lt;/em&gt; and move to &lt;em&gt;step two&lt;/em&gt;, which does the something.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Deploy the MySQL Container to your Docker Engine&lt;/p&gt;

&lt;p&gt;Once you have the docker image, move on to deploy a new MySQL container&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a MySQL container&lt;/span&gt;
docker run &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysqldb &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dontusethisinprod &lt;span class="nt"&gt;-d&lt;/span&gt; mysql/mysql-server:latest


&lt;span class="c"&gt;# List all running containers&lt;/span&gt;
docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Ftg0r4ezoxv8xb1h3206i.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%2Ftg0r4ezoxv8xb1h3206i.png" alt="Mysql container" width="800" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Connecting to the MySQL Docker Container
&lt;/h3&gt;

&lt;p&gt;Now, let's connect to the MySQL container directly&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;First Method&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Connect to the MySQL database and enter the from the initial step.&lt;/span&gt;

docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; mysqldb mysql &lt;span class="nt"&gt;-uroot&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;

&lt;span class="c"&gt;# Exit the MySQL mode&lt;/span&gt;
&lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Flags&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database name = mysqldb&lt;/li&gt;
&lt;li&gt;Username = -u&lt;/li&gt;
&lt;li&gt;Password = -p&lt;/li&gt;
&lt;li&gt;Interactive mode -it&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%2Fkzjs14rx2p6roy0asq30.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%2Fkzjs14rx2p6roy0asq30.png" alt="mysql" width="800" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are going to use the second method below, so go ahead remove this container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; mysqldb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Second Method&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After connecting to the MySQL container, you could go on can configure the schema and prepare it for the Frontend PHP application but this means you will be using the default bridge network which is the default way for connection for all containers. However, it better to create our own private network which enable us to control the network cidr.&lt;/p&gt;

&lt;p&gt;Let's go ahead and create a network&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create a new bridge network&lt;/span&gt;

docker network create &lt;span class="nt"&gt;--subnet&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;172.18.0.0/24 tooling_app_network
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Flp1tiobnutoyvxueqe7k.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%2Flp1tiobnutoyvxueqe7k.png" alt="private" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This time, let us create an environment variable to store the root password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Save the password using environment variable&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;MYSQL_PW&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;password

&lt;span class="c"&gt;# verify the environment variable is created&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$MYSQL_PW&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you are using Window OS, run above command in your git bash terminal which comes with visual studio code editor.&lt;/p&gt;
&lt;/blockquote&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%2Fax2bfljxbfq72tdjn1mr.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%2Fax2bfljxbfq72tdjn1mr.png" alt="private" width="800" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To avoid name conflict, remember to remove the initial container as stated above. Now, pull the image and run the container, all in one command like this below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--network&lt;/span&gt; tooling_app_network &lt;span class="nt"&gt;-h&lt;/span&gt; mysqlserverhost &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysql-server &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$MYSQL_PW&lt;/span&gt;  &lt;span class="nt"&gt;-d&lt;/span&gt; mysql/mysql-server:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Flags used&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-d runs the container in detached mode&lt;/li&gt;
&lt;li&gt;--network connects a container to a network&lt;/li&gt;
&lt;li&gt;-h specifies a hostname&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%2Flww11ny94hv8arejx329.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%2Flww11ny94hv8arejx329.png" alt="private" width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is best practice not to connect to the MySQL server remotely using the root user. Therefore, you will create a SQL script that will create a user you can use to connect remotely.&lt;/p&gt;

&lt;p&gt;Create a file and name it &lt;strong&gt;&lt;em&gt;create_user.sql&lt;/em&gt;&lt;/strong&gt; and add the below code in the file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; CREATE USER &lt;span class="s1"&gt;'&amp;lt;username&amp;gt;'&lt;/span&gt;@&lt;span class="s1"&gt;'%'&lt;/span&gt; IDENTIFIED BY &lt;span class="s1"&gt;'&amp;lt;password&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
 GRANT ALL PRIVILEGES ON &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; TO &lt;span class="s1"&gt;'&amp;lt;username&amp;gt;'&lt;/span&gt;@&lt;span class="s1"&gt;'%'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace the username and password to your 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%2Fjsadxgpmwfzm1buewq0w.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%2Fjsadxgpmwfzm1buewq0w.png" alt="private" width="800" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, run the script to create the new user. Ensure you are in the directory &lt;strong&gt;&lt;em&gt;create_user.sql&lt;/em&gt;&lt;/strong&gt; file is located.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; mysql-server mysql &lt;span class="nt"&gt;-uroot&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="nv"&gt;$MYSQL_PW&lt;/span&gt; &amp;lt; create_user.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F5l8i6oys30fb7abbnaf2.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%2F5l8i6oys30fb7abbnaf2.png" alt="private" width="800" height="239"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Prepare Database Schema
&lt;/h3&gt;

&lt;p&gt;Now, you need to prepare a database schema so that the Tooling application can connect to it.&lt;/p&gt;

&lt;p&gt;Clone the Tooling-app repository from &lt;a href="https://github.com/oayanda/Tooling" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/oayanda/tooling-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F0jtehzygzm0urtlb7gsw.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%2F0jtehzygzm0urtlb7gsw.png" alt="private" width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the schema in tooling PHP application repo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; ~/tooling-1/html/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Ftt11hmya4apjntn4dmif.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%2Ftt11hmya4apjntn4dmif.png" alt="private" width="800" height="101"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the SQL script to create the database and prepare the schema. With the &lt;code&gt;docker exec&lt;/code&gt; command, you can execute a command in a running container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; mysql-server mysql &lt;span class="nt"&gt;-uroot&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt;&lt;span class="nv"&gt;$MYSQL_PW&lt;/span&gt; &amp;lt; ~/tooling-1/html/tooling_db_schema.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Frovs1uuh913nn6ff8b4r.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%2Frovs1uuh913nn6ff8b4r.png" alt="private" width="800" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, you need to update the &lt;code&gt;.env&lt;/code&gt; file with connection details to the database. The &lt;code&gt;.env&lt;/code&gt; file is located in the html &lt;code&gt;~/tooling/html/&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# View the location of the file&lt;/span&gt;
&lt;span class="nb"&gt;ls &lt;/span&gt;la ~/tooling/html/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fvsb32ef4775vyqs4xi5f.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%2Fvsb32ef4775vyqs4xi5f.png" alt="private" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's update the connection to the database using the &lt;code&gt;vi&lt;/code&gt; editor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vi ~/tooling-1/html/.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Febacwwek5hc3hd26o2f3.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%2Febacwwek5hc3hd26o2f3.png" alt="private" width="800" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Flags used:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;MYSQL_IP&lt;/em&gt; mysql ip address "leave as mysqlserverhost"&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;MYSQL_USER&lt;/em&gt; mysql username for user export as environment variable&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;MYSQL_PASS&lt;/em&gt; mysql password for the user exported as environment varaible&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;MYSQL_DBNAME&lt;/em&gt; mysql databse name "toolingdb"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update the &lt;code&gt;servername&lt;/code&gt;, &lt;code&gt;username&lt;/code&gt;, &lt;code&gt;password&lt;/code&gt;&amp;amp; &lt;code&gt;databasename&lt;/code&gt; in &lt;code&gt;db_conn.php&lt;/code&gt; file in &lt;code&gt;tooling/html&lt;/code&gt; directory&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%2F7i08nkkm90lizneurky3.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%2F7i08nkkm90lizneurky3.png" alt="private" width="800" height="77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the Tooling App&lt;/p&gt;

&lt;p&gt;You are almost there. Now you need to containerized the Frontend Application as well and then connect it to the MySQL database.&lt;/p&gt;

&lt;p&gt;However, as you now know that you need a Dock image to create a &lt;code&gt;Container&lt;/code&gt; but you need a &lt;code&gt;Dockerfile&lt;/code&gt; to create a &lt;code&gt;Docker image&lt;/code&gt;. In the cloned tooling application repo you now have on system is a Dockerfile which you going to used to build the docker image.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ensure you are inside the directory "tooling" that has the file Dockerfile and build your container.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; tooling:0.0.1 &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above command, we specify a parameter &lt;code&gt;-t&lt;/code&gt;, so that the image can be tagged "&lt;code&gt;tooling.0.1&lt;/code&gt;" - Also, you have to notice the &lt;code&gt;.&lt;/code&gt; at the end. This is important as that tells Docker to locate the &lt;code&gt;Dockerfile&lt;/code&gt; in the current directory you are running the command. Otherwise, you would need to specify the absolute path to the &lt;code&gt;Dockerfile&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%2Fd9i320pi0sl12g4r8y2w.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%2Fd9i320pi0sl12g4r8y2w.png" alt="private" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the container&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--network&lt;/span&gt; tooling_app_network &lt;span class="nt"&gt;-p&lt;/span&gt; 8085:80 &lt;span class="nt"&gt;-it&lt;/span&gt; tooling:0.0.1 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fpdkxz9clsbxb4o2p2qzk.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%2Fpdkxz9clsbxb4o2p2qzk.png" alt="private" width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ensure to allow port 8085 for a TCP connection in your 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%2Fnblw7xd06zkvo066f45d.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%2Fnblw7xd06zkvo066f45d.png" alt="private" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View the login page in browser&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%2Fa87uzdunuzn60llipwm9.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%2Fa87uzdunuzn60llipwm9.png" alt="private" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The default email is &lt;a href="mailto:test@gmail.com"&gt;test@gmail.com&lt;/a&gt;, the password is 12345&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Web application Repo from Darey.io&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Congratulation!!! You have successfully deployed a containerized web application with MySQL backend on docker.&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Getting Started: Docker Container, Docker Image &amp; Dockerfile.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Wed, 04 Jan 2023 18:41:09 +0000</pubDate>
      <link>https://dev.to/oayanda/getting-started-docker-container-docker-image-dockerfile-2oj9</link>
      <guid>https://dev.to/oayanda/getting-started-docker-container-docker-image-dockerfile-2oj9</guid>
      <description>&lt;p&gt;This article is meant to give a brief understanding of docker, it's components and use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker&lt;/strong&gt;&lt;br&gt;
Docker is a software platform that simplifies the process of building, running, managing and distributing applications.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;Docker container&lt;/strong&gt; is a loosely isolated environment running within a host machine’s kernel that allows us to run application-specific code along with it's dependencies.&lt;br&gt;
Docker runs on top of the original host machine kernel.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Kernel&lt;/strong&gt; is the key program or software at the core an operating system with complete control of a computer or machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker Engine&lt;/strong&gt; is an open source containerization technology for building and containerizing your applications and it consists of :-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Server or Docker daemon&lt;/li&gt;
&lt;li&gt;Docker Engine Application Program Interface (API)&lt;/li&gt;
&lt;li&gt;Docker Command Line Interface (CLI)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The diagram below explains their relationships.&lt;br&gt;
&lt;a href="https://media.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%2Fh8o8njzc7w2h8ydnndd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fh8o8njzc7w2h8ydnndd2.png" alt="Docker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;How are containers created?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;In programming terms&lt;/em&gt;: Docker containers can be described as objects that are created by a class in docker called &lt;em&gt;Docker images&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;A Docker Image&lt;/em&gt;&lt;/strong&gt; is an executable package that contains a  read-only template with set of instructions used to build a container. When these instructions are executed, it creates a &lt;em&gt;Docker container&lt;/em&gt;. It can be compared to a snapshot used in a Virtual machine (VM) environment.&lt;/p&gt;

&lt;p&gt;These instructions defines all what the container needs, this includes the container code, libraries, environment variables, configuration files, and more. Hence, a &lt;em&gt;&lt;strong&gt;docker container&lt;/strong&gt;&lt;/em&gt; can also be thought of as an instance of the set of instructions defined in a docker image running on a host machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fy2lzkvwbtjpikfiq8yhp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fy2lzkvwbtjpikfiq8yhp.png" alt="instance"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is also important to understand the relationship between a docker image and a docker container. It is not always a &lt;em&gt;one to one&lt;/em&gt; relationship. It can be &lt;em&gt;&lt;strong&gt;one to one&lt;/strong&gt;&lt;/em&gt; or &lt;em&gt;&lt;strong&gt;one to many&lt;/strong&gt;&lt;/em&gt;, that is, many docker containers can be created from one docker image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Faq7fivub21islzgzny5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Faq7fivub21islzgzny5n.png" alt="Relationship"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's create a docker container&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;a href="https://docs.docker.com/desktop/" rel="noopener noreferrer"&gt;Docker desktop here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Choose your OS on the left menu and follow the installation instruction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxc6fzt8voto5ylzyrzqu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxc6fzt8voto5ylzyrzqu.png" alt="install"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Quick getting started docker commands&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Search the docker hub for available ubuntu images&lt;/span&gt;
docker search ubuntu

&lt;span class="c"&gt;# Create a new container base on the ubuntu image&lt;/span&gt;
docker create &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;fooo ubuntu bash

&lt;span class="c"&gt;# List of started containers&lt;/span&gt;
docker container &lt;span class="nb"&gt;ls&lt;/span&gt;

&lt;span class="c"&gt;# List created containers&lt;/span&gt;
docker container &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;

&lt;span class="c"&gt;# Start a created container&lt;/span&gt;
docker start fooo

&lt;span class="c"&gt;# Start a interactive mode (-it) on the container&lt;/span&gt;
docker attach fooo

&lt;span class="c"&gt;# Run a command in a new container&lt;/span&gt;
docker run &lt;span class="nt"&gt;--name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;bar &lt;span class="nt"&gt;-it&lt;/span&gt; ubuntu bash

&lt;span class="c"&gt;# Exit interactive mode&lt;/span&gt;
Ctl q+p

&lt;span class="c"&gt;# Check container history&lt;/span&gt;
docker logs fooo

&lt;span class="c"&gt;# Stop container&lt;/span&gt;
docker stop fooo

&lt;span class="c"&gt;# Remove container&lt;/span&gt;
docker &lt;span class="nb"&gt;rm &lt;/span&gt;fooo

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How to create docker containers fooo &amp;amp; bar from a ubuntu image&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2wo4lfbd64emku2stbbd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2wo4lfbd64emku2stbbd.png" alt="bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Desktop view of docker containers fooo and bar&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fqb4b9nb5ay8405jnbyir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fqb4b9nb5ay8405jnbyir.png" alt="containers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dockerfile&lt;/strong&gt;&lt;br&gt;
A &lt;em&gt;Dockerfile&lt;/em&gt; outlines instructions for how an image will create a container. It is a text document that contains all the commands a user could call on the command line to assemble an image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ftp0v4trzea925923r89t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftp0v4trzea925923r89t.png" alt="dockerfile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this article. Please feel free to leave a comment!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>dockerfile</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Configuring AWS RDS, AWS EFS Storage, KMS and SSL certificate in ACM.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Fri, 30 Dec 2022 06:50:45 +0000</pubDate>
      <link>https://dev.to/oayanda/configuring-aws-rds-aws-efs-storage-kms-and-ssl-certificate-in-acm-5gpl</link>
      <guid>https://dev.to/oayanda/configuring-aws-rds-aws-efs-storage-kms-and-ssl-certificate-in-acm-5gpl</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2F54y5cno52o72y3wufb28.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F54y5cno52o72y3wufb28.png" alt="Infrastructure" width="800" height="797"&gt;&lt;/a&gt;&lt;br&gt;
Now that the major networking services have be configured, next we will configure the data layer and security services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Encryption Key in Amazon KMS&lt;/strong&gt;&lt;br&gt;
AWS Key Management Service (AWS KMS) create and control keys used to encrypt or digitally sign data. We will use the KMS key to encrypt the AWS RDS MYSQL database. This resource is region specific, hence for this project the KMS key will be created in us-east-1 as with other AWS resource.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Key Management Service dashboard, click on &lt;code&gt;create key&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Ensure &lt;code&gt;Symmetric&lt;/code&gt; and &lt;code&gt;Encrypt and decrypt&lt;/code&gt; is check and click  next
-Enter a Name, description and Tag&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fpsbvxhuftd154g96rm6c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fpsbvxhuftd154g96rm6c.png" alt="key" width="800" height="505"&gt;&lt;/a&gt;&lt;br&gt;
Select yourself as administrator&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fr96pahfej2oxlun4ng4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fr96pahfej2oxlun4ng4h.png" alt="permission" width="800" height="201"&gt;&lt;/a&gt;&lt;br&gt;
Give yourself key usage permission&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ftz9w00ja3ljmk8enz3r5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ftz9w00ja3ljmk8enz3r5.png" alt="usage" width="800" height="201"&gt;&lt;/a&gt;&lt;br&gt;
Click Next to review and Finish&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fyhd8qn6frtitz85tkvtc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fyhd8qn6frtitz85tkvtc.png" alt="Key" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon RDS&lt;/strong&gt;&lt;br&gt;
Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the AWS Cloud. &lt;br&gt;
Amazon RDS supports couple of database engines including MYSQL database needed in this project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create Subnet groups&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The DB subnet group defines which subnet(s) of VPC the database instance would deploy to.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Amazon RDS dashboard&lt;/li&gt;
&lt;li&gt;In the left menu, click on subnet groups&lt;/li&gt;
&lt;li&gt;Click on create subnet group&lt;/li&gt;
&lt;li&gt;Enter Name, description and select VPC&lt;/li&gt;
&lt;li&gt;Select availabity zone us-east-1a and us-east-1b&lt;/li&gt;
&lt;li&gt;Select the subnet 10.0.5.0/24 and 10.0.6.0/24 as seen in the diagram.&lt;/li&gt;
&lt;li&gt;Click create 
&lt;img src="https://media.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%2Femnrhl6iu9ect7990a9i.png" alt="subnet group" width="800" height="504"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create RDS MySql database&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Amazon RDS dashboard&lt;/li&gt;
&lt;li&gt;Create database&lt;/li&gt;
&lt;li&gt;Under Engine options - select &lt;code&gt;MySql&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Availability and durability - select Free tier (or Multi-AZ DB Cluster for high availability, data redundancy and increases capacity to serve read workloads)&lt;/li&gt;
&lt;li&gt;Enter a &lt;code&gt;Name&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt; for the database&lt;/li&gt;
&lt;li&gt;Select the right VPC&lt;/li&gt;
&lt;li&gt;Ensure the database subnet group is selected&lt;/li&gt;
&lt;li&gt;Public access: No&lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;data layer security group&lt;/code&gt; we created earlier.&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;us-east-1a&lt;/code&gt; under Availability Zone&lt;/li&gt;
&lt;li&gt;Leave other default options&lt;/li&gt;
&lt;li&gt;Click create database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxu269hsuojapn5jd76bw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxu269hsuojapn5jd76bw.png" alt="rdson" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxdx9gi7zbw354yw49b4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxdx9gi7zbw354yw49b4s.png" alt="db" width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create File Storage with EFS&lt;/strong&gt;&lt;br&gt;
Amazon Elastic File System (Amazon EFS) provides a simple, scalable, elastic file system for general purpose workloads for use with AWS Cloud services and on-premises resources.&lt;br&gt;
It is  serverless, elastic, set-and-forget file system that automatically grows and shrinks as you add and remove files with no need for management or provisioning.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate Amazon EFS dashboard&lt;/li&gt;
&lt;li&gt;Click on create file system&lt;/li&gt;
&lt;li&gt;Enter Name, tag and click next&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4qruxo1f62pwezluw6vq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4qruxo1f62pwezluw6vq.png" alt="efs" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the appropriate VPC&lt;/li&gt;
&lt;li&gt;Select private subnet 1 &amp;amp; 2 (10.0.2.0/24 and 10.0.4.0/24)&lt;/li&gt;
&lt;li&gt;Next, review the setting and click on create&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxpmomxm1o6tntbusxzqm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxpmomxm1o6tntbusxzqm.png" alt="efs" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Access Point&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
One of the advantages of Amazon EFS is that, it is a shared file systems, meaning it can serve as a storage for more than one application. It keeps each application separate with the use of Access points. We will be hosting two applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create Access Point for Two Applications&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the name of the file system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fovic3gi57m583rc76weu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fovic3gi57m583rc76weu.png" alt="fs" width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;strong&gt;&lt;em&gt;Access Points&lt;/em&gt;&lt;/strong&gt; Tab and click create &lt;strong&gt;&lt;em&gt;access point&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ferebt8oote07pxv6zjyh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ferebt8oote07pxv6zjyh.png" alt="access point" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter the following details for WordPress application and create access point
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Name: wordpress
Path: /wordpress
POSIX user ID, Group ID, Owner user ID, group ID: 0
Access point permissions: 0755
Tag - Name: wordpress-ap

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second application is named &lt;strong&gt;&lt;em&gt;Tooling&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter the following details for Tooling application and create access point
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Name: tooling
Path: /tooling
POSIX user ID, Group ID, Owner user ID, group ID: 0
Access point permissions: 0755
Tag: Name: tooling-ap

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2F5n453y5255vygpc6lolh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F5n453y5255vygpc6lolh.png" alt="access point" width="800" height="175"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSL Certificate&lt;/strong&gt;&lt;br&gt;
Amazon Certificate Manager (ACM) handles the complexity of creating, storing, and renewing public and private SSL/TLS X.509 certificates and keys that protect your AWS websites and applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Create certificate&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the ACM dashboard click on &lt;em&gt;Request a certificate&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Ensure &lt;em&gt;Request a public certificate&lt;/em&gt; is selected and click next&lt;/li&gt;
&lt;li&gt;Use a wildcard ("&lt;em&gt;") as the Fully qualified domain name ("&lt;/em&gt;".yourdomain.xx)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fs0vk4fa5ehb31r9rsx0q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fs0vk4fa5ehb31r9rsx0q.png" alt="cert" width="800" height="198"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accept the default values and click &lt;em&gt;Request&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Next Click List Certificate in the left menu&lt;/li&gt;
&lt;li&gt;Click on the certificate you just created&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fugfmpnamhf69w0qf0tld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fugfmpnamhf69w0qf0tld.png" alt="Cert" width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;em&gt;Create records in Route 53&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Click on Create records&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fmtwsrf180ujb4dc535xc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fmtwsrf180ujb4dc535xc.png" alt="records" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you purchased your domain externally, you need to create a hosted zone in Route 53 and updated the DNS records.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After a few minute the certificate would be validated and issued.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8wa5ivcw9h56ndbluflc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8wa5ivcw9h56ndbluflc.png" alt="ssl" width="800" height="187"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, let's create AMI's for the web application. &lt;br&gt;
Watch out for the concluding implementation.&lt;/p&gt;

</description>
      <category>database</category>
      <category>security</category>
      <category>storage</category>
      <category>aws</category>
    </item>
    <item>
      <title>Hands-on: Configuring a 3-tier autoscaling service with NGINX Reverse Proxy AWS.</title>
      <dc:creator>Israel .O. Ayanda</dc:creator>
      <pubDate>Thu, 29 Dec 2022 14:37:14 +0000</pubDate>
      <link>https://dev.to/oayanda/aws-cloud-solution-for-2-company-websites-using-a-reverse-proxy-networking-part-one-2f2m</link>
      <guid>https://dev.to/oayanda/aws-cloud-solution-for-2-company-websites-using-a-reverse-proxy-networking-part-one-2f2m</guid>
      <description>&lt;p&gt;In this article, I have described step by step process(s) by which to configure a AWS cloud solution for a company having 2 websites with a reverse proxy technology.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use case&lt;/strong&gt;: To build a secure infrastructure inside AWS VPC network for a company that uses WordPress CMS for its main business website, and a Tooling Website for their DevOps team. As part of the company’s desire for improved security and performance, a decision has been made to use a reverse proxy technology from NGINX to achieve this. Cost, Security, and Scalability are the major requirements for this project.&lt;/p&gt;

&lt;p&gt;In this project, you will gain understanding and configure some AWS resources like VPC, Security groups, Auto Scaling groups, Target groups, Lunch Templates and much more by implementing the architecture diagram below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fi8a1qhvbkc939y35utnf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fi8a1qhvbkc939y35utnf.png" alt="infrasture" width="800" height="797"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This implementation have been divided into five major categories. As such, this tutorial is divided into five series as well to make it simple and easier to follow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An AWS account &lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;AWS free tier&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Some Knowledge of Linux command&lt;/li&gt;
&lt;li&gt;A Domain name (Your can get a free domain from &lt;a href="https://www.freenom.com/en/index.html?lang=en" rel="noopener noreferrer"&gt;Freenom&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Let's Get Started!!!&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reverse Proxy
&lt;/h2&gt;

&lt;p&gt;A reverse proxy is the application that sits in front of back-end applications/servers and forwards client requests to those applications. Reverse proxies help increase scalability, performance, resilience and security. The resources returned to the client appear as if they originated from the web server itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  NETWORKING
&lt;/h2&gt;

&lt;p&gt;As with constructing a building, the foundation is always very important and that brings us to VPC. From the diagram above, you would see that the VPC is the backbone of the whole infrastructure. By the way, VPC means Virtual Private Cloud.&lt;/p&gt;

&lt;p&gt;Amazon Virtual Private Cloud (Amazon VPC) enables you to provision a logically isolated section of the AWS Cloud where you can launch AWS resources in a virtual network that you've defined. This means most AWS resources would need VPC to communicate between each other except for a &lt;em&gt;severless&lt;/em&gt; architecture &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html" rel="noopener noreferrer"&gt;read more&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a VPC
&lt;/h3&gt;

&lt;p&gt;Login into your AWS account and search for VPC in the search bar&lt;br&gt;
&lt;a href="https://media.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%2Ff8piud2oag5339qivyo9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ff8piud2oag5339qivyo9.png" alt="search vpc" width="800" height="247"&gt;&lt;/a&gt;&lt;br&gt;
Click on Create VPC.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F8q0bheftz9i0qfgi9p62.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F8q0bheftz9i0qfgi9p62.png" alt="Create VPC" width="800" height="234"&gt;&lt;/a&gt; &lt;em&gt;Note: as shown in the above diagram, every account comes with a default VPC&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Let's create our VPC with these information below&lt;/span&gt;
- Set Resources to create to VPC only
- Set Name to any name of your choice
- Set IPv4 CIDR to 10.0.0.0/16

Leave the other options and click on create VPC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fhsuz1s7ln7t13qd24yor.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhsuz1s7ln7t13qd24yor.png" alt="vpc" width="800" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we will configure the following are AWS resources that  the VPC needs to provide the connectivity that our applications requires -  Subnets, Route tables, Internet gateways, Elastic IPs, NAT gateways, Security groups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Subnets
&lt;/h3&gt;

&lt;p&gt;Subnets are simply groupings of IP addresses. A subnet is a range of IP addresses in your VPC. You can launch AWS resources into a specified subnet. Use a public subnet for resources that must be connected to the internet, and a private subnet for resources that won't be connected to the internet directly.&lt;/p&gt;

&lt;p&gt;In the infrastructure diagram above, we need two public subnets (for the nginx reverse proxy and bastion server) and 4 private subnets (for the web servers and database). My region is set to US East (Northern Virginia) Region and I have decided to use two availabity zones(AZs) for this project namely us-east-1a and us-east-1b.&lt;/p&gt;

&lt;p&gt;Still on the VPC dashboard, click on subnets&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3hc4ex1lhbxu6pprr21a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3hc4ex1lhbxu6pprr21a.png" alt="subnet" width="800" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on create subnet&lt;br&gt;
&lt;a href="https://media.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%2Fjwc3pgtoq7jxfkwdkicp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fjwc3pgtoq7jxfkwdkicp.png" alt="subnets" width="800" height="234"&gt;&lt;/a&gt; &lt;em&gt;Note: The default the VPC comes other default features like default subnets, internet gateway, route tables etc.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create two Public Subnets&lt;/span&gt;
Set VPC ID to your newly create VPC
Set Subnet name to your preferred name
Set Availability Zone to us-east-1a
Set IPv4 CIDR block to 10.0.1.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2Fp6hn8a9awgdusoy4auk0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fp6hn8a9awgdusoy4auk0.png" alt="public1" width="800" height="406"&gt;&lt;/a&gt;&lt;br&gt;
Create the second public subnet in Availability Zone us-east-1b and set IPv4 CIDR block to 10.0.3.0/24 as seen the diagram.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F48xxutvtffl5v2e747xl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F48xxutvtffl5v2e747xl.png" alt="Public subnet2" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;You can configure all 6 subnets on the same page by clicking &lt;code&gt;add new subnets&lt;/code&gt; before you finally click on the &lt;code&gt;create subnet button&lt;/code&gt;.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create 4 Private Subnets&lt;/span&gt;
Set Private subnet 1 &lt;span class="k"&gt;in &lt;/span&gt;us-east-1a with IPv4 CIDR block 10.0.2.0/24
Set Private subnet 2 &lt;span class="k"&gt;in &lt;/span&gt;us-east-1b with IPv4 CIDR block 10.0.4.0/24
Set Private subnet 3 &lt;span class="k"&gt;in &lt;/span&gt;us-east-1a with IPv4 CIDR block 10.0.5.0/24
Set Private subnet 4 &lt;span class="k"&gt;in &lt;/span&gt;us-east-1b with IPv4 CIDR block 10.0.6.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.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%2F4nd5unfieuw86lqzh89j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4nd5unfieuw86lqzh89j.png" alt="subnets" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Internet Gateway
&lt;/h3&gt;

&lt;p&gt;The VPC needs a way to communicate with the internet to allow client communication, to do this we need to configure a internet gateway. An internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between a VPC and the internet.&lt;/p&gt;

&lt;p&gt;Still on the VPC dashboard, click on internet gateways in the left menu and Click on Create Internet gateway&lt;br&gt;
&lt;a href="https://media.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%2Fn5zwktd1lrhrfqh8mxk5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fn5zwktd1lrhrfqh8mxk5.png" alt="Igw" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter a name for the internet gateway&lt;/li&gt;
&lt;li&gt;Click on create internet gateway&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F3msm66iqlori4594wps7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F3msm66iqlori4594wps7.png" alt="Internetg" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Next click on &lt;em&gt;Attach to VPC&lt;/em&gt; on the top right of the page or click on &lt;em&gt;Actions&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Select the your VPC and &lt;em&gt;click attach Internet gateway&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Frecy2kwl2wt17gpb85su.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Frecy2kwl2wt17gpb85su.png" alt="attached" width="800" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Elastic IP
&lt;/h3&gt;

&lt;p&gt;We need an Elastic IP address as a requirement to configure the NAT gateway. The need would become clearer soon. An Elastic IP address is a static, public IPv4 address designed for dynamic cloud computing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Elastic Ips in on left menu for the VPC dashboard&lt;/li&gt;
&lt;li&gt;Click on &lt;em&gt;Allocate Elastic IP address&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter a tag Name and click on &lt;em&gt;Allocate&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fcfmi4o0ni6z16efoy4nj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcfmi4o0ni6z16efoy4nj.png" alt="elastic ip" width="800" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Nat Gateway
&lt;/h3&gt;

&lt;p&gt;As seen in the infrastructure diagram above, the web servers and the data layer are placed in the private subnets, meaning that they don't have direct access from or to the internet which ensures security. However, under AWS shared responsibility for IaaS, it is our responsibility to manage patches and updates to the AWS resources we provision (for EC2 instance we used). Hence, we need to way for the EC2 instances to communicate with the internet to download patches. A NAT gateway enable us to do just that.&lt;/p&gt;

&lt;p&gt;A NAT gateway is a Network Address Translation (NAT) service. it does not allow any inbound traffic from the internet but allows outbound traffic from the private subnets associated with it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on &lt;em&gt;Nat gateways&lt;/em&gt; on left menu of the VPC dashboard&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;Create NAT gateway&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter a Name &lt;/li&gt;
&lt;li&gt;Select a Public Subnet under &lt;em&gt;Subnet&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Connectivity type - Public&lt;/li&gt;
&lt;li&gt;Elastic IP allocation ID - click the dropdown arrow to select the Elastic IP we just created&lt;/li&gt;
&lt;li&gt;Create NAT gateway&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhp5yds62iw22hxqt2xu8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhp5yds62iw22hxqt2xu8.png" alt="NAT" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Route table
&lt;/h3&gt;

&lt;p&gt;A route table contains a set of rules, called routes, that determine where network traffic from the subnets or gateway is directed. For the infrastructure diagram above, we need one private route table for the four private subnets and one public route table for the two public subnets.&lt;/p&gt;

&lt;p&gt;Create Private Route Table&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click route tables on the left menu on the VPC dashboard&lt;/li&gt;
&lt;li&gt;Click &lt;em&gt;create route table&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Enter your preferred Name&lt;/li&gt;
&lt;li&gt;Select your VPC from the dropdown&lt;/li&gt;
&lt;li&gt;Click create route table&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fxwd5o3u6p755t3rsljo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fxwd5o3u6p755t3rsljo2.png" alt="private" width="800" height="467"&gt;&lt;/a&gt;&lt;br&gt;
Repeat above steps to create the public route table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fv3bp6pd1xlwfjtvu6xbp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fv3bp6pd1xlwfjtvu6xbp.png" alt="Public" width="800" height="157"&gt;&lt;/a&gt;&lt;br&gt;
Next, we need to associate the public subnet with the public route table and private subnet with the private route table.&lt;/p&gt;

&lt;p&gt;Subnet Association with Route Table&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the the Public route table&lt;/li&gt;
&lt;li&gt;Click Actions on the top right of the route table dashboard&lt;/li&gt;
&lt;li&gt;Click on Edit Subnet associations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fs6q42xmhmxtnk7pa18g8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fs6q42xmhmxtnk7pa18g8.png" alt="rtb" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the two public subnets&lt;/li&gt;
&lt;li&gt;Click save associations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F9qzxnme04k2yjpxe2fa7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F9qzxnme04k2yjpxe2fa7.png" alt="associations" width="800" height="344"&gt;&lt;/a&gt;&lt;br&gt;
Repeat the steps above to associate the private subnets with the private route table. Make sure your select the four private subnets only.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fjusxgv8nbr80egdlpdfx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fjusxgv8nbr80egdlpdfx.png" alt="all" width="800" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Edit Routes for Route Tables&lt;br&gt;
Now, we need to add the routes for communication in the route tables. For the Public route table, the internet gateway as the target and anywhere IP CIDR would be the destination. For the private route, the Nat gateway would be the target and anywhere IP.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the the Public route table&lt;/li&gt;
&lt;li&gt;Click in Actions on the top right of the route table dashboard&lt;/li&gt;
&lt;li&gt;Click on Edit routes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F01mqc44krnqoi5fy2zal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F01mqc44krnqoi5fy2zal.png" alt="routes" width="800" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Add route&lt;/li&gt;
&lt;li&gt;Destination - 0.0.0.0/0&lt;/li&gt;
&lt;li&gt;Target - internet gateway&lt;/li&gt;
&lt;li&gt;Click save changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fylt07ltqazhwgxrcumtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fylt07ltqazhwgxrcumtm.png" alt="routes" width="800" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the Private Route&lt;br&gt;
Repeat the steps above but for Target choose the Nat gateway you created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fd7z6dhp99rfq6e71pok4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fd7z6dhp99rfq6e71pok4.png" alt="routes" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create Security Groups
&lt;/h3&gt;

&lt;p&gt;Next, we will create the security groups needed for the AWS resources. A security group controls the inbound and outbound traffic from or to a AWS resource. To ensure the security of your infrastructure, it is important to allow only appropriate traffic from verified origin &lt;a href="https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html" rel="noopener noreferrer"&gt;read more&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As seen in the infrastructure diagram above, we will need six security groups for :- &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;External Load Balancer&lt;/strong&gt;&lt;/em&gt; - &lt;em&gt;should accepts all https(port 443) &amp;amp; https(port 80) inbound request from the browser.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Security Groups on the VPC dashboard&lt;/li&gt;
&lt;li&gt;Click on create security group&lt;/li&gt;
&lt;li&gt;Enter &lt;strong&gt;&lt;code&gt;Name&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;description&lt;/code&gt;&lt;/strong&gt; and select the appropriate &lt;strong&gt;&lt;code&gt;VPC&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;click on &lt;strong&gt;&lt;code&gt;Add rules&lt;/code&gt;&lt;/strong&gt; under &lt;strong&gt;&lt;code&gt;inbound rules&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;HTTP&lt;/code&gt; on port &lt;code&gt;80&lt;/code&gt; and &lt;code&gt;HTTPS&lt;/code&gt; on port &lt;code&gt;443&lt;/code&gt; and &lt;code&gt;IPV4 Anywhere IP (0.0.0.0/0)&lt;/code&gt; a the source&lt;/li&gt;
&lt;li&gt;Enter a Name tag&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;code&gt;create security group&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fy83m3xo9zqhtdkqimtui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fy83m3xo9zqhtdkqimtui.png" alt="external alb" width="800" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Bastion Servers&lt;/strong&gt;&lt;/em&gt; - &lt;em&gt;should allow only SSH. The Bastion server will server as a jump server into any other instance/ server on the infrastructure for maintenance or troubleshooting purpose.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Name, tag and description as above&lt;/li&gt;
&lt;li&gt;Add inbound rule as &lt;code&gt;SSH&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;&lt;code&gt;create security group&lt;/code&gt;&lt;/strong&gt;
&lt;img src="https://media.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%2Ftf3vg0dcgxwqmpl611u2.png" alt="bastion" width="800" height="359"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Nginx Servers&lt;/em&gt;&lt;/strong&gt; - &lt;em&gt;should accepts only inbound traffic from the external load balancer and bastion server.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Name, tag and description as above&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;code&gt;HTTPS&lt;/code&gt;, &lt;code&gt;HTTP&lt;/code&gt; and select &lt;code&gt;external load balancer security group&lt;/code&gt; as the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fosqcr8hwux6fr2xpu7s0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fosqcr8hwux6fr2xpu7s0.png" alt="nginx" width="800" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Internal Load Balancer&lt;/em&gt;&lt;/strong&gt; - &lt;em&gt;should allow only inbound rules from the nginx proxy server.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Name, tag and description as above&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;code&gt;HTTPS&lt;/code&gt;, &lt;code&gt;HTTP&lt;/code&gt; and select &lt;code&gt;Nginx reserve proxy security group&lt;/code&gt; as the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F2g1r4tiyc9bqg4wo8gtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F2g1r4tiyc9bqg4wo8gtx.png" alt="internal ALB" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Webservers&lt;/em&gt;&lt;/strong&gt; - &lt;em&gt;should allow inbound rules from the internal load balancer and bastion server.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Name, tag and description as above&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;code&gt;HTTPS&lt;/code&gt;, &lt;code&gt;HTTP&lt;/code&gt; and select &lt;code&gt;Internal load balancer security group&lt;/code&gt; as the source.&lt;/li&gt;
&lt;li&gt;Add inbound rule &lt;code&gt;SSH&lt;/code&gt; and source as bastion security group&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4c1g0nn8l2iqy15265vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4c1g0nn8l2iqy15265vk.png" alt="webserver sg" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data Layer&lt;/em&gt;&lt;/strong&gt; - &lt;em&gt;should allow inbound rules from the webserver and administrative access for the bastion server.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Name, tag and description as above&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;strong&gt;&lt;code&gt;MySQL/Aurora&lt;/code&gt;&lt;/strong&gt; and select &lt;strong&gt;&lt;code&gt;bastion security group&lt;/code&gt;&lt;/strong&gt; as the source.&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;strong&gt;&lt;code&gt;MySQL/Aurora&lt;/code&gt;&lt;/strong&gt; and select &lt;strong&gt;&lt;code&gt;webserver security group&lt;/code&gt;&lt;/strong&gt; as the source.&lt;/li&gt;
&lt;li&gt;Add inbound rules &lt;strong&gt;&lt;code&gt;NFS&lt;/code&gt;&lt;/strong&gt; and select &lt;strong&gt;&lt;code&gt;webserver security group&lt;/code&gt;&lt;/strong&gt; as the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fykvvikpv5j2fml9y09z6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fykvvikpv5j2fml9y09z6.png" alt="Data layer" width="800" height="343"&gt;&lt;/a&gt;&lt;br&gt;
Don't worry everything would become clearer as we move on.&lt;/p&gt;

&lt;p&gt;Next, we will configure and setup Amazon RDS for database, Amazon EFS for file storage, generate our database encryption key in AWS KMS and generate SSL certificate in AWS Certificate Manager.&lt;/p&gt;

&lt;p&gt;As always, I look forward to getting your thoughts on this  feature. Please feel free to leave a comment or click on the  subscribe button for more updates.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>vpc</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
