<?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: Moyinoluwa Adenuga</title>
    <description>The latest articles on DEV Community by Moyinoluwa Adenuga (@moyinoluwaa).</description>
    <link>https://dev.to/moyinoluwaa</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%2F1061061%2F1801c732-0655-447a-86fd-cba0abebb902.jpg</url>
      <title>DEV Community: Moyinoluwa Adenuga</title>
      <link>https://dev.to/moyinoluwaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moyinoluwaa"/>
    <language>en</language>
    <item>
      <title>Deploying a web application using Azure Web App, Azure PostgreSQL and Azure Kubernetes Service</title>
      <dc:creator>Moyinoluwa Adenuga</dc:creator>
      <pubDate>Sun, 21 May 2023 22:57:13 +0000</pubDate>
      <link>https://dev.to/moyinoluwaa/deploying-a-web-application-using-azure-web-app-azure-postgresql-and-azure-kubernetes-service-4amg</link>
      <guid>https://dev.to/moyinoluwaa/deploying-a-web-application-using-azure-web-app-azure-postgresql-and-azure-kubernetes-service-4amg</guid>
      <description>&lt;p&gt;We will  build, deploy and manage a three tier application in Azure using Azure Web App, Azure PostgreSQL and Azure Kubernetes Service. A three tier application is basically an application which has a presentation layer (frontend), application layer (backend) and data layer (database). &lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;p&gt; 1. Prerequisites&lt;br&gt;
 2. Sample Application&lt;br&gt;
 3. Install Azure CLI and log in&lt;br&gt;
 4. Create resource group in azure&lt;br&gt;
 5. Deploy and run a containerized web app with Azure App Service&lt;br&gt;
       5.1. Run Application Locally&lt;br&gt;
       5.2. Create Dockerfile&lt;br&gt;
       5.3. Build Docker image and run Docker container&lt;br&gt;
       5.4. Create Azure Container Registry and push Docker image.&lt;br&gt;
       5.5. Create and deploy a web app from Azure Container Registry repository&lt;br&gt;
 6. Create PostgreSQL Database&lt;br&gt;
       6.1. Create an Azure Database for PostgreSQL - Flexible Server&lt;br&gt;
       6.2. Create Database&lt;br&gt;
       6.3. Connect to Database&lt;br&gt;
       6.4. Get Connection String&lt;br&gt;
 7. Deploy Microservices using AKS&lt;br&gt;
       7.1. Restructure Monolithic application into a Microservice architecture&lt;br&gt;
       7.2. Get environment variables&lt;br&gt;
       7.3. Run code locally&lt;br&gt;
       7.4. Set up Dockerfile&lt;br&gt;
       7.5. Configure API Gateway using Reverse Proxy&lt;br&gt;
       7.6. Create Images&lt;br&gt;
       7.7. Tag Container Images and Push to Registry&lt;br&gt;
       7.8. Create a Kubernetes cluster&lt;br&gt;
       7.9. Install the Kubernetes CLI&lt;br&gt;
       7.10. Connect to the cluster using kubectl&lt;br&gt;
       7.11. Create deployment and service manifest files and configure environment variables.&lt;br&gt;
       7.12. Deploy the application&lt;br&gt;
       7.13. Expose Proxy endpoint and test application&lt;br&gt;
 8. Build Frontend container image&lt;br&gt;
 9. Test Application&lt;br&gt;
 10. Continuous Integration with Azure pipelines&lt;br&gt;
 11. Clean up resources&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Azure account and subscription. If you do not have an account, you can create one &lt;a href="https://azure.microsoft.com/en-us/free/"&gt;here&lt;/a&gt;. &lt;a href="https://portal.azure.com/"&gt;Login&lt;/a&gt; to your account if you have one.&lt;/li&gt;
&lt;li&gt;Basic understanding of microservice architecture.&lt;/li&gt;
&lt;li&gt;Basic experience using Docker commands to store and retrieve Docker images.&lt;/li&gt;
&lt;li&gt;Basic understanding of Kubernetes concepts.&lt;/li&gt;
&lt;li&gt;Have Docker desktop installed or you can install it &lt;a href="https://www.docker.com/products/docker-desktop/"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install Azure Data Studio.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Sample Application
&lt;/h2&gt;

&lt;p&gt;We will deploy an application which is used to verify users bank account number. The frontend was built with VueJS and the backend with ExpressJS. We will split the backend monolith application into a microservice architecture. A reverse proxy would be used to route incoming requests to the right microservice. &lt;/p&gt;

&lt;p&gt;The frontend application will be dockerized, pushed to Azure Container Registry and deployed using Azure Web App service. The backend application will be dockerized, pushed to Azure Container Registry and deployed using Azure Kubernetes Service. Azure PostgresSql database would be used to store user data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Install Azure CLI and log in
&lt;/h2&gt;

&lt;p&gt;Azure CLI is a command-line tool to connect to Azure and execute administrative commands on Azure resources. Install for your operating system using this &lt;a href="https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"&gt;link&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I am using MacOS, so i used the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew update &amp;amp;&amp;amp; brew install azure-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;After installation, confirm the CLI was successfully installed by running &lt;code&gt;az version&lt;/code&gt; in the terminal. If you get the versions as shown below, then you are now able to run azure commands.&lt;/p&gt;

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

&lt;p&gt;Log in to authenticate your account by running the command&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Create resource group in azure
&lt;/h2&gt;

&lt;p&gt;To create any resource in Azure, we need to have a resource group to hold related resources for a solution. You can create a resource group in azure portal or using the CLI.&lt;/p&gt;

&lt;p&gt;In Azure portal,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search for &lt;strong&gt;Resource Groups&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create&lt;/strong&gt; or &lt;strong&gt;Create resource group&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;Fill in the &lt;strong&gt;resource group&lt;/strong&gt; name and select a &lt;strong&gt;region&lt;/strong&gt; where you would want your resources to be hosted.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n74EVJJE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ic7xcxwqnr602rypkc5i.png" alt="Create Azure Resource Group" width="800" height="642"&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Review + create&lt;/strong&gt; button. Then, select &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using Azure CLI, we pass the name and location for the resource group as shown below. Run the command in the terminal.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az group create --name sca-project --location eastus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Deploy and run a containerized web app with Azure App Service
&lt;/h2&gt;

&lt;p&gt;Let us deploy and run our frontend application first. If you would like to follow along, clone the starter code &lt;a href="https://dev.azure.com/moyinadenuga/SCA%20Cloud%20School%20Project/_git/VERIFY-ACCOUNT-FRONTEND-STARTER"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;h3&gt;
  
  
  Run Application Locally
&lt;/h3&gt;

&lt;p&gt;To run locally, install all dependencies using &lt;code&gt;npm install&lt;/code&gt;. Create a &lt;strong&gt;.env&lt;/strong&gt; file and copy the contents of &lt;strong&gt;.env.sample&lt;/strong&gt; into it. Add the application backend base url value  &lt;a href="https://verify-account-api.onrender.com"&gt;https://verify-account-api.onrender.com&lt;/a&gt; after the “=”. Then, run the command npm run serve.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create Dockerfile
&lt;/h3&gt;

