<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Parikshit Chavan</title>
    <description>The latest articles on Forem by Parikshit Chavan (@brooklyn2706).</description>
    <link>https://forem.com/brooklyn2706</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%2F889768%2F1b1c10c0-49f0-4574-911c-cc51811fa4c5.JPG</url>
      <title>Forem: Parikshit Chavan</title>
      <link>https://forem.com/brooklyn2706</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/brooklyn2706"/>
    <language>en</language>
    <item>
      <title>Host Static Website on AWS for free</title>
      <dc:creator>Parikshit Chavan</dc:creator>
      <pubDate>Sun, 25 Feb 2024 14:39:46 +0000</pubDate>
      <link>https://forem.com/brooklyn2706/host-static-website-on-aws-for-free-2cad</link>
      <guid>https://forem.com/brooklyn2706/host-static-website-on-aws-for-free-2cad</guid>
      <description>&lt;p&gt;In this quick start guide, we'll walk through the steps to set up and host a static website on AWS, allowing you to showcase your content or project to the world without breaking the bank. Whether you're a developer, blogger, or just someone looking to establish an online presence, AWS provides an accessible and efficient way to deploy and manage static websites with ease. Let's dive into the process and get your website up and running on the AWS cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  Walkthrough...
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Get you a free website template quickly.&lt;/li&gt;
&lt;li&gt;Create S3 bucket &lt;/li&gt;
&lt;li&gt;Add bucket policy &lt;/li&gt;
&lt;li&gt;And your website is hosted, tadaa!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Get you a free website template quickly.
&lt;/h2&gt;

&lt;p&gt;If you have the source code for your website ready, then well, kudos to you!, but you came here in a hurry just to get your portfolio website out there, well, here I am to save you.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://html5up.net/" rel="noopener noreferrer"&gt;HTML5 Up&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pick a template..&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%2Fnjsohpez7u6qoif7ei6q.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%2Fnjsohpez7u6qoif7ei6q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit download, and the source code will get downloaded.&lt;/p&gt;

&lt;p&gt;Browse to the folder, and open it with vs code&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%2Fgow1ed2e820ya60bwu1e.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%2Fgow1ed2e820ya60bwu1e.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Edit the index.html page, add your relevant info like name, designation, that you wish to add like shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnao4r2vcvfifzsfp3olr.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%2Fnao4r2vcvfifzsfp3olr.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Save it.&lt;br&gt;
Make sure, you don't change the folder structure of the source code, if you have no idea about how all HTML, CSS, and JS are working.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create S3 bucket
&lt;/h2&gt;

&lt;p&gt;Login to your AWS account and navigate to the S3 dashboard.&lt;/p&gt;

&lt;p&gt;Click on 'Create Bucket'&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%2Fqmexrl6eyy6djsck3qcw.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%2Fqmexrl6eyy6djsck3qcw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give a unique name to your bucket.&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%2Fo3fnd2dokhiujmopc22g.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%2Fo3fnd2dokhiujmopc22g.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need to change the 'Block Public Access' setting for the bucket.&lt;br&gt;
'Uncheck the Block all public access' checkbox &lt;br&gt;
and check the 'I acknowledge.....' box, as shown in the snip below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl6bnnuokxx7t11mcid8l.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%2Fl6bnnuokxx7t11mcid8l.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit Create Bucket.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change bucket policy
&lt;/h2&gt;

&lt;p&gt;Let's add a bucket policy to our bucket, that will allow to read the objects within our AWS bucket.&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%2F9mgzv77an4z6n19vv5ap.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%2F9mgzv77an4z6n19vv5ap.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "Version": "2012-10-17",&lt;br&gt;
    "Statement": [&lt;br&gt;
        {&lt;br&gt;
            "Sid": "PublicReadGetObject",&lt;br&gt;
            "Effect": "Allow",&lt;br&gt;
            "Principal": "*",&lt;br&gt;
            "Action": "s3:GetObject",&lt;br&gt;
            "Resource": "arn:aws:s3:::bucket-name/*"&lt;br&gt;
        }]&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Copy the code and paste it in the 'Bucket Policy' section, under the Permissions tab, by clicking on Edit. Now, replace the 'bucket-name' with your bucket name.&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%2Fz159ul0peptz02kmqfqn.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%2Fz159ul0peptz02kmqfqn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add source code to the bucket
