<?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>Forem: gbamwuandooshima@gmail.com</title>
    <description>The latest articles on Forem by gbamwuandooshima@gmail.com (@shima).</description>
    <link>https://forem.com/shima</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%2F1060401%2F7b4241c0-bd45-431a-800f-ea276d55d8fe.jpg</url>
      <title>Forem: gbamwuandooshima@gmail.com</title>
      <link>https://forem.com/shima</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shima"/>
    <language>en</language>
    <item>
      <title>How to Dockerize a node.js application, use Kubernetes to Orchestrate Containers, setup CI/CD and deploy on Cloud</title>
      <dc:creator>gbamwuandooshima@gmail.com</dc:creator>
      <pubDate>Fri, 16 Jun 2023 21:04:30 +0000</pubDate>
      <link>https://forem.com/shima/how-to-dockerize-a-nodejs-application-use-kubernetes-to-orchestrate-containers-setup-cicd-and-deploy-on-cloud-1hl9</link>
      <guid>https://forem.com/shima/how-to-dockerize-a-nodejs-application-use-kubernetes-to-orchestrate-containers-setup-cicd-and-deploy-on-cloud-1hl9</guid>
      <description>&lt;p&gt;In this article, I will be working you through how to dockerizing a node.js application, using Kubernetes to orchestrate your containers, automating delivery using continuous integration, continuous delivery (CI/CD) using CircleCI and deploy to Google Cloud platform&lt;/p&gt;

&lt;p&gt;This also served as my final project for the just concluded She Code Africa Cloud School Cohort 4.&lt;/p&gt;

&lt;h4&gt;
  
  
  Requirements
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.docker.com/products/docker-desktop/" rel="noopener noreferrer"&gt;Docker Desktop&lt;/a&gt;&lt;br&gt;
Account on &lt;a href="https://circleci.com/signup/" rel="noopener noreferrer"&gt;CircleCI&lt;/a&gt;&lt;br&gt;
&lt;a href="https://kubernetes.io/docs/tasks/tools/" rel="noopener noreferrer"&gt;Kubectl&lt;/a&gt; downloaded on your local machine&lt;br&gt;
Cloud account, for this article I used &lt;a href="https://cloud.google.com/free" rel="noopener noreferrer"&gt;Google cloud&lt;/a&gt;&lt;br&gt;
Google cloud terminal &lt;a href="https://cloud.google.com/sdk/docs/install" rel="noopener noreferrer"&gt;Google SDK&lt;/a&gt;&lt;br&gt;
Account on &lt;a href="https://github.com/signup" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;br&gt;
Text editor, I used &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;VS-code&lt;/a&gt;. You can use any text editor you are comfortable with it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Step 1: Building the Application
&lt;/h3&gt;

&lt;p&gt;The first thing we will do is to build the app. This application will be a simple index file and a node.js file.&lt;br&gt;
Copy and paste these codes and save in an index.html file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
 &amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;My first CICD Project&amp;lt;/title&amp;gt;
&amp;lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css" rel="stylesheet"&amp;gt;
 &amp;lt;/head&amp;gt;
 &amp;lt;body&amp;gt;

  &amp;lt;div class="col-md-10 col-md-offset-1" style="margin-top:20px"&amp;gt;
   &amp;lt;div class="panel panel-primary"&amp;gt;
     &amp;lt;div class="panel-heading"&amp;gt;
       &amp;lt;h3 class="panel-title"&amp;gt;MY first CICD Project&amp;lt;/h3&amp;gt;
     &amp;lt;/div&amp;gt;
      &amp;lt;div class="panel-body"&amp;gt;
       &amp;lt;div class="alert alert-success"&amp;gt;
          &amp;lt;p&amp;gt;This is a basic app used to demonstrate CI/CD on Google Cloud using K8s, CircleCI and Docker &amp;lt;/p&amp;gt;
       &amp;lt;/div&amp;gt;
         &amp;lt;div class="col-md-9"&amp;gt;
           &amp;lt;p&amp;gt;Author:&amp;lt;/p&amp;gt;
           &amp;lt;div class="col-md-3"&amp;gt;
             &amp;lt;a href="https://twitter.com/delan_hype"&amp;gt;Dooshima&amp;lt;/a&amp;gt;
           &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;

&amp;lt;script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The node.js file will contain the following code, copy and paste the code in a server.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const path = require('path');
const morgan = require('morgan');
const bodyParser = require('body-parser');

/* eslint-disable no-console */

const port = process.env.PORT || 3000;
const app = express();

app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: 'true' }));
app.use(bodyParser.json({ type: 'application/vnd.api+json' }));

app.use(express.static(path.join(__dirname, './')));

app.get('*', (req, res) =&amp;gt; {
  res.sendFile(path.join(__dirname, './index.html'));
});