&lt;p&gt;Dockerfile is a file that contains instructions and commands that would be automatically run in sequence to build a docker image. Create the file named Dockerfile in the root of the project and the contents would be:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Stage 1: Build the Vue app
FROM node:16 as build-stage
WORKDIR /app
ARG VUE_APP_BASE_URL
ENV VUE_APP_BASE_URL $VUE_APP_BASE_URL
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# Stage 2: Serve the Vue app using NGINX
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This Dockerfile is stating to use node version 16. The WORKDIR is used to define the working directory of a container. It creates and changes directory which is a combination of mkdir and cd commands. The ENV provides the environmental variable needed by the application. The package.json file is copied, dependencies are installed, files are copied from the local to the docker container and the build command is run. The application is served using nginx. We are exposing the application at port 80.&lt;/p&gt;
&lt;h3&gt;
  
  
  Build Docker image and run Docker container
&lt;/h3&gt;

&lt;p&gt;Open the Docker desktop application which provides the environment to build and run containerized application. On the terminal, build the Docker image using:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t &amp;lt;docker-image-name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace &lt;code&gt;&amp;lt;docker-image-name&amp;gt;&lt;/code&gt; with the name you want to give the image. &lt;/p&gt;

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

&lt;p&gt;Create a container from the image and run container using:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it -p 8080:80 --rm --name &amp;lt;container-name&amp;gt; &amp;lt;docker-image-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace &lt;code&gt;&amp;lt;container-name&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;docker-image-name&amp;gt;&lt;/code&gt; with the name you want to give the container and the docker image name. We are also publishing the container port to 8080 using &lt;code&gt;-p 8080:80&lt;/code&gt; and automatically removing the container on exit using the &lt;code&gt;--rm&lt;/code&gt; flag. Read more on docker run commands here.&lt;/p&gt;

&lt;p&gt;View application on &lt;a href="http://localhost:8080/"&gt;http://localhost:8080/&lt;/a&gt;. Exit running the container using CTRL + C command.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create Azure Container Registry and push Docker image.
&lt;/h3&gt;

&lt;p&gt;Azure Container Registry is a service which allows you to build, store, and manage container images in a private registry. Like Docker Hub, Container Registry uses repositories which contain one or more images. &lt;/p&gt;

&lt;p&gt;A major reason to use Container Registry is because it offers better security. Also, as it is hosted on Azure, you can store images close to locations where they would be deployed.&lt;/p&gt;

&lt;p&gt;You can create the azure container registry on the Azure portal or using Azure CLI.&lt;/p&gt;

&lt;p&gt;In Azure portal,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search for &lt;strong&gt;Container Registries&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create&lt;/strong&gt; or &lt;strong&gt;Create container registry&lt;/strong&gt; button.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;resource group&lt;/strong&gt; created earlier. Also, fill in the &lt;strong&gt;registry name&lt;/strong&gt;. Leave the other fields as default.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PJDVUCXI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3vohocfqs84rbwre422.png" alt="Create Container Registry" width="800" height="624"&gt;
&lt;/li&gt;
&lt;li&gt;Click on Review + create button. Then, select Create.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using Azure CLI, we pass the &lt;strong&gt;resource name&lt;/strong&gt; and &lt;strong&gt;resource group&lt;/strong&gt; as parameters as shown below.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr create --name &amp;lt;resource-name&amp;gt; --resource-group &amp;lt;resource-group-name&amp;gt; --sku standard --admin-enabled true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Parameters:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;resource-name: must be alphanumeric and it is the name of your container registry.&lt;/li&gt;
&lt;li&gt;resource-group-name: use the resource group name created earlier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To host the docker image created earlier, use:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr build --registry &amp;lt;container_registry_name&amp;gt; --image &amp;lt;docker-image-name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace &lt;code&gt;&amp;lt;container_registry_name&amp;gt;&lt;/code&gt; with the name of the registry you created earlier and &lt;code&gt;&amp;lt;docker-image-name&amp;gt;&lt;/code&gt; with the image created earlier.&lt;/p&gt;

&lt;p&gt;If you would like to build a Docker image on Azure, run this command. This command copies the file contents to the Container Registry, then uses the Dockerfile to build the image and store it.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr build --file Dockerfile --registry &amp;lt;container_registry_name&amp;gt; --image &amp;lt;new-docker-image-name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace &lt;code&gt;&amp;lt;container_registry_name&amp;gt;&lt;/code&gt; with the name of the registry you created earlier and &lt;code&gt;&amp;lt;new-docker-image-name&amp;gt;&lt;/code&gt; as the name of the docker image that will be created.&lt;/p&gt;

&lt;p&gt;It takes a while to build. Once done, view the Docker image in the Container Registry by selecting Repositories.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--w0MR0IG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1dquham58liwjxxd1wf5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w0MR0IG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1dquham58liwjxxd1wf5.png" alt="View Container Registry" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Create and deploy a web app from Azure Container Registry repository
&lt;/h3&gt;

&lt;p&gt;To create and deploy a web app, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search for &lt;strong&gt;Web App&lt;/strong&gt; and select.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Basics&lt;/strong&gt; tab, enter the following values for each setting. Some of the fields are prepopulated. Make sure to confirm they are the ones you would like to use. Enter the web app name which would be the default url. For the Publish, change to Docker Container as we would be deploying from a container. I also updated my Pricing plan to a free one.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xifSw4ep--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0xc0mhtu8hsm8jz2z5j.png" alt="Creating Azure Web App - Basics" width="800" height="705"&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Next: Docker&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;Docker&lt;/strong&gt; tab, change the image source to Azure Container Registry. Then, confirm the registry details.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7aMw3OC6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yasmq6b9q2l4u2frsoo.png" alt="Creating Azure Web App - Docker" width="800" height="731"&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Review and create&lt;/strong&gt;, and then select &lt;strong&gt;Create&lt;/strong&gt;. It takes a while to deploy.&lt;/li&gt;
&lt;li&gt;After deployment succeeds, select &lt;strong&gt;Go to resource&lt;/strong&gt; to see the web app just created. &lt;/li&gt;
&lt;li&gt;In the top menu bar, select &lt;strong&gt;Browse&lt;/strong&gt; to open the site in a new browser tab or copy the url. It might take a while the first time for the website to display.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8plqftoB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sfzirff5ns3zq55igk8m.png" alt="Open Application from Web App Service" width="800" height="421"&gt;
&lt;/li&gt;
&lt;li&gt;View application.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--77HdaJcd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25cq962h4jem4r22tp1e.png" alt="View application" width="800" height="400"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Create PostgreSQL Database
&lt;/h2&gt;

&lt;p&gt;We will create a PostgreSQL server and database to store users information when they register and also retrieve it during login. &lt;/p&gt;
&lt;h3&gt;
  
  
  Create an Azure Database for PostgreSQL - Flexible Server
&lt;/h3&gt;

&lt;p&gt;This can be created in Azure Portal or using the CLI.&lt;/p&gt;

