<?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: Girish Jaju</title>
    <description>The latest articles on DEV Community by Girish Jaju (@girishjaju).</description>
    <link>https://dev.to/girishjaju</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%2F741752%2Fd1ae8a56-f022-4f36-b105-5c202db19f46.png</url>
      <title>DEV Community: Girish Jaju</title>
      <link>https://dev.to/girishjaju</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/girishjaju"/>
    <language>en</language>
    <item>
      <title>Multi-region Serverless Application with simulated Regional Fail-over and Routing using Amazon API Gateway and Lambda</title>
      <dc:creator>Girish Jaju</dc:creator>
      <pubDate>Fri, 04 Feb 2022 17:54:33 +0000</pubDate>
      <link>https://dev.to/girishjaju/multi-region-serverless-application-with-simulated-regional-fail-over-and-routing-using-amazon-api-gateway-and-lambda-38hh</link>
      <guid>https://dev.to/girishjaju/multi-region-serverless-application-with-simulated-regional-fail-over-and-routing-using-amazon-api-gateway-and-lambda-38hh</guid>
      <description>&lt;p&gt;In this post (and associated Youtube playlist), we will create a Serverless application, deploy it to two different AWS regions and use Route53’s latency based routing to drive traffic to a regional end point. We will use Route53’s healthcheck feature to achieve active-active setup which can fail over between regions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issue
&lt;/h2&gt;

&lt;p&gt;When you deploy a Serverless application, the default API endpoint type is edge-optimized, which enables clients to access the API through Amazon Cloudfront distribution. For globally diverse clients, it improves the connection time. But there is one problem. For CDN, the custom domain name is globally unique and In case of Lambda integration, the Lambda is only deployed in Single Region. Therefore, we can not use "edge optimized" to achieve active-active failover setup with Route53.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;To solve this problem and demo the solution, we will deploy the Serverless application in 2 different regions and choose API end point type as “Regional“. The custom domains that we get are now regionally unique. In the Serverless application, we will expose an end point that’s just for performing health-check. For the API, in Route53, we will setup Latency Based Routing, which directs the users to closest / best region based on latency. We will also setup health check in Route53. To mimic the regional failover, we will make the healthcheck end point FAIL, and Route53 should start directing the traffic to the other region.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tK8wQXWS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivjxf781evfyv1ks9sjw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tK8wQXWS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivjxf781evfyv1ks9sjw.png" alt="Architecture" width="880" height="538"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the architecture diagram above, the clients requests are getting routed to Region A (solid box). When the health check starts failing, the Route53 will start to direct the traffic to Region B, until the HealthCheck starts passing again on Region A.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tasks
&lt;/h2&gt;

&lt;p&gt;(Some of the following are NOT FREE Tier applicable)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Purchase a domain / or you can use an already purchased domain. I have an old domain in godaddy, which I will use for this.&lt;/li&gt;
&lt;li&gt;Go to AWS Console &amp;gt; Route53 and Create a new HostedZone, with the domain name you are planning to use.&lt;/li&gt;
&lt;li&gt;We need to set the nameservers on the domain (in case you have the domain registered through a 3rd party like GoDaddy)&lt;/li&gt;
&lt;li&gt;The step 3 may take a few mins to 24 hours.&lt;/li&gt;
&lt;li&gt;Let’s create Simple Serverless application with 2 end points and 2 lambdas. First being the /hello and another one /health. Important to keep the endpoint type as “Regional“. Just to keep the demo simple, for the HealthCheck setup in Route53, we will look for a specific string in the response from /health end point. In practical usecase, you would be checking status of one or more of your critical components and determine if the application is healthy or not. (Sample code is in the github)&lt;/li&gt;
&lt;li&gt;We will deploy this application to “us-west-2” (Closest to me) and “us-east-1” regions.&lt;/li&gt;
&lt;li&gt;Let’s try to access both the end points in both the regions and make sure we are getting expected response.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I am using serverless framework as IaC and NodeJS for this solution:&lt;/p&gt;