app.listen(port, (err) =&amp;gt; {
  if (err) {
    console.log(err);
  } else {
    console.log(`App at: http://localhost:${port}`);
  }
});
module.exports = app;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next is to do is to create a package.json file, copy an paste this code in the file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "name": "dockerized nodejs application",
    "version": "1.0.0",
    "description": "This is a basic guide on dockerizing a node.js app, deploying to gcloud and setting a CI/CD.",
    "main": "server.js",
    "scripts": {
        "start": "nodemon",
        "test": "mocha"
    },
    "keywords": [
        "gcloud",
        "node"
    ],
    "author": "Dooshima",
    "license": "MIT",
    "dependencies": {
        "body-parser": "^1.17.2",
        "express": "^4.15.3",
        "morgan": "^1.8.2"
    },
    "devDependencies": {
        "chai": "^4.1.2",
        "mocha": "^10.2.0",
        "request": "^2.88.0"
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To keep updating the application when there are changes, we will use nodemon, so we will need to install nodemon&lt;br&gt;
Run the code &lt;code&gt;npm install nodemon&lt;/code&gt;.&lt;br&gt;
There are other dependencies that will be needed to for the application to run, to get them installed, run the code &lt;code&gt;npm install .&lt;/code&gt; and this will get all the dependencies installed.&lt;br&gt;
Well done, we have finished building our application, next is ensure the application is running locally.&lt;br&gt;
Run the code &lt;code&gt;npm start&lt;/code&gt;&lt;br&gt;
If you followed through and didn't miss any step, your terminal &lt;br&gt;
should give you an output similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; dockerized nodejs application@1.0.0 start
&amp;gt; nodemon
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
App at: http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Navigate to the port your application is running on, and you can view your application in your browser.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61h0c9eyyzaw60zgkaq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61h0c9eyyzaw60zgkaq8.png" alt="node.js app" width="800" height="185"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Dockerizing the Application
&lt;/h3&gt;

&lt;p&gt;Now that our application is up and running, the next thing we will do is to dockerize the application&lt;br&gt;
In the Requirements section of this application there is a link to download Docker Desktop if you don't Docker Desktop on your local machine already.&lt;br&gt;
When dockerizing an image, we need a Dockerfile in your root directory; also remember that a Dockerfile starts with &lt;code&gt;From&lt;/code&gt; which indicates where your base image should be gotten from.&lt;br&gt;
For the purpose of this application, our base image is node since our application is a node.js application&lt;br&gt;
Copy the code below and paste in a Dockerfile which will be used to build the image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node
ENV NPM_CONFIG_LOGLEVEL warn
RUN mkdir -p /usr/src/app
EXPOSE 3000
WORKDIR /usr/src/app
ADD package.json /usr/src/app/
RUN npm install --production
ADD . /usr/src/app/
ENTRYPOINT ["npm", "start"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The docker build command will be used to build the docker image.&lt;br&gt;
I am using the Visual Studio code terminal to build my image since I already have Docker installed on VS-code. To do that, you can check out this &lt;a href="https://code.visualstudio.com/docs/containers/overview" rel="noopener noreferrer"&gt;article&lt;/a&gt;. Alternatively you can use PowerShell terminal (ensure you are in the directory where your files are).&lt;br&gt;
Run &lt;code&gt;docker build -t sca-image .&lt;/code&gt; to build your image where 'sca-image' is the name of our image.&lt;br&gt;
Once the build is successful, your will see &lt;em&gt;building finished&lt;/em&gt; alongside with the time taken to build the image in your terminal.&lt;/p&gt;

&lt;p&gt;Check your Docker Desktop and if your build was successful, you will see the image in your image repository as seen below&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv3syi0u062bxkxjtexqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv3syi0u062bxkxjtexqd.png" alt="docker image" width="800" height="419"&gt;&lt;/a&gt;&lt;br&gt;
Well done, we have dockerized our image let's take a look at our dockerized image. &lt;br&gt;
When your image is dockerized and running, it has become a container which you can see in your container section of your Docker Desktop.&lt;br&gt;
To see the running image (container) you will run the command &lt;br&gt;
&lt;code&gt;docker run -d -P --name docker sca-image&lt;/code&gt; to run the image.&lt;br&gt;
In your Docker Desktop the status of your image should change from &lt;strong&gt;unused&lt;/strong&gt; which is what we had in the first image to &lt;strong&gt;in use&lt;/strong&gt; as shown in the picture below:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9q8nh9ygvcqxe03qn8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9q8nh9ygvcqxe03qn8l.png" alt="image in use" width="800" height="423"&gt;&lt;/a&gt; &lt;br&gt;
Click on the image status, &lt;strong&gt;in use&lt;/strong&gt; or go to the container section of your Docker Desktop so you can see your container. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkb9dabehk97rsj8ssk8f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkb9dabehk97rsj8ssk8f.png" alt="container" width="800" height="423"&gt;&lt;/a&gt;&lt;br&gt;
Under the port section of your docker container, click on the port so you can see your dockerized image running in your browser&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72skzdnwpcfi3qxw018q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F72skzdnwpcfi3qxw018q.png" alt="dockerized image" width="800" height="185"&gt;&lt;/a&gt; The port of the dockerized image(32768) is different from the normal port of the node.js application(3000). &lt;/p&gt;

&lt;p&gt;Our dockerized is running on the Docker Desktop, however, we want it deployed to a cloud platform.&lt;br&gt;
I will be using Google cloud platform for the seek of this article. &lt;br&gt;
There is a link to sign up on Google cloud platform under the Requirements section if you don't have an account already.&lt;br&gt;
On the Google platform, the Google container registry is where our image will be hosted.&lt;br&gt;
On your Google cloud platform, create a project or select any project of your choice if you have one already&lt;br&gt;
To create a project check out this &lt;a href="https://cloud.google.com/resource-manager/docs/creating-managing-projects" rel="noopener noreferrer"&gt;article&lt;/a&gt;&lt;br&gt;
To push the image to the Google cloud platform, I will be using the Google cloud SDK.&lt;br&gt;
Run the &lt;code&gt;gcloud init&lt;/code&gt; to initialize gcloud in Google cloud terminal and follow the instructions in the terminal to set your project to correspond with the project ID you are using.&lt;br&gt;
On your Google cloud platform, enable the container registry API so that images can be pushed it as shown in the image below:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64bopaq08lfejm53fihp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64bopaq08lfejm53fihp.png" alt="container API" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next thing is to push the image to the container registry, but before we do that, we will first tag the image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker tag sca-image gcr.io/sca-project-389601/sca-image:0.1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;sca-project-389601 is the project ID which you can get from your project overview&lt;br&gt;
&lt;em&gt;gcr.io&lt;/em&gt; is the hostname&lt;br&gt;
&lt;em&gt;sca-image:0.1.0&lt;/em&gt; is the image name&lt;/p&gt;

&lt;p&gt;Now that the image is tagged, we will push it to Google cloud platform using this line of code &lt;br&gt;
&lt;code&gt;docker -- push gcr.io/sca-project-389601/sca-image:0.1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If your push was successful, your image should appear in the container registry of your repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3zagv9lsmjswdnm4i3h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs3zagv9lsmjswdnm4i3h.png" alt="image-repo" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well done on coming this far. &lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Container Orchestration using Kubernetes
&lt;/h3&gt;

&lt;p&gt;Now that we have succeeded in dockerizing our application and deploying on Google cloud platform, we will need orchestrate our containers using Kubernetes.&lt;br&gt;
To run Kubernetes you need to install Kubectl on your local machine otherwise you will run into errors.&lt;br&gt;
Right click on your Google SDK, run as administrator and install kubectl by running this line of code &lt;code&gt;gcloud components install kubectl&lt;/code&gt;&lt;br&gt;
To check that kubectl is installed check the version by running, &lt;code&gt;kubectl version --client --output=yaml&lt;/code&gt; which should give you an output in yaml&lt;br&gt;
The next thing we are going to do is t create a Kubernetes cluster which this line of code will be used to create &lt;br&gt;
&lt;code&gt;gcloud container clusters create &amp;lt;CLUSTER_NAME&amp;gt; --zone &amp;lt;TIME_ZONE&amp;gt; --project &amp;lt;PROJECT_ID&amp;gt;&lt;/code&gt;&lt;br&gt;
To set or check your Region/Zone, you can check out this &lt;a href="https://stackoverflow.com/questions/45125143/how-to-change-region-zone-in-google-cloud" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
Ensure to set the your cluster zone to be same as your project zone. &lt;br&gt;
Check out this &lt;a href="https://cloud.google.com/compute/docs/regions-zones/changing-default-zone-region" rel="noopener noreferrer"&gt;article&lt;/a&gt; to set your project Region/Zone&lt;br&gt;
If your cluster was created successfully, you will your SDK Shell will return an output that gives you details about the location, master IP, number of nodes, status, etc.&lt;br&gt;
This line of code &lt;code&gt;gcloud container clusters list&lt;/code&gt; can also give you the list of clusters you have and their status.&lt;/p&gt;
&lt;h4&gt;
  
  
  Kubernetes Configuration
&lt;/h4&gt;

&lt;p&gt;Kubernetes configuration refers to resources that Kubernetes provides for configuring Pods. You can check out more details &lt;a href="https://kubernetes.io/docs/concepts/configuration/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
The code below will be used to configure our Kubernetes. Copy and paste in the deployment.yaml file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Service
metadata:
  name: sca-image
  labels:
    app: sca-image
spec:
  ports:
    - port: 3000
  selector:
    app: sca-image
    tier: frontend
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sca-image
  labels:
    app: sca-image
spec:
  selector:
    matchLabels:
      app: sca-image
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: sca-image
        tier: frontend
    spec:
      containers:
      - image: gcr.io/sca-project-389601/sca-image:0.1.0
        name: sca-image
        ports:
        - containerPort: 3000
          name: sca-image
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always remember to check the most recent Kubernetes API when you are declaring your configuration.&lt;br&gt;
Run &lt;code&gt;kubectl create -f deployment.yaml&lt;/code&gt; in your the terminal to create your deployment.&lt;br&gt;
Its important to ensure that your deployment was successful.&lt;/p&gt;

&lt;p&gt;Run &lt;br&gt;
&lt;code&gt;kubectl get po&lt;/code&gt; to get pod&lt;br&gt;
&lt;code&gt;kubectl get svc&lt;/code&gt; to get service and &lt;br&gt;
&lt;code&gt;kubectl get deployment&lt;/code&gt; to get deployment&lt;/p&gt;

&lt;p&gt;Your terminal should give you an output like this&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2ujmzz62mjkkafopixe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy2ujmzz62mjkkafopixe.png" alt="deployment" width="800" height="217"&gt;&lt;/a&gt;&lt;br&gt;
Navigate to the External IP of the image and your should see your image running in your browser&lt;/p&gt;

&lt;p&gt;Here is mine:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff15ry8uia88axgrdvsqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff15ry8uia88axgrdvsqh.png" alt="Kubectl deploy" width="800" height="201"&gt;&lt;/a&gt;&lt;br&gt;
In the search bar of my browser, you will see the External IP which corresponds to the External IP of the image in my terminal.&lt;br&gt;
Our create cluster can also be viewed on the Google cloud platform&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frg060avkdc5xyxf2tkzu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frg060avkdc5xyxf2tkzu.png" alt="cluster-on-cloud" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well done on coming thus far, we are almost done.&lt;br&gt;
Next we set the automation process so that changes to the application can be deployed continuously. To do that, we will be using CircleCI.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 4: Setting up Automation using CircleCI
&lt;/h3&gt;

&lt;p&gt;To set up the automation on CircleCI a scripting file will be used to aid deployment which the CircleCI will run as a build step in deployment.&lt;br&gt;
Copy and paste these codes in a deployment.sh file will be used as the scripting file&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
set -e
echo "Deploying to ${DEPLOYMENT_ENVIRONMENT}"
echo $ACCOUNT_KEY_STAGING &amp;gt; service_key.txt
base64 -i service_key.txt -d &amp;gt; ${HOME}/gcloud-service-key.json
gcloud auth activate-service-account ${ACCOUNT_ID} --key-file ${HOME}/gcloud-service-key.json
gcloud config set project $PROJECT_ID
gcloud --quiet config set container/cluster $CLUSTER_NAME
gcloud config set compute/zone $CLOUDSDK_COMPUTE_ZONE
gcloud --quiet container clusters get-credentials $CLUSTER_NAME
docker build -t gcr.io/${PROJECT_ID}/${REG_ID}:$CIRCLE_SHA1 .
gcloud docker -- push gcr.io/${PROJECT_ID}/${REG_ID}:$CIRCLE_SHA1
kubectl set image deployment/${DEPLOYMENT_NAME} ${CONTAINER_NAME}=gcr.io/${PROJECT_ID}/${REG_ID}:$CIRCLE_SHA1
echo " Successfully deployed to ${DEPLOYMENT_ENVIRONMENT}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Setting the CircleCI Configuration:
&lt;/h4&gt;

&lt;p&gt;The scripting file provided for the deployment build is scripting file and with undefined variables. The variables will be defined and contained in a config.yml file which will also be used in deploying the application.&lt;br&gt;
In your root directory create a .circleci folder and in the folder create a .circleci/config.yml file with the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: 2
jobs:
  build:
    docker:
      - image: wecs/circle-ci-gcloud-node:0.1.0
    working_directory: ~/workspace
    environment:
      DEPLOYMENT_NAME: sca-deploy
      PROJECT_ID: sca-project-389601
      CLUSTER_NAME: sca-cluster
      CLUSTER_NAME_STAG: sca-stag
      CLOUDSDK_COMPUTE_ZONE: us-west4-a 
      CONTAINER_NAME: sca-container
      IMAGE: sca-image
      REG_ID: sca-image
      REG_ID_PROD: sca-prod
      IMG_TAG: 0.1.0
      PROJECT_NAME: sca-project
      DEPLOYMENT_ENVIRONMENT: staging
    steps:
      - checkout
      - setup_remote_docker
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          - v1-dependencies-
      - run:
          name: Install node packages
          command: |
            npm install

      - run:
          name: Start app
          command: |
            npm start &amp;amp;
      - run:
          name: Run tests
          command: |
            npm test
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          - v1-dependencies-
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run:
          name: Build and Deploy
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              ./deployment.sh
            fi  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Push your code to your GitHub repository.&lt;/p&gt;

&lt;p&gt;Now we are set to set up the CI/CD pipeline&lt;br&gt;
In the Requirements section, there is a link to sign up on CircleCI if you don't have account already.&lt;br&gt;
Once you have done that, setup the project with the code you are working on under the projects sections.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2fqmu0p1wykh0irqp6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2fqmu0p1wykh0irqp6e.png" alt="setup project" width="800" height="179"&gt;&lt;/a&gt;&lt;br&gt;
For the build to be successful, CircleCI will need to authenticate itself on  Google cloud.&lt;br&gt;
In your Google cloud console, create a service account &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0hsm3qlmjpqmzj90wfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg0hsm3qlmjpqmzj90wfi.png" alt="service acct" width="800" height="331"&gt;&lt;/a&gt;&lt;br&gt;
A .json key will be needed to authenticate CircleCI under the keys section of the just created Service account, click on Keys and select add key which will allow you to add a new key.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzs2wexsu257cr2fnpkqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzs2wexsu257cr2fnpkqy.png" alt="adding key" width="800" height="337"&gt;&lt;/a&gt;&lt;br&gt;
Once that is done, the json file will be downloaded. Copy the contents of the file and under your project settings, click on environment variables copy and paste the contents of the json key you downloaded earlier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3datftuc9ozvq5e532u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3datftuc9ozvq5e532u.jpg" alt="key upload" width="800" height="364"&gt;&lt;/a&gt;&lt;br&gt;
Once you have done all that, set up project by selecting the repo with the code &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fig2f8880r77l2phd1plr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fig2f8880r77l2phd1plr.png" alt="project setup" width="800" height="189"&gt;&lt;/a&gt;&lt;br&gt;
I will use the config.yml file in my repo&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xxlbzabjsld9eovicl0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1xxlbzabjsld9eovicl0.png" alt="config.yml" width="800" height="314"&gt;&lt;/a&gt;&lt;br&gt;
Click set up project and wait to see the status of your project&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv5qgq8nnznhbrkt21mi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv5qgq8nnznhbrkt21mi.png" alt="status" width="800" height="143"&gt;&lt;/a&gt;&lt;br&gt;
You can edit your index.html file to watch how your pipeline will run&lt;br&gt;
With that, we have finished setting up our CI/CD pipeline&lt;/p&gt;

&lt;p&gt;Well done and thank you for following to the end. &lt;/p&gt;

&lt;p&gt;Keeping checking out this blog as I bring you DevOps content&lt;/p&gt;

</description>
      <category>docker</category>
      <category>cicd</category>
      <category>kubernetes</category>
      <category>node</category>
    </item>
    <item>
      <title>Configuring and Deploying Databases on Microsoft Azure</title>
      <dc:creator>gbamwuandooshima@gmail.com</dc:creator>
      <pubDate>Wed, 03 May 2023 17:59:10 +0000</pubDate>
      <link>https://forem.com/shima/configuring-and-deploying-databases-on-microsoft-azure-1lfj</link>
      <guid>https://forem.com/shima/configuring-and-deploying-databases-on-microsoft-azure-1lfj</guid>
      <description>&lt;p&gt;A database is an organized collection of data, so it can be easily accessed, managed, and updated. You can think of it like a library. It is where data is stored.&lt;br&gt;
Azure SQL Database is a database meant for cloud applications.&lt;br&gt;
Microsoft Azure offers users three (3) namely; &lt;br&gt;
SQL Server on Azure VMs, Azure SQL Database, and Azure SQL Database Managed Instance.&lt;br&gt;
This article will be focused on configuring and deploying a database using the Azure SQL Database which is PaaS option for SQL Server or specifically database as a service (DBaaS).&lt;/p&gt;

&lt;p&gt;The first thing we will do is to create a server for the database.&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating the Server
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Signup/Login into your&lt;a href="https://azure.microsoft.com/en-us/free/" rel="noopener noreferrer"&gt;Azure portal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; In the search bar on your portal, type SQL and select the SQL Server and click create SQL server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Under the Basics tab, configure your server your SQL server as you wish by selecting your preferred location, resource group, in the Authentication Method section, select 'Use SQL authentication', set the admin details, admin name and password.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4pgtrrvd90enal5tfy3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj4pgtrrvd90enal5tfy3.png" alt="configuring servers" width="800" height="339"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Step 4:&lt;/strong&gt; Under the Networking tab, in the Allow Azure resources and services to access this server, select 'Yes' so that other resources can communicate with your server. You can also add tags if you wish to&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9ecdtmq0uy3cef7pt4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9ecdtmq0uy3cef7pt4s.png" alt="Configuring servers" width="800" height="363"&gt;&lt;/a&gt;&lt;br&gt;
Click Review and Create and if your validation is passed, go ahead and click Create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup7j4ch47knxum3btd5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fup7j4ch47knxum3btd5p.png" alt="Review &amp;amp; create" width="800" height="358"&gt;&lt;/a&gt;&lt;br&gt;
Well done your have deployed your server.&lt;br&gt;
Now that we have deployed our server, next up we will create the database.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;  Also in the search bar, type SQL and select SQL database or go to resource and the Overview tab of the Settings section select SQL database.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ffxe2f32vqg0c8k71f4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9ffxe2f32vqg0c8k71f4.png" alt="SQL database" width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Having done that, click on create database, assign your database a name, attach the previously created server, also configure the compute and storage so as to save cost since the database won't be used for any serious task. However, in an event where your database will loads of applications and workload attached to it, select an appropriate database as required by your task.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To configure the Compute and Storage, click on it and select Basic for the Service tier and click apply
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdx8sacw1u4pnjoctudc.png" alt="configure compute &amp;amp; storage" width="800" height="347"&gt;
&lt;/li&gt;
&lt;li&gt;Under the Backup storage redundancy, select Geo-redundant backup storage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Head over to the Networking tab, Add current client IP address and by select 'Yes'. Also select 'Yes' for Allow Azure services and resources to access this server if your selected location highlights that section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Leave the everything under the Security tab as Default and head over to the Additional settings tab.&lt;br&gt;
Since we do not have an existing data source, we will make use of the sample dataset provided by Azure. Hence, select the sample for Use existing data, this will give a prompt about AdventureWorksLT database to be use, click you wish to continue. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkenknd0lln7pf5ryqis7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkenknd0lln7pf5ryqis7.png" alt="Additional settings tab" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
This is the database we will be querying. If you have an existing data source, you can select it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Assign tags to your database then review and create your database. With that, your database should be deployed&lt;br&gt;
Upon creating your database, it is important to add firewall so you won't have issues connecting to the Azure Data Studio. To do this, scroll down the overview tab and you will see a 'Configure access' section&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgysuurgffib612zkbzbl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgysuurgffib612zkbzbl.png" alt="configuring access" width="800" height="346"&gt;&lt;/a&gt;&lt;br&gt;
Click on the configure access, scroll down the page and under the firewall rules, select add your client IPV4 address and save&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2s210le7n076s1behtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2s210le7n076s1behtq.png" alt="firewalls" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Connecting and Querying the Database
&lt;/h4&gt;

&lt;p&gt;Now that you have deployed your database, the next thing is to query the database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; To query the database, you will need to connect to it. Click go to resource, on the Overview tab, click on the drop arrow on Connect with and select Azure Data Studio. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F331z26hd6opqv2i36tvi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F331z26hd6opqv2i36tvi.png" alt="connection" width="800" height="317"&gt;&lt;/a&gt;&lt;br&gt;
This will open another window for you to either download or launch Azure Data studio if you already have it installed&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fql6k0rziijy51rrttwzz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fql6k0rziijy51rrttwzz.png" alt="azure data studio" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; If you already have Azure Data Studio installed, launch it else you can go ahead and download it ensure to choose to your laptop specification. Clicking on the launch button will open a prompt that Azure Data Studio will opened. &lt;br&gt;
Click open Azure Data Studio.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwjdtfydtbhm851rtf2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frwjdtfydtbhm851rtf2q.png" alt="Azure Data Studio." width="800" height="358"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; If you downloaded the Azure Data Studio, install it and it's once done, launch it from your Azure portal so that the server details will be automatically populated in the Azure Data studio.&lt;br&gt;
Enter the admin name you set up and password when you were creating the server. The connect button should be highlighted, click on the connect&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzemv7wo7dfn3q9d04ui5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzemv7wo7dfn3q9d04ui5.png" alt="Connection" width="800" height="547"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; The data studio should be populated with the AdventureWorksLT database. This is the reason why we selected the sample database so we can a database to query.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Above the populated database is the option to a New query tab, click on it so we can query the database.&lt;br&gt;
You can write the queries in the image below to query your database&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87ezwdp8uxsyfe80wpmk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F87ezwdp8uxsyfe80wpmk.png" alt="Image description" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>beginners</category>
      <category>database</category>
      <category>azure</category>
    </item>
    <item>
      <title>Building a Static Web Application on Microsoft Azure</title>
      <dc:creator>gbamwuandooshima@gmail.com</dc:creator>
      <pubDate>Sat, 15 Apr 2023 04:54:53 +0000</pubDate>
      <link>https://forem.com/shima/building-a-static-web-application-on-microsoft-azure-9o5</link>
      <guid>https://forem.com/shima/building-a-static-web-application-on-microsoft-azure-9o5</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;My previous &lt;a href="https://dev.to/shima/setting-up-and-connecting-to-ec2-instance-on-aws-5bbl"&gt;article&lt;/a&gt;, was focused on how to set up a virtual machine on AWS.&lt;br&gt;
In this article, I will be focusing on building static web applications on cloud using Microsoft Azure. Just before we dive deep into the practical, let's understand what an Azure static web app is and why we do need it. &lt;br&gt;
Azure static web app is a code-based service offered by Microsoft Azure that allows users to build and automatically load changes to a web application taking the code from the sources code or version control such as GitHub, BitBucket, GitLab or Azure DevOps thereby making your application globally available as opposed to the traditional method of building applications.&lt;br&gt;
This gives you an amazing experience as a developer as changes to your source code are monitored and automatically updated.&lt;br&gt;
Basically, what this means is that, once there is a change in your source code or any branch that Microsoft Azure static web is monitoring, it automatically updates the changes without you having to bother to update the changes manually.&lt;br&gt;
Microsoft Azure static web app supports different frameworks such as Angular, Vue, React, and Blazor and you can also build web applications not using any of those frameworks.&lt;br&gt;
For the purpose of this tutorial, I will not be using any framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Repository
&lt;/h3&gt;

&lt;p&gt;I will be using GitHub to host my code. &lt;br&gt;
You can sign up on GitHub &lt;a href="https://github.com/signup" rel="noopener noreferrer"&gt;here&lt;/a&gt; or sign in if you have an account.&lt;br&gt;
Click on this link &lt;a href="https://github.com/staticwebdev/vanilla-basic/generate" rel="noopener noreferrer"&gt;https://github.com/staticwebdev/vanilla-basic/generate&lt;/a&gt; provided by Microsoft which all the basic folders we will be needing for this tutorial and create your own repository by clicking on create repo from template&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8m91c00i243kr6qeedf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft8m91c00i243kr6qeedf.png" alt="Image description" width="800" height="353"&gt;&lt;/a&gt;&lt;br&gt;
After creating the repo, clone it using either GitHub desktop or VS-code so you have it on your remote machine. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facmbyog49lh2ibpe7jdr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facmbyog49lh2ibpe7jdr.jpg" alt="Image description" width="800" height="529"&gt;&lt;/a&gt;&lt;br&gt;
After cloning open it in VS-code &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Friznrwiaqkzh74d42lac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Friznrwiaqkzh74d42lac.png" alt="cloning" width="800" height="564"&gt;&lt;/a&gt;&lt;br&gt;
In the src folder, there is an index.html file where you add the code for your app and the CSS.style file where you give your web app the style you want.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up on Azure
&lt;/h3&gt;

&lt;p&gt;The next thing to build the web app on Azure.&lt;/p&gt;

&lt;h5&gt;
  
  
  Step One: Locating the Azure Static App
&lt;/h5&gt;

&lt;p&gt;In the search bar of your Microsoft Azure, search web static app and select it which will open to another window. If you have an already existing app, you'd see it here.&lt;br&gt;
Click on create static web app to create a new web app&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dl1fscw3aazqvky7aay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dl1fscw3aazqvky7aay.png" alt="setting up" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 2: Configuring the Static Web App
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Select your resource group&lt;/li&gt;
&lt;li&gt;Name your static web app appropriately&lt;/li&gt;
&lt;li&gt;In the hosting plan, select free: for hobby or personal project&lt;/li&gt;
&lt;li&gt;Select your region&lt;/li&gt;
&lt;li&gt;In deployment details, select GitHub as the source and click on the sign in with GitHub dialogue box, which will open another window for you, go ahead and authorize Azure to connect to your GitHub account.&lt;/li&gt;
&lt;li&gt;Click on the drop down arrow in the organization section and select your GitHub account, the repo you will working on and the branch you want to make contributions to. In this case I will select the 'Main' since that's the branch will be making contributions to.
Scroll down your page, you will see a Build Details section&lt;/li&gt;
&lt;li&gt;Click on the Build presets and select 'custom'.&lt;/li&gt;
&lt;li&gt;In the app location, add the folder where the app will be, in my case the src folder as seen in the image below.
&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6wym355m5mcljxat1r2.png" alt="configuration" width="800" height="363"&gt;
&lt;/li&gt;
&lt;li&gt;Click on Review and Create at the bottom left of the page
If you followed all the steps above, your web should pass the validation review then click on create&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Step 3: Creating the Static Web App
&lt;/h5&gt;

&lt;p&gt;After creating and your static web app, click on go to resources when deployment is completed. Click on the dialogue box above the deployed resources where Azure prompts you to.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz1w33kuvnlj4ku85gq4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foz1w33kuvnlj4ku85gq4.png" alt="creating SWA" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
Clicking on that will lead you to your GitHub page where you will see your source. You make make changes to your code and also track the status which will show "success" once all changes are automatically updated to the cloud&lt;/p&gt;

&lt;h5&gt;
  
  
  Step 4: Tidying up
&lt;/h5&gt;

&lt;p&gt;It is very important to tidy up all resources when not in use so as to avoid billing.&lt;br&gt;
Go back to your Azure portal and select the static web app that we have built and select delete. It a good practice to always delete resources when they are not in use.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3v83kj0szjk1bvax0cja.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3v83kj0szjk1bvax0cja.png" alt="tidying resources" width="800" height="361"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading to the end, stay glued to the blog as you bring more content your way....!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Setting Up and Connecting to EC2 Instance on AWS</title>
      <dc:creator>gbamwuandooshima@gmail.com</dc:creator>
      <pubDate>Sat, 08 Apr 2023 00:02:41 +0000</pubDate>
      <link>https://forem.com/shima/setting-up-and-connecting-to-ec2-instance-on-aws-5bbl</link>
      <guid>https://forem.com/shima/setting-up-and-connecting-to-ec2-instance-on-aws-5bbl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Virtual machine (VM) is one of the terminologies you will be conversant with when you use the cloud.&lt;br&gt;
Virtual machine is a virtual representation or an emulation of a physical computer. You can think of a virtual machine as an operating system (OS) that you can work on without necessarily installing the OS on your physical laptop. For instance, a you can work on a windows operating system using Mac operating system without installing the windows OS on your MacBook. The virtual machine that runs on your physical computer is referred to as the &lt;strong&gt;guest&lt;/strong&gt; while the physical computer running the virtual machine is referred to as the &lt;strong&gt;host.&lt;/strong&gt;&lt;br&gt;
Virtual machines can be set up on different cloud service providers. Amazon Web Service (AWS) offers her VM as Elastic Compute Cloud (EC2), Google provides her VMs as Google Compute Engine and Microsoft Azure provides her VMs as Azure VMs.&lt;/p&gt;

&lt;p&gt;For the purpose of this article, we will be looking at how to set up a virtual machine (EC2 Instance) on Amazon Web Services (AWS).&lt;/p&gt;

&lt;p&gt;Sign in to your AWS account &lt;a href="https://aws.amazon.com/console/" rel="noopener noreferrer"&gt;here&lt;/a&gt; if you already have an account with AWS or you can signup with AWS is you don't have an account &lt;a href="https://aws.amazon.com/free/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;br&gt;
After you have signed in or signed up as the case maybe, the top left hand side you will see 9 dots services labelled services and a search bar in the search type EC2 or click on the 9 dots and scroll down to where you will see EC2. For the purpose of the article, I will be going with the former since it's faster as shown in the picture below:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0jgoi7718ycyk0whxd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0jgoi7718ycyk0whxd8.png" alt="EC2 Instance" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
Note: A major thing to take note of when using AWS is to ensure your location is set right and close to your users or close to your location are to ensure a low &lt;a href="https://aws.amazon.com/what-is/latency/#:~:text=Network%20latency%20is%20the%20delay,response%20times%20have%20low%20latency" rel="noopener noreferrer"&gt;latency&lt;/a&gt;.&lt;br&gt;
At your top right corner just before your user name, you will see your location with a drop down so you can set it to your preferred location. In this article I used my location N. Virginia as I am not setting to any target audience&lt;/p&gt;

&lt;p&gt;Click on EC2 and this allows you to see the various instances that you have running. If you have no instance running, you will see running in parenthesis as zero.&lt;/p&gt;

&lt;h6&gt;
  
  
  Let's take a look at how to launch an EC2 Instance on AWS.
&lt;/h6&gt;

&lt;p&gt;To create an instance you either click on the running instances or scroll down the page to where you will see launch instance. If you clicked on running instance, it will navigate you to another page. On the top right corner, you will see a launch instance box with a drop arrow click on the drop down arrow and select launch instance as that's what we are doing. There are other options in the drop down as launch instance from template and migrate server.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ssjv64ki7jszs0nznnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ssjv64ki7jszs0nznnk.png" alt="Launching an EC2 Instance" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
If you scrolled down the page, you will a launch instance box with a drop down arrow as well, click on the drop down arrow and select launch instance&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4wc857a1yj7ts6bunns.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd4wc857a1yj7ts6bunns.png" alt="Launching an EC2 Instance" width="800" height="367"&gt;&lt;/a&gt;&lt;br&gt;
After you have selected the launch instance, it will open a different dialogue section for you to name your instance, select the OS you want to use and the instance type and create a key pair value.&lt;br&gt;
Name your EC2 instance as you wish&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f83dsfsjhkbuf8dq6qm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4f83dsfsjhkbuf8dq6qm.png" alt="Naming an EC2 Instance" width="800" height="371"&gt;&lt;/a&gt;&lt;br&gt;
Scroll down and select the OS you want your VM to operate in. In this case, I will be using the Windows OS, you can use any OS you want to.&lt;br&gt;
Then select the Amazon Machine Image (AMI) you want to use, in my case, I will leave the default Amazon Machine Image (AMI)&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcr42oobh5ro0koteagvo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcr42oobh5ro0koteagvo.png" alt="Amazon Machine Image (AMI)" width="800" height="363"&gt;&lt;/a&gt;&lt;br&gt;
After that, we will set the instance type. Inside the box to select the instance type, you will see the a link to compare instances. Click on it and select the instance type you want to use. I will just use a regular t2-nano instance type. You can scroll down and select any instance type of your choice.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6gtpp7rup529cq0foi9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6gtpp7rup529cq0foi9.png" alt="selecting instance" width="800" height="366"&gt;&lt;/a&gt;&lt;br&gt;
Next is setting up the Key pair. &lt;br&gt;
If you have already created a key pair before now, you click on the drop down arrow and select it or you can created a new key pair by clicking on created new key pair and this will navigate to where you create the key pair as shown in the image below. &lt;br&gt;
When you have named your key pair, click on create key pair so your key pair can be created.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frci6fu590su3wnsw6idf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frci6fu590su3wnsw6idf.png" alt="Naming key pair" width="800" height="362"&gt;&lt;/a&gt;&lt;br&gt;
Great, with all that done. The next step is the virtual network. For that I leave everything as default since AWS has set up the necessary virtual network. However, you can set up your virtual network as you wish. &lt;br&gt;
With that done, you are ready to launch your instance. Scroll down to the bottom of the page and click on launch instance.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9w2t0qhxtnpkenudzie9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9w2t0qhxtnpkenudzie9.png" alt="Instance launch" width="800" height="367"&gt;&lt;/a&gt;&lt;br&gt;
After your instance is launched, you should see a prompt that your instance has is successfully launched.&lt;br&gt;
The instance page will be loaded so you can see the number of instances you have launched so far on this page. In our case we can only see one instance as it the only instance we have launched.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fydip44db4x23ptmpzar6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fydip44db4x23ptmpzar6.png" alt="launch prompt" width="800" height="375"&gt;&lt;/a&gt;&lt;br&gt;
Well done on coming this far. Having launched our instances we will want to connect to it.&lt;/p&gt;

&lt;h6&gt;
  
  
  Connecting to the EC2 instance
&lt;/h6&gt;

&lt;p&gt;Besides the launched instance there is a checkbox that allows to select the instance. Check the box and at the top corner you will a connect box, click on it to initiate the connection process&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcmn30sg7cszrk8dowgn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcmn30sg7cszrk8dowgn.png" alt="Instance connection" width="800" height="373"&gt;&lt;/a&gt;&lt;br&gt;
We want connect to RDP (Remote Desktop Protocol) to the instance.&lt;br&gt;
When you click the connect box, the connection page will be loaded where you can select the connection type you want to use which in our case is the RDP. There are options to connect to the instance, the Session Manager, RDP Client (the one will be using) and the EC2 Serial Console. Navigate to the RDP Client by clicking on it; And we will use the default connection set up by AWS &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b60ybbss2kgbyq7p8w4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2b60ybbss2kgbyq7p8w4.png" alt="RDP Client Connection" width="800" height="371"&gt;&lt;/a&gt;&lt;br&gt;
When you want to RDP to any instance, a password will be required. &lt;br&gt;
Scroll down a page a bit and you will see a Get Password dialogue box. Click on it so you can get the password which will allow you to RDP into the instance. Clicking on Get Password which downloads the password&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5gewoxqqafqvsbwupff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5gewoxqqafqvsbwupff.png" alt="Get Password" width="800" height="364"&gt;&lt;/a&gt;&lt;br&gt;
After downloading the password, you will be allowed to upload the password. Go ahead and upload the private key file from your downloads&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6h2crdvohe8yordi2uw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6h2crdvohe8yordi2uw.png" alt="password upload" width="800" height="143"&gt;&lt;/a&gt;&lt;br&gt;
The uploaded password in this form is encrypted for security reasons but since we need it to RDP to the virtual machine, we will have to decrypt it so we can copy it, hence after uploading the password, decrypt it by clicking on the Decrypt Password dialogue box.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9ulaq41zkhc0pb1iwi2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu9ulaq41zkhc0pb1iwi2.png" alt="Decrypt password" width="800" height="376"&gt;&lt;/a&gt;&lt;br&gt;
You will need a Remote Desktop file to use along with the virtual machine.  Just above the uploaded password, click and download the Remote Desktop file and also copy the password as illustrated in the picture below&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F477r7l8t52h9oxtp0va6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F477r7l8t52h9oxtp0va6.jpg" alt="copying password" width="800" height="336"&gt;&lt;/a&gt; &lt;br&gt;
Now is time to connect to the virtual machine go ahead to connect to the virtual machine; the host (your physical computer) will require you to allow the guest(virtual computer). Allow the connection and your virtual machine is connected.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9kxnviu7whwvnj3p6gc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9kxnviu7whwvnj3p6gc.jpg" alt="Permission" width="800" height="367"&gt;&lt;/a&gt;&lt;br&gt;
Know that your virtual machine is connected, you can do whatever it is you want to do.&lt;br&gt;
Returning to the cloud, just above the virtual machine is the cancel symbol. Click on it, confirm you want to close the VM and the VM is closed&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faagbnyqg92mxrmyyq2ae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faagbnyqg92mxrmyyq2ae.png" alt="closing VM" width="800" height="449"&gt;&lt;/a&gt;&lt;br&gt;
That was amazing, well done for coming this far.&lt;br&gt;
It is always important to terminate resources that you are no longer using on the cloud so that you billing does not pill up.&lt;br&gt;
Since we are done with why we were setting up the instance, we need to terminate the instance. Go to your instances and select the instance we have been working with and at the upper corner of the instance, click on drop down arrow besides the instance state and select terminate as that's the only option that will delete the resource. &lt;br&gt;
When the instance is successfully terminated, you should see a prompt that your instance was successfully terminated. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhw0u4xlhwqppbbueduu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkhw0u4xlhwqppbbueduu.png" alt="VM terminated" width="800" height="370"&gt;&lt;/a&gt;&lt;br&gt;
You can also refresh the page to you will see that the instance was terminated&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ek28k8mrsv2obppe4vh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ek28k8mrsv2obppe4vh.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;br&gt;
Yeah....that simple, that's all there is to setting up and connecting to EC2 instance (a virtual machine). &lt;br&gt;
I hope you learnt a thing or two. &lt;br&gt;
Thank you for reading to the end, stay tune to this blog handle as I intend to blow your mind with more content.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