&lt;p&gt;In Azure Portal,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Search for &lt;strong&gt;Azure Database for PostgreSQL&lt;/strong&gt; and Select it.&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Create&lt;/strong&gt; on the left card to create the database.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_qPcshCO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2d1lgycckisv8tqvh94p.png" alt="Creating Azure PostgreSQL Database" width="800" height="551"&gt;
&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Basics&lt;/strong&gt; tab, ensure to fill all required fields as shown below. Enter the &lt;strong&gt;resource group&lt;/strong&gt; and database &lt;strong&gt;server name&lt;/strong&gt;.Choose a &lt;strong&gt;Region&lt;/strong&gt;.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rVgu9Awd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xeugyvq1bwbt4hnq27r5.png" alt="Creating Azure PostgreSQL Database - Flexible Server Basics 1" width="800" height="493"&gt;
For the &lt;strong&gt;workload type&lt;/strong&gt;, select development since we are using it for a personal project.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ld7FFg9z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23yi5nnm2o2ljwq06s6r.png" alt="Creating Azure PostgreSQL Database - Flexible Server Basics 2" width="800" height="530"&gt;
Set up &lt;strong&gt;username&lt;/strong&gt; and &lt;strong&gt;password&lt;/strong&gt; for authentication
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DaoJiB7z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yghvaa11rj9n524ch94.png" alt="Creating Azure PostgreSQL Database - Flexible Server Basics 3" width="800" height="515"&gt;
&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Networking&lt;/strong&gt; tab, allow Public access and you can also add your current IP address.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yaBe_Qxn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xelin9uu5rrwivz6pkpu.png" alt="Creating Azure PostgreSQL Database - Flexible Server Networking" width="800" height="521"&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Review and create&lt;/strong&gt;. Then, &lt;strong&gt;Create&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;After Deployment, &lt;strong&gt;Go to resource&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Using the Azure CLI, we can use this command to create a PostgreSQL flexible server with custom parameters.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az postgres flexible-server create --location &amp;lt;location&amp;gt; --resource-group &amp;lt;resource-group&amp;gt; \
  --name &amp;lt;database-server-name&amp;gt; --admin-user &amp;lt;username&amp;gt; --admin-password &amp;lt;password&amp;gt; \
  --sku-name Standard_B1ms --tier Burstable --public-access all --storage-size 128 \
  --version 14
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Replace the &lt;code&gt;&amp;lt;location&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;resource-group&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;database-server-name&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;username&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;password&amp;gt;&lt;/code&gt; with the right values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Database server name should be globally unique.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create Database
&lt;/h3&gt;

&lt;p&gt;Navigate to the &lt;strong&gt;Databases&lt;/strong&gt; tab. Select the &lt;strong&gt;Add&lt;/strong&gt; button. Fill in database name and &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IscbJ83E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7q4fllgyid212bjgjwyt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IscbJ83E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7q4fllgyid212bjgjwyt.png" alt="Create Database" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Connect to Database
&lt;/h3&gt;

&lt;p&gt;Open &lt;strong&gt;Azure Data Studio&lt;/strong&gt; application. Go to the extensions tab and search for &lt;strong&gt;postgresql&lt;/strong&gt;.&lt;/p&gt;

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

&lt;p&gt;If you encounter issue with the extension, check this &lt;a href="https://github.com/microsoft/azuredatastudio-postgresql/issues/108#issuecomment-1450720129"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Link azure account and connect to the database by adding the server and database name. Also, add your authentication details.&lt;/p&gt;

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

&lt;p&gt;Create a Users table that would be used by the backend application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2QAKH0vC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jmkq52a9xayjevo4swng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2QAKH0vC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jmkq52a9xayjevo4swng.png" alt="Create Users table" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Get Connection String
&lt;/h3&gt;

&lt;p&gt;In Azure, go to the &lt;strong&gt;Connection strings&lt;/strong&gt; tab. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0LTye2LB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbbuvp8jgadhsnzziqxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0LTye2LB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbbuvp8jgadhsnzziqxc.png" alt="Azure PostgreSQL Database connection strings" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several ways to connect but we will be using the PostgreSQL connection url as it fits into the application we will use. Note, we would replace the postgres close to the end of the url with the database name &lt;code&gt;verify-account&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Deploy Microservices using AKS
&lt;/h2&gt;

&lt;p&gt;Here, we will split our backend application into a microservice architecture. Then, we will dockerize the application, set up an application gateway and deploy in a kubernetes cluster. If you would like to follow along, clone the starter code &lt;a href="https://dev.azure.com/moyinadenuga/SCA%20Cloud%20School%20Project/_git/VERIFY-ACCOUNT-BACKEND-STARTER"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;View the deployed microservice application code &lt;a href="https://dev.azure.com/moyinadenuga/SCA%20Cloud%20School%20Project/_git/VERIFY-ACCOUNT-BACKEND"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Restructure Monolithic application into a Microservice architecture
&lt;/h3&gt;

&lt;p&gt;The current project contains the logic for both /users and /verify-account endpoint. We will decompose the API code into 2 different services that can be run independent of one another.&lt;/p&gt;

&lt;p&gt;Create two new directories (as services) named user and verify-account. Delete the &lt;code&gt;package-lock.json&lt;/code&gt; file. Then, copy the content of the root directory into both folders. The folder directory should look like this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m2f2LjcY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/by5q473oxut5559oy5ac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m2f2LjcY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/by5q473oxut5559oy5ac.png" alt="New Microservice folder directory" width="800" height="1340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go through the folders and files, and remove code not related to each service. If you get stuck or are unsure of what is left, compare with the code &lt;a href="https://dev.azure.com/moyinadenuga/SCA%20Cloud%20School%20Project/_git/VERIFY-ACCOUNT-BACKEND-STARTER?version=GBmicroservice"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Get environment variables
&lt;/h3&gt;

&lt;p&gt;For the &lt;code&gt;DATABASE_URL&lt;/code&gt;, use the PostgreSQL connection url and replace the password. To get the &lt;code&gt;MAIL_USERNAME&lt;/code&gt;, &lt;code&gt;MAIL_PASSWORD&lt;/code&gt;, &lt;code&gt;OAUTH_CLIENTID&lt;/code&gt;, &lt;code&gt;OAUTH_CLIENT_SECRET&lt;/code&gt; and &lt;code&gt;OAUTH_REFRESH_TOKEN&lt;/code&gt;, check this &lt;a href="https://nodemailer.com/smtp/oauth2/#oauth-3lo"&gt;guide&lt;/a&gt; to learn how to create these keys for nodemailer. If you do not want to set these up, you can comment out the part in the code using it. The &lt;code&gt;TOKEN_KEY&lt;/code&gt; and &lt;code&gt;RESET_TOKEN_KEY&lt;/code&gt; are random strings used to hash the user password. Create a Paystack account, Add a Business and use the Test API Secret key as the &lt;code&gt;PAYSTACK_SECRET_KEY&lt;/code&gt;. The &lt;code&gt;FRONTEND_BASE_URL&lt;/code&gt; is also used in the email to route the user back to the frontend application.&lt;/p&gt;
&lt;h3&gt;
  
  
  Run code locally
&lt;/h3&gt;

&lt;p&gt;For each microservice, change directory to the microservice folder and run &lt;code&gt;npm install&lt;/code&gt; command to install all project dependencies. Create a &lt;strong&gt;.env&lt;/strong&gt; file and copy the content of &lt;strong&gt;.env.sample&lt;/strong&gt; file. Put the values gotten above. Run &lt;code&gt;npm start&lt;/code&gt; or &lt;code&gt;npm run dev&lt;/code&gt; to test the application. &lt;/p&gt;