&lt;p&gt;Serverless.yml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;service: multiregion-failover
frameworkVersion: '2'
provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221
  endpointType: REGIONAL
functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: /hello
          method: get
  health:
    handler: handler.health
    events:
      - http:
          path: /health 
          method: get 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lambda Function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'use strict';

module.exports.hello = async (event, context) =&amp;gt; {
  return {
    statusCode: 200,
    body: JSON.stringify(
      {
        message: 'Hello from the function in region: ' + context.invokedFunctionArn.split(':')[3]
      },
      null,
      2
    ),
  };
};

// We will check for string HEALTHY when we setup the Healthcheck in Route53. In production environment, the HealthCheck is based // on checking multiple critical components of your application
module.exports.health = async (event, context) =&amp;gt; {
  return {
    statusCode: 200,
    body: JSON.stringify(
      {
        message: 'Healthy instance! HEALTHY from region:' + context.invokedFunctionArn.split(':')[3],
      },
      null,
      2
    ),
  };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Solution Code: &lt;a href="https://github.com/mycloudtutorials/serverless-demos/tree/master/serverless-multiregion-failover-demo"&gt;https://github.com/mycloudtutorials/serverless-demos/tree/master/serverless-multiregion-failover-demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All the Tasks performed are in the following youtube playlist. &lt;br&gt;
The entire playlist (all 8 videos) can be accessed at&lt;br&gt;
&lt;a href="https://youtube.com/playlist?list=PLss_bBhYYErsTc24oZSDUUO3PXLmMh9KU"&gt;https://youtube.com/playlist?list=PLss_bBhYYErsTc24oZSDUUO3PXLmMh9KU&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Amazon VPC and Networking - Hands-On Demos</title>
      <dc:creator>Girish Jaju</dc:creator>
      <pubDate>Thu, 03 Feb 2022 05:34:55 +0000</pubDate>
      <link>https://dev.to/girishjaju/amazon-vpc-and-networking-hands-on-demos-57ph</link>
      <guid>https://dev.to/girishjaju/amazon-vpc-and-networking-hands-on-demos-57ph</guid>
      <description>&lt;p&gt;In this youtube video, I will demonstrate Amazon VPC and Networking. I have divided this video in 4 different parts. In each part we will perform certain steps to understand various VPC components.&lt;/p&gt;

&lt;p&gt;Part 1: &lt;br&gt;
Create a VPC, Create and attach Internet Gateway, Create a subnet, Setup Route table, Associate route for 0.0.0.0/0 to Internet Gateway, Setup IAM role, Launch a EC2 instance, setup Security group and SSH to instance to verify we can ping google.com and also list S3 buckets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ifDTj91r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dyo6noy504b8vfbidddv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ifDTj91r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dyo6noy504b8vfbidddv.png" alt="VPC, Public Subnet, Routing" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 2:&lt;br&gt;
In the same VPC we will add another Subnet, a Route table, with no route to 0.0.0.0/0 hence it becomes Private Subnet. We will launch an EC2 instance in the Private Subnet, Setup Security Group to allow SSH to it via the Public Subnet's instance's Security group. Once we SSH into the Private instance, we can verify that we can't ping to google.com or list the S3 buckets as there is no Internet bound route for the Subnet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R_j_8wL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nly0bt8n6obq81z2rqud.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R_j_8wL8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nly0bt8n6obq81z2rqud.png" alt="Private Subnet And Routing" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 3:&lt;br&gt;
Create NAT Gateway in Public Subnet, Set a route in the Private Subnet's Route table, Now Private instance can access Internet. We can verify is by SSH into the instance as we did in Part 2 and now we are able to ping google.com and also list the S3 buckets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UendUkV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q89kmf8gkrghqzq8jgy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UendUkV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q89kmf8gkrghqzq8jgy8.png" alt="NAT Gateway Demo Architecture" width="880" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Part 4:&lt;br&gt;
Delete the NAT Gateway. Setup VPC End point to S3 service and attach to the Private Subnet's Route. EC2 instance should be able to access S3 without Internet access. It should not be able to ping google.com.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EBIebPzT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/spzds5eqpwa70u1mzlnv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EBIebPzT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/spzds5eqpwa70u1mzlnv.png" alt="VPC Endpoint Demo Architecture" width="880" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The detailed instructions and architecture diagrams are available in the Github repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mycloudtutorials/aws-demos/tree/master/aws-vpc-and-networking"&gt;https://github.com/mycloudtutorials/aws-demos/tree/master/aws-vpc-and-networking&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Youtube Video:&lt;br&gt;
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/4z_-VkRg_Bs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Create and expose deployment using NodePort Service in Kubernetes</title>
      <dc:creator>Girish Jaju</dc:creator>
      <pubDate>Tue, 23 Nov 2021 07:47:27 +0000</pubDate>
      <link>https://dev.to/girishjaju/create-and-expose-deployment-using-nodeport-service-in-kubernetes-1fn4</link>
      <guid>https://dev.to/girishjaju/create-and-expose-deployment-using-nodeport-service-in-kubernetes-1fn4</guid>
      <description>&lt;p&gt;This is a practice question for Kubernetes CKA and CKAD exams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question&lt;/strong&gt;&lt;br&gt;
We have a 3 node cluster setup locally using kubeadm. We need to do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a deployment named web-deploy with the 3 replicas of image mycloudtutorials/poddeployservicedemo:latest in namespace app1&lt;br&gt;
(The Docker container is created from apache image, exposing the application on port 80)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pass the following environment variables   NODE_NAME, POD_NAME, POD_IP which are the name of the node where the pod is running, name of the pod and the ip address of the pod respectively&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify the pods are working fine, by curl to the individual pods using POD’s internal ip address&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a service for this deployment of type NodePort with name web-service in namespace app1 on port 30090&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the End points&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access the service on each of the node:port of the cluster nodes from outside of the cluster&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Answer&lt;/strong&gt;&lt;br&gt;
I have published a Youtube video for step by step solution for this question.&lt;br&gt;
You can check at&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/s2vLgDWYidw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;


&lt;div class="ltag__tag ltag__tag__id__961"&gt;
  
    .ltag__tag__id__961 .follow-action-button{
      background-color: #326de6 !important;
      color: #ffffff !important;
      border-color: #326de6 !important;
    }
  
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/kubernetes" class="ltag__tag__link"&gt;kubernetes&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
 &lt;div class="ltag__tag ltag__tag__id__168"&gt;
  
    .ltag__tag__id__168 .follow-action-button{
      background-color: #06B500 !important;
      color: #FFFFFF !important;
      border-color: #06B500 !important;
    }
  
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/devops" class="ltag__tag__link"&gt;devops&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        Content centering around the shifting left of responsibility, deconstruction of responsibility silos, and the automation of repetitive work tasks.
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
 &lt;div class="ltag__tag ltag__tag__id__37544"&gt;
  
    .ltag__tag__id__37544 .follow-action-button{
      background-color:  !important;
      color:  !important;
      border-color:  !important;
    }
  
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/cka" class="ltag__tag__link"&gt;cka&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
 &lt;div class="ltag__tag ltag__tag__id__36641"&gt;
  
    .ltag__tag__id__36641 .follow-action-button{
      background-color:  !important;
      color:  !important;
      border-color:  !important;
    }
  
    &lt;div class="ltag__tag__content"&gt;
      &lt;h2&gt;#&lt;a href="https://dev.to/t/ckad" class="ltag__tag__link"&gt;ckad&lt;/a&gt; Follow
&lt;/h2&gt;
      &lt;div class="ltag__tag__summary"&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
 

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