<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Archana Gurrewala on Medium]]></title>
        <description><![CDATA[Stories by Archana Gurrewala on Medium]]></description>
        <link>https://medium.com/@archana.gurrewala96?source=rss-4a81b0ae74c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bK6HdMNua3heuzE76OPnJQ.jpeg</url>
            <title>Stories by Archana Gurrewala on Medium</title>
            <link>https://medium.com/@archana.gurrewala96?source=rss-4a81b0ae74c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:08:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@archana.gurrewala96/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build REST API using AWS API Gateway, Lambda and RDS(MySQL)]]></title>
            <link>https://medium.com/@archana.gurrewala96/build-rest-api-using-aws-api-gateway-lambda-and-rds-mysql-bd6b895c78c9?source=rss-4a81b0ae74c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd6b895c78c9</guid>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-api-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-rds]]></category>
            <dc:creator><![CDATA[Archana Gurrewala]]></dc:creator>
            <pubDate>Mon, 07 Nov 2022 01:38:51 GMT</pubDate>
            <atom:updated>2022-11-07T01:38:51.661Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*lq91fS7cdKsaRJEQaL6ADw.png" /></figure><p>Our objective is to build REST API using AWS API Gateway, Lambda and RDS(Mysql). In our use-case we will expose our API using AWS API Gateway which triggers AWS Lambda where our application is processed and retrieves the data from RDS(Mysql) and returns to the user.</p><p>This REST API returns member details from MySQL database for given member_id.</p><p><strong>API Gateway</strong></p><p>Amazon API Gateway is an AWS service for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale.</p><p><strong>Lambda</strong></p><p>AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers.</p><p><strong>RDS</strong></p><p>Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud.</p><p>Let’s start building API using above AWS services.</p><p><strong><em>Step-1</em></strong></p><p>Let’s first create MySQL database using AWS RDS.</p><ol><li>Open RDS Service in AWS console.</li><li>Click on <strong>create database </strong>and choose <strong>MySQL</strong> in Engine Options.</li><li>Choose <strong>Free Tier</strong> in template tab.</li><li>In Setting tab enter <strong>database cluster name, Master Username and Master password.</strong></li><li>In connectivity tab select <strong>VPC</strong> where database needs to be created and <strong>enable</strong> public access.</li><li>In additional configuration enter database name.</li><li>All other tabs can have default configuration.</li></ol><p>We can access this database from our local terminal(make sure MySQL installed in local machine)</p><pre>mysql -h &lt;rds_endpoint&gt; -u &lt;rds_master_username&gt; -p</pre><p>Now we can use below queries to create and insert data into the table</p><pre>#command to create table<br>create table claims ( member_id INT NOT NULL, claim_id INT, insurance_covered INT, total_cost INT, test_code INT);</pre><pre><br>#command to insert data<br>insert into claims (member_id, claim_id, insurance_covered, total_cost, test_code) values (1,1,200,300,1);</pre><p><strong><em>Step-2</em></strong></p><p>Now let’s create lambda function.</p><ol><li>Select Lambda service in aws console.</li><li>Click on <strong>create function</strong> button.</li><li>In basic Information tab enter <strong>function name</strong> and select <strong>runtime</strong>(In my case i have selected Python 3.8)</li><li>After function creation, on left side of the screen click on configuration tab and configure <strong>VPC</strong> and <strong>security group</strong> same as RDS to communicate between Lambda and RDS.</li><li>And in permissions tab, add below additional roles to the execution role of the lambda function.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mdNMB5Dl7cIZ0esyMFF9iA.png" /></figure><p>6. In code tab, add the below code in code source -</p><pre>import json<br>import pymysql</pre><pre>hostname = &lt;rds_endpoint&gt;<br>user = &lt;rds_master_username&gt;<br>password = &lt;rds_master_password&gt;<br>db = &lt;rds_database&gt;<br>conn = pymysql.connect(host=hostname, user=user, passwd=password, db=db, connect_timeout=60)<br>claimdict = {0: &quot;member_id&quot;, 1: &quot;claim_id&quot;, 2: &quot;insurance_covered&quot;, 3: &quot;total_cost&quot;, 4: &quot;test_code&quot;}</pre><pre>def lambda_handler(event, context):</pre><pre>req_body = json.loads(event[&quot;body&quot;])<br>    with conn.cursor() as cur:<br>        print(&quot;Received member idL {}&quot;.format(req_body[&quot;member_id&quot;]))<br>        cur.execute(&quot;SELECT * from claims where member_id={}&quot;.format(req_body[&quot;member_id&quot;]))<br>        print(&quot;Query executed&quot;)<br>        claim_details = []<br>        try:<br>            # TODO: write code...<br>            for claim in cur.fetchall():<br>                claim_detail = {}<br>                for row in range(0, len(claim)):<br>                    claim_detail[claimdict[row]] = claim[row]<br>        <br>                claim_details.append(claim_detail)<br>        except Exception as e:<br>            print(e)</pre><pre>return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;headers&#39;: {<br>            &#39;Access-Control-Allow-Origin&#39;: &#39;*&#39;,<br>            &#39;Access-Control-Allow-Headers&#39;: &#39;Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token&#39;,<br>            &#39;Access-Control-Allow-Credentials&#39;: &#39;true&#39;,<br>            &#39;Content-Type&#39;: &#39;application/json&#39;<br>        },<br>        &#39;body&#39;: json.dumps(claim_details)<br>    }</pre><p>7. As we are using pymysql in our above code, we need to package this library and add as a zip file as a layer in the lambda function. To do this using below commands we can create zip file.</p><pre>pip install --target ./python pymysql</pre><pre>zip -r python.zip python</pre><p>Create layer by adding this zip file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mm6EcVulO7YXZMYufHSBNg.png" /></figure><p>Now in code tab layer section, add as a layer to the lambda function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEA_33uuPp1KOSqYWqKVQQ.png" /></figure><p><strong><em>Step-3</em></strong></p><p>Now let’s create API Gateway to expose REST Api.</p><ol><li>Select API Gateway service in aws console.</li><li>Select <strong>REST API </strong>and add <strong>api name</strong> and leave endpoint type as regional.</li><li>Now click on <strong>create resource</strong> and add <strong>resource name</strong>.</li><li>Click on <strong>create method</strong> and select <strong>method type</strong>. And configure with below details</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9Re7ct_YS5wnkaltNIa8Q.png" /></figure><p>5. Click on deploy API.</p><p>Get the API endpoint and try to hit from postman -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NTPoapQ8SU95QxfPZbRvg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd6b895c78c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Accessing multiple endpoints via Kube-Ingress using Flask]]></title>
            <link>https://medium.com/@archana.gurrewala96/kubernetes-accessing-multiple-endpoints-via-kube-ingress-using-flask-42a431276d11?source=rss-4a81b0ae74c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/42a431276d11</guid>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ingress]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Archana Gurrewala]]></dc:creator>
            <pubDate>Fri, 06 May 2022 01:12:59 GMT</pubDate>
            <atom:updated>2022-11-05T00:49:18.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QvbQTmFpgFi91g22z7599A.jpeg" /></figure><p>Kubernetes Ingress is an API object used to access services within kubernetes cluster from external world.</p><p>In this story I have deployed sample Python Flask web application which have two endpoints exposed in Kubernetes cluster.</p><p>Sample Flask Web application is:</p><p>Here I have exposed two endpoints</p><ol><li>/details</li><li>/help</li></ol><p>SampleApp.py</p><pre>from flask import Flask<br><br><br>app = Flask(__name__)<br><br><br>@app.route(&#39;/&#39;)<br>def default():<br>    return &quot;HOME PAGE&quot;<br><br><br>@app.route(&#39;/details&#39;)<br>def details():<br>    return &quot;Employment Details&quot;<br><br><br>@app.route(&#39;/help&#39;)<br>def help():<br>    return &quot;Help is Here!!&quot;<br><br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&quot;0.0.0.0&quot;, port=8000)</pre><p>Used docker to containerize python web application. Dependencies which are used in application should be given in <em>requirements.txt</em></p><p>requirements.txt is:</p><pre>Flask==2.1.2</pre><p>Dockerfile is:</p><pre>FROM python:3.8-slim-buster<br><br>ENV PYTHONUNBUFFERED=1<br><br>WORKDIR /home<br><br>COPY requirements.txt /home<br>COPY sampleApp.py /home<br>COPY entrypoint.sh /home<br><br>RUN pip install -r requirements.txt<br><br>EXPOSE 8000</pre><pre>ENTRYPOINT [&quot;./entrypoint.sh&quot;]</pre><p>entrypoint.sh is:</p><pre><strong>#!/bin/sh<br><br></strong>python /home/sampleApp.py</pre><p>Now we have to create kubernetes objects like deployment.yaml, service.yaml and ingress.yaml files to deploy application in kubernetes cluster.</p><p>deployment.yaml:</p><pre>---<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: ingress-api-deployment<br>  labels:<br>    app: ingress-api<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: ingress-api<br>  template:<br>    metadata:<br>      labels:<br>        app: ingress-api<br>    spec:<br>      containers:<br>        - name: ingress-api<br>          image: ingressApi<br>          ports:<br>            - containerPort: 8000</pre><p>service.yaml:</p><pre>apiVersion: v1<br>kind: Service<br>metadata:<br>  name: ingress-service<br>spec:<br>  ports:<br>  - port: 8000<br>    protocol: TCP<br>    targetPort: 8000<br>  selector:<br>    app: ingress-api</pre><p>ingress.yaml:</p><pre>apiVersion: networking.k8s.io/v1<br>kind: Ingress<br>metadata:<br>  name: sampleapp-ingress<br>spec:<br>  rules:<br>  - host: sampleapp.com<br>    http:<br>      paths:<br>      - path: /details<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: ingress-service<br>            port:<br>              number: 8000<br>      - path: /help<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: ingress-service<br>            port:<br>              number: 8000<br>      - path: /<br>        pathType: Prefix<br>        backend:<br>          service:<br>            name: ingress-service<br>            port:<br>              number: 8000</pre><p>We can create above files in the helm templates format and execute <em>helm install &lt;chart_name&gt; &lt;path&gt;. To know more about helm can refer to my other article </em><a href="https://medium.com/@archana.gurrewala96/introduction-to-helm-207657ad3e7f">https://medium.com/@archana.gurrewala96/introduction-to-helm-207657ad3e7f</a></p><p>Now when we execute “kubectl get ingress” we will get endpoint for this application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xV7yFpr79t1bM-cNEsX8yQ.png" /></figure><p>And this endpoint we have to give in our local path /etc/hosts.</p><p>sudo vi /etc/hosts</p><pre>10.0.0.225 sampelapp.com</pre><p>Now open any browser and type <em>sampleapp.com</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*6I2J_qf1l59AA6fqKicyXQ.png" /></figure><p>To get complete code — <a href="https://github.com/archanagurrewala96/kubernetes-helm/tree/main/kube-ingress">https://github.com/archanagurrewala96/kubernetes-helm/tree/main/kube-ingress</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42a431276d11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Creation of multiple deployments with single deployment file using Helm]]></title>
            <link>https://medium.com/@archana.gurrewala96/kubernetes-creation-of-multiple-deployments-with-single-deployment-file-using-helm-cb01796cf222?source=rss-4a81b0ae74c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb01796cf222</guid>
            <category><![CDATA[kubernetes-deployment]]></category>
            <category><![CDATA[helm-chart]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[k8s]]></category>
            <dc:creator><![CDATA[Archana Gurrewala]]></dc:creator>
            <pubDate>Thu, 28 Apr 2022 04:41:44 GMT</pubDate>
            <atom:updated>2022-04-28T04:45:22.783Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*DXKdNO_NbO4nPxZSzvjmMw.jpeg" /></figure><p>NOTE: Assuming basic helm template is created. To know more about Helm, can refer to my other article <a href="https://medium.com/@archana.gurrewala96/introduction-to-helm-207657ad3e7f">https://medium.com/@archana.gurrewala96/introduction-to-helm-207657ad3e7f</a>.</p><p>Let’s say we have use-case where in an application we need multiple pods which has same functionality but each pod differs in some variables. In this case we can declare those variables which differ for each pod in values.yaml and looped in deployment.yaml file where multiple pods can be deployed with different variable values for each pod.</p><p>Variables which differ for each pod can be given in values.yaml file as below</p><pre>details:<br>  - podname: pod1<br>    username: user1<br>  - podname: pod2<br>    username: user2</pre><p>In templates/deployment.yaml file we need to loop as below</p><pre>{{- range $details := .Values.details }}<br>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  labels:<br>    app: {{ $details.podname}}<br>  name: {{ $details.podname}}<br>spec:<br>  replicas: 1<br>  selector:<br>    matchLabels:<br>      app: {{ $details.podname}}<br>  template:<br>    metadata:<br>      labels:<br>        app: {{ $details.podname}}<br>    spec:<br>      containers:<br>      - image: gcr.io/archana-test/sample:13<br>        name: {{ $details.podname}}<br>        env:<br>          - name: Username<br>            value: {{ $details.username}}<br>---<br>{{- end }}</pre><p>My sample application code</p><pre>import time<br>import os<br><br>def print_username():<br>    while True:<br>        print(&quot;Username: {}&quot;.format(os.getenv(&quot;Username&quot;)))<br>        time.sleep(5)<br><br><br>if __name__ == &#39;__main__&#39;:<br>    print_username()</pre><p>With the above example we can create two pods with different username passed.</p><p>Output when we execute kubectl get pods</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Be21inrqNuucN09mug9jIw.png" /></figure><p>When we check pod1 logs with command kubectl logs pod1–666bcbb96-bbdz7</p><pre>Username: user1</pre><p>When we check pod2 logs with command kubectl logs pod2–69f578698f-gc6ct</p><pre>Username: user2</pre><p>To get complete code can refer my github <a href="https://github.com/archanagurrewala96/kubernetes-helm/tree/main/multiple-kube-deployments">https://github.com/archanagurrewala96/kubernetes-helm/tree/main/multiple-kube-deployments</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb01796cf222" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Helm]]></title>
            <link>https://medium.com/@archana.gurrewala96/introduction-to-helm-207657ad3e7f?source=rss-4a81b0ae74c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/207657ad3e7f</guid>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubectl]]></category>
            <category><![CDATA[helm]]></category>
            <category><![CDATA[helm-chart]]></category>
            <dc:creator><![CDATA[Archana Gurrewala]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 23:38:45 GMT</pubDate>
            <atom:updated>2022-04-18T23:42:35.858Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>NOTE </strong>— Assuming readers have bit knowledge on kubernetes.</p><p>To deploy applications in kubernetes cluster we need different kubernetes objects like deployment, services, secrets etc. And to deploy these kubernetes objects we need multiple kubectl commands which would be difficult to manage. Say we have 10 different applications and each application has almost similar configurations but change in only some parameter values. With kube commands we end up executing many and it will be difficult to manage. So we feel like if we have package manager it would make our lives easier. Here is where Helm comes into picture and it is widely used in industry as a standards.</p><p><strong>Helm </strong>is a package manager for kubernetes, used to enhance and simplify deployment experience for deploying resources in k8s cluster. It groups all yaml files needed for k8s as helm charts in templates folder( this is the place where helm finds the YAML definitions to your deployments, services and other k8s objects) which can be reusable.</p><p>We can create Helm charts by using command — helm create &lt;chart_name&gt;</p><p>With this command following folder structure will be created —</p><ul><li><strong>Chart.yaml</strong> contains all the basic information about the charts</li><li><strong>License </strong>contains license for the chart</li><li><strong>README.md</strong> is readable file</li><li><strong>values.yaml</strong> used in configuring values for the charts</li><li><strong>values.schema.json</strong> used in configuring structure for values.yaml file</li><li><strong>charts/</strong> contains different charts which are dependent on this chart</li><li><strong>templates</strong>/ contains all the yaml definitions of services, deployments and other k8s objects</li><li><strong>templates/NOTES.txt</strong> contains short usage of notes. Displayed to the user when chart is deployed successfully</li></ul><p><strong><em>Three Concepts of Helm charts are -</em></strong></p><ul><li><strong>Chart </strong>— Pre configured template of k8s resources.</li><li><strong>Release </strong>— Chart deployed to k8s cluster using helm.</li><li><strong>Repository </strong>— Publicly available charts.</li></ul><p>Workflow is to search repositories for charts and install them to k8s cluster, creating releases.</p><p><strong><em>Some useful helm commands are —</em></strong></p><ul><li>To install helm charts — helm install &lt;chart_name&gt; &lt;chart_location&gt;.</li></ul><blockquote>helm install myfirsthelm /path/to/myfirsthelmfolder wherein myfirst helm is the name of the chart and ./myfirsthelmfolder is a path where that chart is located.</blockquote><ul><li>If we want to create charts with providing dynamic values, can be done either by using — set param=value or by giving dynamic values in one yaml file and giving that file in command like — values &lt;name&gt;.yaml</li></ul><blockquote>helm install myfirsthelm /path/to/myfirsthelmfolder — set replicaCount=2</blockquote><p>values.yaml file can have</p><p>replicaCount:2</p><blockquote>helm install myfirsthelm /path/to/myfirsthelmfolder — values values.yaml</blockquote><ul><li>To validate and check yaml files — helm template &lt;chart_name&gt; &lt;chart_location&gt;</li></ul><blockquote>helm template myfirsthelm /path/to/myfirsthelmfolder</blockquote><ul><li>To list all helm releases — helm list</li><li>To upgrade — helm upgrade &lt;chart_name&gt; &lt;chart_location&gt; — values &lt;name&gt;.yaml wherein upgrades values can be in this &lt;name&gt;.yaml file.</li></ul><blockquote>helm upgrade myfirsthelm /path/to/myfirsthelmfolder — values values.yaml</blockquote><p>Hope this helps!! I will link stories of 1. Benefits of using Helm, 2. Difference between helm2 and helm3 Soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=207657ad3e7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>