&lt;/h2&gt;

&lt;p&gt;Go back to the 'Objects' section. Click Upload.&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%2Fxxwu40lw8m3v4w1c8nwx.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%2Fxxwu40lw8m3v4w1c8nwx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we will be uploading the files and folders that are present in our source code for our website. &lt;br&gt;
First, we will upload the files. Click on Add files. &lt;/p&gt;

&lt;p&gt;Select the files that are present in the source code folder. &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%2Fzknq1tc1lc46sgszc0ew.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%2Fzknq1tc1lc46sgszc0ew.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After selecting the files, click Upload. &lt;/p&gt;

&lt;p&gt;All the files will appear in front of you as Objects. &lt;/p&gt;

&lt;p&gt;Now let us upload folders that are present in our source code folder in a similar fashion as done above.&lt;/p&gt;

&lt;p&gt;Now the bucket will look something like this...&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%2Faa8bhb5j1ck2gnc5pxqy.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%2Faa8bhb5j1ck2gnc5pxqy.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the URL for your bucket
&lt;/h2&gt;

&lt;p&gt;Go to the 'Properties' section, scroll down to 'Static Website Hosting'&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%2Fa0cgyek6hshfbpfxbyix.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%2Fa0cgyek6hshfbpfxbyix.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo9zibegfg9vh92ywti97.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%2Fo9zibegfg9vh92ywti97.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the link, and open it in the new browser, wohoooo! your website is now hosted! For FREE! &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%2Fjncmi4fon93fwgzqy3yi.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%2Fjncmi4fon93fwgzqy3yi.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And it's done! &lt;/p&gt;

&lt;p&gt;Thank you for reading!!&lt;br&gt;
Give a like, and share it with your folks!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>website</category>
    </item>
    <item>
      <title>Copying local file/directory to the k8s pod</title>
      <dc:creator>Parikshit Chavan</dc:creator>
      <pubDate>Fri, 24 Nov 2023 06:43:34 +0000</pubDate>
      <link>https://forem.com/brooklyn2706/copying-local-filedirectory-to-the-k8s-pod-42b7</link>
      <guid>https://forem.com/brooklyn2706/copying-local-filedirectory-to-the-k8s-pod-42b7</guid>
      <description>&lt;p&gt;When there comes a scenario when you have to copy any file or directory to the kubernetes pod, make it available for the application. Lets say, you have a folder that have videos that you want to make available in the pod. &lt;/p&gt;

&lt;p&gt;Let's see a simple way to it.&lt;/p&gt;

&lt;p&gt;let me show you my current pod where i want to upload a directory.&lt;/p&gt;

&lt;p&gt;use&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 pods
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kNd35JW_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw7x9w5puzuz56q1mo2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kNd35JW_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw7x9w5puzuz56q1mo2h.png" alt="Listing out our pods" width="800" height="91"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;here, you can see the &lt;strong&gt;app1-fdc77f597-nn598&lt;/strong&gt; pod, where we will upload a file. &lt;/p&gt;

&lt;p&gt;Use this command to exec inside the pod,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl exec -it app1-fdc77f597-nn598 -- /bin/sh&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I will be copying my videos folder from the host machine to this pod directory.&lt;/p&gt;

&lt;p&gt;lets copy this pod directory, which we will use later, &lt;br&gt;
use &lt;strong&gt;pwd&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;/app&lt;/strong&gt; is the &lt;em&gt;pod-path&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Lets &lt;strong&gt;exit&lt;/strong&gt; from the pod and look what we have in the host machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[parikshit@parikshit videos]$ ls
sample-vid-1.mp4  sample-vid-2.mp4

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