&lt;p&gt;Let's test the register user endpoint &lt;a href="http://localhost:8080/api/users/register"&gt;http://localhost:8080/api/users/register&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;If the endpoint does not return a response, then something is wrong. Try to debug and fix the issue.&lt;/p&gt;
&lt;h3&gt;
  
  
  Set up Dockerfile
&lt;/h3&gt;

&lt;p&gt;Remember the dockerfile we created earlier for the frontend application. We will create a similar one for the microservices. In the microservices project directory, create a file named &lt;code&gt;Dockerfile&lt;/code&gt; and paste this code:&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:14
# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
COPY package*.json ./
RUN npm install

# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "npm", "start" ]

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

&lt;/div&gt;


&lt;p&gt;Also, create a &lt;code&gt;.dockerignore&lt;/code&gt; file and add node_modules.&lt;/p&gt;
&lt;h3&gt;
  
  
  Configure API Gateway using Reverse Proxy
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/architecture/microservices/design/gateway"&gt;API Gateway&lt;/a&gt; is used to ensure requests are routed to the right service. There are a couple of ways this can be done. These include using Azure API Management, Azure Application Gateway and others, but we will be using reverse proxy. &lt;/p&gt;

&lt;p&gt;Create a folder and name it &lt;code&gt;reverse-proxy&lt;/code&gt;. Create a &lt;code&gt;Dockerfile&lt;/code&gt; in it and paste this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Also, create a nginx.conf file and configure it. Read up on how it works &lt;a href="https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;worker_processes 1;  
events { worker_connections 1024; }
error_log /dev/stdout debug;
http {
    sendfile on;
    upstream user {
        server user:8080;
    }
    upstream verify-account {
        server verify-account:8080;
    }
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-NginX-Proxy true;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;    
    server {
        listen 8080;
        location /api/verify-account {
            proxy_pass         http://verify-account;
        }
        location /api/users {
            proxy_pass         http://user;
        }            
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Create Images
&lt;/h3&gt;

&lt;p&gt;To build multiple images from different Dockerfile, we need to create a &lt;code&gt;docker-compose-build.yaml&lt;/code&gt; file in the project root directory.&lt;/p&gt;

&lt;p&gt;The file contains the path to the different directory and you also specify the image name. This is how the &lt;code&gt;docker-compose-build.yaml&lt;/code&gt; file looks.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3"
services:
  reverseproxy:
    build:
      context: ./reverse-proxy
    image: reverseproxy
  verify_account:
    build:
      context: ./verify-account
    image: verify-account
  user:
    build:
      context: ./user
    image: user

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

&lt;/div&gt;


&lt;p&gt;Then run this command to build the images.&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 -f docker-compose-build.yaml build --parallel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To run the images in a container, create a &lt;code&gt;docker-compose.yaml&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3"
services:
  reverseproxy:
      image: reverseproxy
      ports:
          - 8080:8080
      restart: always
      depends_on:
        - user
        - verify-account
  user:
    image: user
    environment:
      DATABASE_URL: $DATABASE_URL
      MAIL_USERNAME: $MAIL_USERNAME
      MAIL_PASSWORD: $MAIL_PASSWORD
      OAUTH_CLIENTID: $OAUTH_CLIENTID
      OAUTH_CLIENT_SECRET: $OAUTH_CLIENT_SECRET
      OAUTH_REFRESH_TOKEN: $OAUTH_REFRESH_TOKEN
      TOKEN_KEY: $TOKEN_KEY
      RESET_TOKEN_KEY: $RESET_TOKEN_KEY
      PAYSTACK_SECRET_KEY: $PAYSTACK_SECRET_KEY
      FRONTEND_BASE_URL: $FRONTEND_BASE_URL
  verify-account:
    image: verify-account
    environment:
      TOKEN_KEY: $TOKEN_KEY
      RESET_TOKEN_KEY: $RESET_TOKEN_KEY

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

&lt;/div&gt;


&lt;p&gt;Create a &lt;code&gt;.env&lt;/code&gt; file in the root directory and paste all the project environment variables. Use the &lt;code&gt;docker compose config&lt;/code&gt; to confirm all the environment variables are set. Then, use this command to run the container.&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 up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Test the application by using any of the endpoint. It should work as before. When you go to the Database and query for all users, you should see the user added.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_r-3iPC4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6mk5v4ykj8238zfta54.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_r-3iPC4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6mk5v4ykj8238zfta54.png" alt="Send Request to Register Endpoint" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7HyijVI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zet0qo4pj2nwkskrqo4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7HyijVI1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2zet0qo4pj2nwkskrqo4.png" alt="Query Database" width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Build and Push to Registry
&lt;/h3&gt;

&lt;p&gt;Log in to the container registry to connect to the Kubernetes cluster from a local computer. The &lt;code&gt;&amp;lt;acrName&amp;gt;&lt;/code&gt; is the name of the container registry e.g scacloudproject.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr login --name &amp;lt;acrName&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Build the image and push to the Container Registry using the &lt;code&gt;acr build&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr build --file Dockerfile --registry &amp;lt;container_registry_name&amp;gt; --image &amp;lt;new-docker-image-name&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Confirm the images are successfully pushed by checking the portal.&lt;/p&gt;

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

&lt;p&gt;You can also view in the CLI using:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr repository list --name &amp;lt;acrName&amp;gt; --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Create a Kubernetes cluster
&lt;/h3&gt;

&lt;p&gt;You can use the command below to create a kubernetes cluster. If you do not have the &lt;strong&gt;Owner&lt;/strong&gt; or &lt;strong&gt;Azure account administrator role&lt;/strong&gt; in your Azure subscription , use this &lt;a href="https://learn.microsoft.com/en-us/azure/aks/azure-ad-rbac?tabs=portal"&gt;guide&lt;/a&gt; to create Kubernetes cluster with role based access control.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az aks create \
    --resource-group &amp;lt;resource-group&amp;gt; \
    --name &amp;lt;aks-cluster-name&amp;gt; \
    --node-count 2 \
    --generate-ssh-keys \
    --attach-acr &amp;lt;acrName&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This command takes a while to run. You can also create it in the portal using this &lt;a href="https://dev.toAzure%20account%20administrator%20role%20in%20your%20Azure%20subscription"&gt;guide&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Install the Kubernetes CLI
&lt;/h3&gt;

&lt;p&gt;Use the Kubernetes CLI, kubectl, to connect to the Kubernetes cluster from a local computer.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az aks install-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Connect to the cluster using kubectl
&lt;/h3&gt;

&lt;p&gt;Connect to the cluster.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az aks get-credentials --resource-group &amp;lt;resource-group&amp;gt; --name &amp;lt;aks-cluster-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To verify connection to the cluster, run kubectl get nodes to return a list of cluster nodes.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WwLcsuLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ou4v3655je7lb8kplcau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WwLcsuLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ou4v3655je7lb8kplcau.png" alt="List of nodes" width="800" height="104"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Create deployment and service manifest files and configure environment variables.
&lt;/h3&gt;

&lt;p&gt;A manifest file is usually a YAML file which is used to specify the configuration for a Kubernetes object that can create and update a set of identical pods. Each pod runs specific containers, which are defined in the &lt;code&gt;spec.template&lt;/code&gt; field of the YAML configuration. &lt;/p&gt;

&lt;p&gt;Kubernetes also helps in handling scalability of pods, ensuring the correct number of pods are running, and taking care of updates to pods on an ongoing basis. All these activities can be configured through fields in the Deployment YAML.&lt;/p&gt;

&lt;p&gt;Create a deployments folder in the project root directory to store all the manifest files. Create manifest file for all the services. Ensure the right image is added for each pod&lt;/p&gt;

&lt;p&gt;Here is how the &lt;code&gt;user-deployment.yaml&lt;/code&gt;file looks.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1
kind: Deployment
metadata:
  name: user
spec:
  replicas: 2
  selector:
    matchLabels:
      app: user
  template:
    metadata:
      labels:
        app: user
    spec:
      containers:
      - name: user
        image: scacloudproject.azurecr.io/user
        envFrom:
          - secretRef:
            name: verify-account-secret
        ports:
        - containerPort: 8080
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
---
apiVersion: v1
kind: Service
metadata:
  name: user
spec:
  ports:
    - protocol: TCP
      port: 8080
      targetPort: 8080
  selector:
    app: user

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

&lt;/div&gt;


&lt;p&gt;From the file above, we can see the envFrom variable which specifies where to get environment variables. Let's configure the &lt;a href="https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/"&gt;secret&lt;/a&gt; file.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create secret generic &amp;lt;secret-name&amp;gt; &amp;lt;data-source&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


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

&lt;p&gt;Other ways to get the env variables in the deployment files are by specifying them &lt;a href="https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/"&gt;directly&lt;/a&gt; or using &lt;a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-a-configmap"&gt;configmap&lt;/a&gt; for configuration variables. &lt;/p&gt;
&lt;h3&gt;
  
  
  Deploy the application
&lt;/h3&gt;

&lt;p&gt;To deploy all the manifest files, create a bash script named &lt;code&gt;deploy.sh&lt;/code&gt; in the &lt;code&gt;deployments&lt;/code&gt; folder and add all the deployment commands for each container.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0TcBKdTe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7nwe6wzopqzlg6slrzbn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0TcBKdTe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7nwe6wzopqzlg6slrzbn.png" alt="List of Kubernetes Deployment Commands" width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change directory to the &lt;code&gt;deployments&lt;/code&gt; directory and run the script with &lt;code&gt;./deploy.sh&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;kubectl get pods&lt;/code&gt; to check the status of the pods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PPRP0TDO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6674vm4y852ssk7ufelk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PPRP0TDO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6674vm4y852ssk7ufelk.png" alt="List of pods" width="800" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Debugging&lt;/strong&gt;&lt;br&gt;
If you encounter any issue with the deployment, check your indentation as it is very important in a YAML file or try to search online for help. Also you would need to delete all deployment and services using these commands.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete --all service
kubectl delete --all deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Run &lt;code&gt;kubectl get pods&lt;/code&gt; to ensure none is running. Then, run the script &lt;code&gt;./deploy.sh&lt;/code&gt; again. Then, run &lt;code&gt;kubectl get pods&lt;/code&gt; and ensure all pods status are running.&lt;/p&gt;
&lt;h3&gt;
  
  
  Expose Proxy endpoint and test application
&lt;/h3&gt;

&lt;p&gt;To get the url we will use to access the frontend microservice, we will expose the reverse proxy port. After, get the IP address with port number using &lt;code&gt;kubectl get services&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl expose deployment &amp;lt;reverse-proxy-name&amp;gt; --type=LoadBalancer --name=&amp;lt;public-reverse-proxy-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2cta_UQ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pv0f28las1059k54ih98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2cta_UQ7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pv0f28las1059k54ih98.png" alt="Expose proxy endpoint and get url" width="800" height="104"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try to make a request in Postman application using any of the endpoint to test the url.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ky_AZuYj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jq9001l4pl4kfbblcldr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ky_AZuYj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jq9001l4pl4kfbblcldr.png" alt="Test AKS Deployed application" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Build Frontend container image
&lt;/h2&gt;

&lt;p&gt;Build the container image again to use the url. Run&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az acr build --file Dockerfile --registry &amp;lt;container_registry_name&amp;gt; --image &amp;lt;docker-image-name&amp;gt; . --build-arg VUE_APP_BASE_URL=&amp;lt;api-base-url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Test Application
&lt;/h2&gt;

&lt;p&gt;In the &lt;strong&gt;configurations&lt;/strong&gt;, under the General Settings tab, turn off HTTPs only requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UYJaVDu0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pu4tbjcvf18po4prulw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UYJaVDu0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pu4tbjcvf18po4prulw.png" alt="Set up Configurations" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add the backend url to CORS as well to prevent CORS origin issues.&lt;/p&gt;

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

&lt;p&gt;I encountered a mixed content error because https website was trying to access a http url. On Google Chrome, turn it off by going to the site lock, then click on site settings. Scroll down to insecure content, and &lt;strong&gt;allow&lt;/strong&gt;. Restart the App Service.&lt;/p&gt;

&lt;p&gt;Go back to the application and make requests.&lt;/p&gt;

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

&lt;p&gt;On reload of routes which were not the base routes, I encountered a 404 error which happens for single page application. To fix this, create a &lt;code&gt;nginx.conf&lt;/code&gt; file in the frontend project root folder and add this code to route the requests.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen       80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        try_files $uri $uri/ /index.html;
        index  index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

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

&lt;/div&gt;


&lt;p&gt;Also, add it to the Dockerfile, rebuild image and restart App Service.&lt;/p&gt;

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

&lt;p&gt;View Deployed application&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://drive.google.com/file/d/11V09mBG2eGJwbtv3SWFGzx0uPLbU_qzQ/view?usp=share_link" rel="noopener noreferrer" class="c-link"&gt;
          Deployed_web_application.mov - Google Drive
        &lt;/a&gt;
      &lt;/h2&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--QRcP2nCr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_32dp.png" width="32" height="32"&gt;
        drive.google.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  Continuous Integration with Azure pipelines
&lt;/h2&gt;

&lt;p&gt;To avoid manually building the images, it is ideal to set up a continuous integration process to ensure that for every push to the branch or PR merged, an image is built and pushed to the container.  &lt;/p&gt;

&lt;p&gt;This can be easily done by going to the Pipelines tab on Azure DevOps and creating a new pipeline. Use this &lt;a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-docker-webapp?view=azure-devops&amp;amp;tabs=java%2Cyaml"&gt;guide&lt;/a&gt; to set up a pipeline as I am not able to due to some permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean up resources
&lt;/h2&gt;

&lt;p&gt;We created several resources using our Azure subscription. We will clean up these resources so that we won't continue to be charged for them. You can delete on the CLI or in the portal.&lt;/p&gt;

&lt;p&gt;Delete with CLI using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;az group delete --name myResourceGroup --yes --no-wait
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Portal,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In Azure, select &lt;strong&gt;Resource groups&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Find the &lt;strong&gt;resource group name&lt;/strong&gt; you used, and select it.&lt;/li&gt;
&lt;li&gt;In the Overview tab of the resource group, select Delete resource group.&lt;/li&gt;
&lt;li&gt;A dialog box appears prompting you to confirm the deletion. Enter the name of the resource group again, and select &lt;strong&gt;Delete&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Delete&lt;/strong&gt; again to confirm deletion. This will delete all of the resources created.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>azure</category>
      <category>devops</category>
      <category>cloud</category>
      <category>database</category>
    </item>
    <item>
      <title>Cloud fundamentals for beginners - Cloud 101</title>
      <dc:creator>Moyinoluwa Adenuga</dc:creator>
      <pubDate>Mon, 15 May 2023 22:57:32 +0000</pubDate>
      <link>https://dev.to/moyinoluwaa/cloud-fundamentals-for-beginners-cloud-101-lg9</link>
      <guid>https://dev.to/moyinoluwaa/cloud-fundamentals-for-beginners-cloud-101-lg9</guid>
      <description>&lt;p&gt;Do you remember how we used to access pictures, audio, videos, files, and other documents about 10-15 years ago? When our phone storage got full, we usually had to get a memory card to allow the phone to accommodate more pictures. What of videos? We had to download them to our device locally, to access audio and videos. If the files were important, we would back them up on a laptop or a hard drive so we don't lose them. Well, many things have changed over the years.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed?
&lt;/h2&gt;

&lt;p&gt;The need for storage continued to grow with the creation of more applications and the continuous updates made to devices. Before now, data and files were stored locally, which contributed to the need for more storage space. When a user had more than one device, there was a need to access files, media, and documents in one device in the others without always having to transfer data using USB cables and other means.&lt;/p&gt;

&lt;p&gt;Cloud brought about the idea of storing your data on another computer (that you do not know where it is) instead of keeping them locally on your mobile phones or laptops. Using an external computer allows the files to be accessed from anywhere over the internet. The computer which hosts our data and files is usually called a remote server. Thinking about it now, you would realize you have used a lot of cloud-based applications such as Spotify, Google Photos, Google Drive, One Drive, Gmail, Netflix, Outlook, Office 365, iCloud, etc.&lt;/p&gt;

&lt;p&gt;To juggle your memory, do you remember how we used to use Microsoft Word then? We needed to save files locally and then transfer them to whoever we wanted to send them to, but now the options have evolved - all thanks to the cloud. Let's dive into how these things work and get some insights.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Computing
&lt;/h2&gt;

&lt;p&gt;Microsoft defines it as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Cloud computing is the delivery of computing services—including servers, storage, databases, networking, software, analytics, and intelligence—over the Internet (“the cloud”) to offer faster innovation, flexible resources, and economies of scale.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Cloud computing simply means how you or the applications you use -  store and access data and programs over the internet; instead of your computer's hard drive. &lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Computing Deployment Types
&lt;/h2&gt;

&lt;p&gt;There are several ways of utilizing the cloud. Different teams use the cloud in different ways. Some decide to host their resources on a third-party cloud provider or a privately owned cloud, while others use private and public cloud providers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Public Cloud:&lt;/strong&gt; is when the cloud resources are owned and operated by a third-party cloud service provider and delivered over the internet. In a public cloud, hardware, software, and other resources, are owned and managed by the cloud provider. Examples of public cloud providers include Amazon Web Services, Microsoft Azure, and Google Cloud Platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Cloud:&lt;/strong&gt; is when cloud computing resources are used exclusively by a business or organization or group of organizations. The private cloud can be physically located at an organization’s on-site data center or hosted by a third-party service provider. In a private cloud, a private network maintains services and infrastructure, and the hardware and software are dedicated solely to the organization. They could be on-premises or privately hosted in a privately owned data center.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid Cloud:&lt;/strong&gt; is a way in which infrastructure and applications can be hosted and shared between the public and the private cloud. It is commonly used between the cloud and existing on-premises infrastructure to extend and grow an organization's infrastructure into the cloud while connecting cloud resources to an internal system. Use cases for hybrid cloud could be to keep some data hosted privately due to security or privacy concerns while keeping other resources in a public cloud. An example we can all relate to is having some files or media directly on a mobile device while we access the rest using cloud-based applications.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Type of expenditure models
&lt;/h2&gt;

&lt;p&gt;The different ways we spend in the cloud are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Capital expenditure:&lt;/strong&gt; is when costs associated with computing services, such as infrastructure, storage, or network costs,  need to be paid for upfront. For example, if you need to run your application on a Linux-based OS in an on-premises environment, a computer with Linux OS needs to be purchased. This expenditure is an upfront cost. The cost usually reduces with time as maintenance costs are less, but they lack scalability (we will discuss this term later).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational expenditure (Consumption based model):&lt;/strong&gt; is when you only pay for resources that you use. It is popularly known as a 'pay-as-you-go' service. Most public cloud providers utilize this model. This model enables the adoption of the cloud at a low cost. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Benefits of the cloud
&lt;/h2&gt;

&lt;p&gt;These are the benefits associated with the cloud:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;High availability:&lt;/strong&gt; Cloud providers usually ensure your data are available when needed. There are a lot of configurations that can be done to ensure the high availability of applications, e.g. by deploying to more than one region (i.e. your application is stored in multiple places to ensure that when there is a downtime in one, you would still be able to access your application).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; is used to adjust resources to meet demand. There are two ways of scaling:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertical scaling:&lt;/strong&gt; refers to adding more hardware to a resource to meet the workload demand. Imagine you had a phone with 2GB RAM with 32GB memory. Based on the applications you would download and operations you would want to carry out on it, this specification is likely to be small and cause your phone to be slow and hang a lot. You would need 8GB RAM with 256GB memory to meet your needs, while the former specification might be ok for your grandmother or someone with lesser needs. The ability to be able to scale up or down resources by adding RAM size or more memory is vertical scaling.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Horizontal scaling:&lt;/strong&gt; refers to adding/removing resources as demand changes. Let's imagine you need to cook for an event. You might usually be like five people cooking for events. Now, you get an order for five million people. Five people cannot meet the need of 5 million people. Hence, you scale out to 100 chefs. If it is an event for 50 people, you can scale in to 1 or 2 chefs. It ensures that as demand changes, the resources can scale in or out to handle the workload.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elasticity:&lt;/strong&gt; is the ability for resources to scale automatically. Elasticity is configured to enable the resources to scale as needed to meet demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability:&lt;/strong&gt; is the ability of a system to recover from failures and continue to function. As data can be backed-up on laptops or hard drives, the cloud offers structures to design your application to be replicated in different places (such as regions, data centers, or availability zones) to ensure it performs as it should.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Predictability:&lt;/strong&gt; is that you can predict the performance and cost of resources set up. Resources costs are usually displayed when setting up resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security and Governance:&lt;/strong&gt; Structures are in place to secure resources to meet corporate standards and government regulatory requirements. When there is a need for more security, a cloud solution that meets the need should be used. IaaS also allows users to manage their security in the cloud. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Cloud service types
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure as a service - IaaS:&lt;/strong&gt; is a service in which the cloud provider maintains the hardware, network connectivity(to the internet), and physical security, and the user is responsible for other things. The user is responsible for choosing, installing, and maintaining the operating system. Also, they are responsible for the network, database, and storage configuration. A simple example would be if you need an Ubuntu (Linux) OS with 16GB RAM and 256GB SSD Storage, you don't need to buy a new computer. You can just easily spin up a Virtual Machine that provides a cloud-based machine that you can use.
It is usually ideal when new teams are migrating to the cloud from having physical infrastructure, as it is much easier to move their workload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Platform as a service - PaaS:&lt;/strong&gt; is a service that provides a complete development environment in which users do not have to worry about the underlying infrastructure. It includes everything developers need to build, run, and manage applications. When developers write their code, they need an environment to build and deploy their code. These environments are PAAS solutions. Examples of PaaS include Azure App Service, Heroku, AWS Elastic Beanstalk, Google App Engine, Azure SQL, etc. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Software as a service - SaaS:&lt;/strong&gt; is a service in which the cloud provider develops and maintains the cloud application software, provides automatic software updates, and makes software available to its customers via the internet on a pay-as-you-go basis. Examples of SaaS applications include Outlook, Skype, Zoom, Shopify, Netflix, Salesforce B2C Commerce Cloud etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Cloud and the SHARED responsibility model
&lt;/h2&gt;

&lt;p&gt;The cloud has a shared responsibility model in which the cloud providers and users have their roles to play. Their roles change based on the cloud service type or deployment type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6KoIiaDv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnz4lc880s6b6abavwvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6KoIiaDv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fnz4lc880s6b6abavwvc.png" alt="Cloud Shared Responsibility Model" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the image above from Azure, the responsibility shifts away from the cloud provider from SaaS to PaaS to IaaS. The IaaS requires a lot from the customer in configuring and maintaining their infrastructure and the applications running on them. In PaaS, the customers need to provide their applications and databases, and the cloud provider manages the infrastructure. While SaaS puts less responsibility on the user as they just use the application on their devices and their user data. On-premise infrastructure puts all the responsibilities on the customer as they are in charge of maintaining and setting up their infrastructure and application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We have seen that the cloud simply means accessing resources over the internet, and we all use cloud-based applications in one way or the other. I hope you learned something new about the cloud and it is no more an abstract term to you.&lt;br&gt;&lt;br&gt;
Leave a reaction, comment, and share with other cloud enthusiasts!&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;If you would want to learn more about the cloud, do check out these resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/"&gt;https://learn.microsoft.com/en-us/training/paths/microsoft-azure-fundamentals-describe-cloud-concepts/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aws.amazon.com/getting-started/cloud-essentials/?ref=gs&amp;amp;id=m1"&gt;https://aws.amazon.com/getting-started/cloud-essentials/?ref=gs&amp;amp;id=m1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloud</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to create a static web app in Azure</title>
      <dc:creator>Moyinoluwa Adenuga</dc:creator>
      <pubDate>Sat, 15 Apr 2023 15:07:47 +0000</pubDate>
      <link>https://dev.to/moyinoluwaa/how-to-create-a-static-web-app-in-azure-3836</link>
      <guid>https://dev.to/moyinoluwaa/how-to-create-a-static-web-app-in-azure-3836</guid>
      <description>&lt;p&gt;&lt;strong&gt;Azure Static Web Apps&lt;/strong&gt; is a service that automatically builds and deploys full stack web applications to Azure from a code repository (either Github or Azure Devops). &lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Have an Azure Account. If you do not have one, you can create an account &lt;a href="https://azure.microsoft.com/en-us/free/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Github or Azure Devops Account to host your code. (This article would describe the Github workflow)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Create the code repository
&lt;/h2&gt;

&lt;p&gt;To host the application code, you need to have a repository either on Github or Azure Devops. In this article, I used Github and created a repository using this &lt;a href="https://github.com/login?return_to=%2Fstaticwebdev%2Freact-basic%2Fgenerate" rel="noopener noreferrer"&gt;template&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%2Fo5wbsr7pl4lonc7jn1vy.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%2Fo5wbsr7pl4lonc7jn1vy.png" alt="Generating Code Repository From Template on Github"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Create a static web app (Using Github)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;From the azure &lt;a href="https://portal.azure.com/#home" rel="noopener noreferrer"&gt;portal&lt;/a&gt;, search for &lt;strong&gt;Static Web Apps&lt;/strong&gt; and select the &lt;strong&gt;Static Web Apps&lt;/strong&gt; service in the dropdown.
&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%2Fjja4mm9kjodtr7ugjzqi.png" alt="Search for Static Web Apps in Azure"&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Create&lt;/code&gt; or &lt;code&gt;Create static web app&lt;/code&gt; button has shown below.
&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%2Fe62dblrd82bphweb2gz8.png" alt="Create static web app in Azure"&gt;
&lt;/li&gt;
&lt;li&gt;On the basic tab, fill in the required fields&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Subscription:&lt;/strong&gt; Select your Azure subscription&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Group:&lt;/strong&gt; Select a resource group if you have one created or use the &lt;code&gt;Create new&lt;/code&gt; link, and enter a resource group name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; This is the name of the application. I used &lt;code&gt;moyin-static-web-app&lt;/code&gt;. Enter your desired name in the textbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan type:&lt;/strong&gt; Select Free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure Functions and staging details:&lt;/strong&gt; Select a region closest to you.I left it as default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Source:&lt;/strong&gt; Select &lt;code&gt;GitHub&lt;/code&gt; and authenticate by clicking &lt;code&gt;Sign in with Github&lt;/code&gt; button.
&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%2Fcwofycp5bvvo84fdlde0.png" alt="Creating static web app in Azure"&gt;
&lt;/li&gt;
&lt;li&gt;Once authenticated, select the code &lt;code&gt;Organization&lt;/code&gt;, &lt;code&gt;Repository&lt;/code&gt; and &lt;code&gt;Branch&lt;/code&gt; from the dropdowns. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build Presets:&lt;/strong&gt; Select the framework or language used to write the code. I used React.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App location:&lt;/strong&gt; Put the path of your application. Mine is the root folder so I left it as default('/).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Api location:&lt;/strong&gt; If you are working with an api, you can add the path here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Output location:&lt;/strong&gt; Enter the path of your build.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once done, &lt;code&gt;review and create&lt;/code&gt; the application&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%2F7e5y52ilg54b8ulf7vte.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%2F7e5y52ilg54b8ulf7vte.png" alt="Code configurations for static web app"&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%2Fd8n60tk5ixhxm4o3s22y.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%2Fd8n60tk5ixhxm4o3s22y.png" alt="Create static web app in azure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When deployment is complete, select the &lt;code&gt;Go to resource&lt;/code&gt; button&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%2Foq5tjn2888ijbgz5k6ru.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%2Foq5tjn2888ijbgz5k6ru.png" alt="Deployment complete in creating static web app in azure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Viewing the web application
&lt;/h2&gt;

&lt;p&gt;The deployment build must be completed before the site can be viewed.You can select the banner with &lt;code&gt;Click here to check the status of your github action runs&lt;/code&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%2F0q1cqwq7y71gt9vbyesd.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%2F0q1cqwq7y71gt9vbyesd.png" alt="Deployment build of azure static web app in progress"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the build (Github Actions workflow) is completed, select the url and view the deployed web application as shown below.&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%2Fdjr03pd3tde4shbmphw6.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%2Fdjr03pd3tde4shbmphw6.png" alt="Select static web app url"&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%2Fzisx2x1mvzv5ytoi5axq.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%2Fzisx2x1mvzv5ytoi5axq.png" alt="Deployed Azure Static Web Apps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Cleaning up resources
&lt;/h2&gt;

&lt;p&gt;If you are not going to be using the application, then delete the &lt;code&gt;Azure Static Web Apps&lt;/code&gt; instance to avoid incurring unnecessary costs.&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%2Fu20fb4u0nitt8haaz7qv.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%2Fu20fb4u0nitt8haaz7qv.png" alt="Deleting the azure static wep app instance"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>cloud</category>
      <category>staticwebapps</category>
    </item>
    <item>
      <title>How to Setup A Windows Virtual Machine using AWS Management Console</title>
      <dc:creator>Moyinoluwa Adenuga</dc:creator>
      <pubDate>Sat, 08 Apr 2023 09:22:13 +0000</pubDate>
      <link>https://dev.to/moyinoluwaa/how-to-setup-a-windows-virtual-machine-using-aws-management-console-4249</link>
      <guid>https://dev.to/moyinoluwaa/how-to-setup-a-windows-virtual-machine-using-aws-management-console-4249</guid>
      <description>&lt;p&gt;Setting up a virtual machine is one of the first skills learned when learning about the cloud. It is very important as it is the foundation of cloud computing. A virtual machine or server is usually referred to as an instance and they are used interchangeably. &lt;strong&gt;Amazon Elastic Compute Cloud (EC2)&lt;/strong&gt; is the service which provides scalable computing capacity in the &lt;strong&gt;Amazon Web Services (AWS)&lt;/strong&gt; Cloud. Amazon EC2 is used to launch as many or as few virtual servers as needed, configure security and networking, and manage storage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt; You should have an AWS account or register &lt;a href="https://portal.aws.amazon.com/billing/signup"&gt;here&lt;/a&gt; to create an account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Launching An Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;When signed in to the AWS console, search and select EC2. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zi7Vyjlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d82o1tj6n9isl5pctuao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zi7Vyjlt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d82o1tj6n9isl5pctuao.png" alt="AWS Management Console Search" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the EC2 console dashboard, select the &lt;strong&gt;Launch Instance&lt;/strong&gt; from the Launch Instance Dropdown to create a virtual server.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dQDTbdFz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0vonhd175c0re5hcbrb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dQDTbdFz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0vonhd175c0re5hcbrb.png" alt="AWS EC2 Console Dashboard" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter a descriptive name for the instance.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PnfDKN5A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbwkm6ql6efra4480dsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PnfDKN5A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbwkm6ql6efra4480dsk.png" alt="Launching an instance - Name" width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under &lt;strong&gt;Application and OS Images (Amazon Machine Image)&lt;/strong&gt;, select Windows as this is the desired operating system (OS) we are setting up for the instance.&lt;br&gt;
For the &lt;strong&gt;Amazon Machine Image (AMI)&lt;/strong&gt;, we can stick with the default which is Free tier eligible. An Amazon Machine Image (AMI) is a basic configuration that serves as a template for the instance.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RALea5tP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b99j2y0bbkusl0c9rfn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RALea5tP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b99j2y0bbkusl0c9rfn9.png" alt="Launching an instance - Application and OS Images" width="800" height="723"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;instance type&lt;/strong&gt; is usually used to set the hardware configurations of the instance such as storage capacity, storage type(ssd or hdd), CPU, memory or network performance. We would just leave this as default.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WoJgIJil--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq2a3xlvkleei2a9n5bj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WoJgIJil--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uq2a3xlvkleei2a9n5bj.png" alt="Launching an instance - Instance Type" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under &lt;strong&gt;Key pair&lt;/strong&gt;, create a key pair or use a previously created one. This allows a secure connection to the instance and is a step that should not be skipped as one would not be able to connect to the instance without it. A file gets downloaded on creation of the key pair.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oY6r4CCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82426i7woj4e28pcm01q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oY6r4CCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82426i7woj4e28pcm01q.png" alt="Launching an instance - Key pair" width="800" height="665"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep the default selections for other configurations, review the summary of the configurations and launch the instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once successfully launched, we are able to see it running on the EC2 dashboard. More information of the instance can be viewed by clicking it.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MHAuw71a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxswd5u7rqjfojive26o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MHAuw71a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wxswd5u7rqjfojive26o.png" alt="AWS EC2 Instance Running" width="800" height="119"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Connecting to the Launched Instance
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Select the instance and click the &lt;strong&gt;connect&lt;/strong&gt; button&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mpg8dRQu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/le57kb3lup7vliv1u481.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mpg8dRQu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/le57kb3lup7vliv1u481.png" alt="Connecting to an Instance" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to the &lt;strong&gt;RDP Client tab&lt;/strong&gt; and download Remote desktop file.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hZc2i87y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wdlwphh614n1modtji6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hZc2i87y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wdlwphh614n1modtji6l.png" alt="Connecting to an Instance using the RDP Client" width="800" height="646"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Generate password&lt;/strong&gt; by uploading the key pair file and decrypt password. Copy the generated password as this password would be used to connect with the remote client.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WoP7qz1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnj3kvg45n9fggahsshh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WoP7qz1a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnj3kvg45n9fggahsshh.png" alt="Generating Password using Key Pair file" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the Remote Desktop file with a suitable application. I used the Microsoft Remote Desktop App from App Store. Enter the password generated in step 3 and the virtual instance is started.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6sE37GmZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnnp2d0b5ubvotgczq4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6sE37GmZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnnp2d0b5ubvotgczq4t.png" alt="Entering password to connect to Remote Desktop" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On getting this prompt, click continue&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8UyLO4Tx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa8eneb1owe734g31xi4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8UyLO4Tx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aa8eneb1owe734g31xi4.png" alt="RDP Connection Prompt" width="800" height="257"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U9i2lYNh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ft4uiyqqk9kx4uekhoac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U9i2lYNh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ft4uiyqqk9kx4uekhoac.png" alt="AWS Windows Virtual Instance" width="800" height="520"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ClqwOrIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joqai5cuyk1ounrpi1kl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ClqwOrIS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/joqai5cuyk1ounrpi1kl.png" alt="AWS Windows Virtual Instance" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to also perform some actions. I browsed and also confirmed the storage was 30gb.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hzJm7YyM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0b9ex2o8co1v1zbgok30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hzJm7YyM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0b9ex2o8co1v1zbgok30.png" alt="Browsing in the Virtual Instance" width="800" height="520"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_hfBkwr1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0j4xxldm4p7shz7hndd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_hfBkwr1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0j4xxldm4p7shz7hndd.png" alt="Storage of Virtual Instance" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Terminating the Instance
&lt;/h2&gt;

&lt;p&gt;Once done with an instance, it should be terminated as resources not needed should not be left running as it incurs costs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Select the instance and Choose &lt;strong&gt;Terminate instance&lt;/strong&gt; in the &lt;strong&gt;Instance state&lt;/strong&gt; dropdown.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mdOLq-3O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oi7mufnhuya5sttw01xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mdOLq-3O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oi7mufnhuya5sttw01xw.png" alt="AWS EC2 Instance termination" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose &lt;strong&gt;Terminate&lt;/strong&gt; when prompted for confirmation.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xUiHKxvv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ysve1xcyu3qzbtkk047.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xUiHKxvv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ysve1xcyu3qzbtkk047.png" alt="Modal to Confirm AWS EC2 Instance termination" width="800" height="482"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CNjig41V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hl7n9w3ysxix2oj7jb61.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CNjig41V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hl7n9w3ysxix2oj7jb61.png" alt="Instance showing terminated state" width="800" height="104"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After the instance is terminated, it remains visible on the console for a short while before being removed from the console.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>aws</category>
      <category>virtualmachine</category>
    </item>
  </channel>
</rss>