&lt;/div&gt;



&lt;p&gt;i have these videos that needs to be uploaded. &lt;br&gt;
let take the &lt;em&gt;local-path&lt;/em&gt;, by using &lt;strong&gt;pwd&lt;/strong&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;[parikshit@parikshit videos]$ pwd
/home/parikshit/folder1/videos

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

&lt;/div&gt;



&lt;p&gt;this is our &lt;em&gt;loacl-path&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Now lets copy to our pod
&lt;/h2&gt;

&lt;p&gt;we will be using following command &lt;br&gt;
&lt;code&gt;kubectl cp &amp;lt;local-path&amp;gt; &amp;lt;pod-name&amp;gt;:&amp;lt;pod-path&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
so our command will be&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl cp /home/parikshit/folder1/videos app1-fdc77f597-nn598:/app&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After it gets executed, just get inside our pod, and check our &lt;strong&gt;/app/videos/&lt;/strong&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kubectl exec -it app1-fdc77f597-nn598 -- /bin/sh&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;And we see all our videos inside the pod. &lt;/p&gt;

&lt;p&gt;Like and share the post, if it was helpful.&lt;br&gt;
Happy Coding ! :)&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>pods</category>
      <category>containers</category>
    </item>
    <item>
      <title>Triggering Lambda function with Application Load Balancer</title>
      <dc:creator>Parikshit Chavan</dc:creator>
      <pubDate>Mon, 20 Nov 2023 16:54:47 +0000</pubDate>
      <link>https://forem.com/brooklyn2706/triggering-lambda-function-with-application-load-balancer-2947</link>
      <guid>https://forem.com/brooklyn2706/triggering-lambda-function-with-application-load-balancer-2947</guid>
      <description>&lt;p&gt;This is a basic hands-on on triggering AWS Lambda function via Application Load Balancer DNS. &lt;/p&gt;

&lt;p&gt;So, here is what we are going to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Lambda function &lt;/li&gt;
&lt;li&gt;Create an ALB (application load balancer) &lt;/li&gt;
&lt;li&gt;Create a target group for the ALB&lt;/li&gt;
&lt;li&gt;Set our Lambda function as the target grp &lt;/li&gt;
&lt;li&gt;Trigger the lambda function and return the response whenever the user clicks the load balancer DNS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe1x6af9zgsh9csl223r1.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%2Fe1x6af9zgsh9csl223r1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before diving into the hands-on, lets take a moment to understand what we are doing and what its being called.&lt;/p&gt;

&lt;h2&gt;
  
  
  Synchronous Invocation
&lt;/h2&gt;

&lt;p&gt;The concept of synchronous invocation typically refers to invoking a Lambda function and waiting for the response in a synchronous manner, where the calling application or service waits for the Lambda function to complete and returns the result immediately.&lt;/p&gt;

&lt;p&gt;User invocations: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Elastic Load balancer&lt;/li&gt;
&lt;li&gt;API Gateway &lt;/li&gt;
&lt;li&gt;CloudFront &lt;/li&gt;
&lt;li&gt;S3 batch&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Create a lambda function
&lt;/h2&gt;

&lt;p&gt;Login to your AWS Management console, and go the Lambda service.&lt;br&gt;
Click on *&lt;em&gt;Create function *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqj0d7bt1fhjc8aw6r4u.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%2Fdqj0d7bt1fhjc8aw6r4u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter the details like function name, choose Python as the runtime language and leave the rest setting as it is. &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%2Fgia3520wedy1ddesbd1u.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%2Fgia3520wedy1ddesbd1u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will be the sample code that will be present.&lt;br&gt;
We can change the return statement to anything you like:&lt;br&gt;
 &lt;code&gt;body': json.dumps('Hello from Lambda! this is Parikshit ! ')&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating ALB
&lt;/h2&gt;

&lt;p&gt;Navigate to Load Balancer service in the management console&lt;br&gt;
Select Application Load Balancer.&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%2F7tcvp3d4pgoz1m7rwiev.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%2F7tcvp3d4pgoz1m7rwiev.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fill in the details as given in the image&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Network Mapping&lt;/strong&gt; , select all the checkboxes, i.e we are selecting all the AZs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's create a new security group&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a new security group, which has &lt;em&gt;&lt;strong&gt;http&lt;/strong&gt;&lt;/em&gt; incoming traffic from any address (0.0.0.0)&lt;br&gt;
And default outgoing traffic. &lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Target Group
&lt;/h2&gt;

&lt;p&gt;In the listeners and routing section,&lt;br&gt;
our target group for the ALB is the Lambda function that we created.&lt;br&gt;
Click on the &lt;strong&gt;&lt;em&gt;create new target group&lt;/em&gt;&lt;/strong&gt; , select the Lambda function. &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%2F5ovq0jffsnco6tezuly0.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%2F5ovq0jffsnco6tezuly0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As mentioned above, give the target group name. &lt;br&gt;
Click Next &lt;/p&gt;

&lt;p&gt;In the &lt;strong&gt;Registering Target Group&lt;/strong&gt;, select our Lambda function that we created. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv48ljyhcmmxn204n94bu.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%2Fv48ljyhcmmxn204n94bu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;em&gt;&lt;strong&gt;Create target group&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now back to our &lt;em&gt;Create application load balancer page&lt;/em&gt;, hit refresh and select our new target group that we just created.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0i7gc3iv7c96u3a74oqc.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%2F0i7gc3iv7c96u3a74oqc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep rest configuration to default and click on &lt;strong&gt;&lt;em&gt;Create load balancer&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can view the load balancer. It may take some time to provision. &lt;/p&gt;

&lt;p&gt;Now, you can go the load balancer that you created, it will look something like this...&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%2Fotmhihxtzhpl28c3p0j0.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%2Fotmhihxtzhpl28c3p0j0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the DNS name for the ALB and paste it into the browser. &lt;br&gt;
A file will get downloaded, which is the response.txt for our lambda function. &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%2F8nvm1emlebjfr9jy4dg4.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%2F8nvm1emlebjfr9jy4dg4.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can make changes to our lambda function, and print whatever you want. After making any changes, you will have to save the test event, give it a name, and hit &lt;strong&gt;&lt;em&gt;deploy&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting the response on the ALB Webpage
&lt;/h2&gt;

&lt;p&gt;Finally, we don't want to have our lambda function response downloaded in a text file, instead, we will display it on our ALB endpoint webpage. &lt;/p&gt;

&lt;p&gt;To do this go to &lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;OR&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Just past the below code&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    "statusCode": 200,&lt;br&gt;
    "statusDescription": "200 OK",&lt;br&gt;
    "isBase64Encoded": False,&lt;br&gt;
    "headers": {&lt;br&gt;
        "Content-Type": "text/html"&lt;br&gt;
    },&lt;br&gt;
    "body": "&amp;lt;h1&amp;gt;Hello from Lambda!&amp;lt;/h1&amp;gt;"&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In our Lambda function, paste this in our return statement.&lt;br&gt;
&lt;em&gt;Note: isbase64Encoded : False, is with F capital&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliu0991yle5uf8f5p201.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%2Fliu0991yle5uf8f5p201.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;&lt;em&gt;deploy&lt;/em&gt;&lt;/strong&gt; &lt;br&gt;
Hit the endpoint again. &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%2Fzr6xlhmvj8mz5j8lzp9q.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%2Fzr6xlhmvj8mz5j8lzp9q.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&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%2Ftx4q0viqmh1dsnohxr5u.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%2Ftx4q0viqmh1dsnohxr5u.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, we Trigger our lambda function whenever we hit the ALB endpoint, and the response is displayed on the webpage.&lt;/p&gt;

&lt;p&gt;You can monitor how many times the function has been invoked in the &lt;strong&gt;&lt;em&gt;Monitor&lt;/em&gt;&lt;/strong&gt; tab for the lambda function. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>beginners</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
