<?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 Rohit Jain on Medium]]></title>
        <description><![CDATA[Stories by Rohit Jain on Medium]]></description>
        <link>https://medium.com/@rj03012002?source=rss-77d24d2bab3c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0xT2qsnkXVV0COQ_uwMhhA.jpeg</url>
            <title>Stories by Rohit Jain on Medium</title>
            <link>https://medium.com/@rj03012002?source=rss-77d24d2bab3c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:19:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rj03012002/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[Inspect Rich Documents with Gemini Multimodality and Multimodal RAG: My Key Learnings]]></title>
            <link>https://medium.com/@rj03012002/inspect-rich-documents-with-gemini-multimodality-and-multimodal-rag-my-key-learnings-e665ec91b81e?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e665ec91b81e</guid>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 03 May 2025 08:47:58 GMT</pubDate>
            <atom:updated>2025-05-03T08:50:01.126Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently completed the “Inspect Rich Documents with Gemini Multimodality and Multimodal RAG” skill badge by Google Cloud. This course provided a practical deep dive into how generative AI models can work with both text and visual inputs to extract, reason, and retrieve insights more effectively than traditional text-based models. Here’s what I learned across the labs and the challenge exercise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*w5gwETYkz11ObeT6U5g80g.png" /></figure><h3>1. Multimodality with Gemini</h3><p>This lab introduced me to <strong>Gemini</strong>, Google’s family of multimodal generative AI models. Using the Gemini API in Vertex AI, I learned how to build prompts that take both text and images as input. This allowed the model to:</p><ul><li>Detect objects within an image</li><li>Understand user interfaces</li><li>Interpret diagrams</li><li>Compare visual differences and similarities</li><li>Process and describe videos</li></ul><p>The video processing capabilities were particularly interesting. The Gemini model could generate high-level video descriptions, extract meaningful tags, and answer questions about the video content based on context.</p><h3>2. Using Gemini for Multimodal Retail Recommendations</h3><p>In this lab, I applied Gemini’s capabilities to a <strong>retail recommendation use case</strong>. The task began with a visual scene, such as a living room image, and the Gemini model was used to understand the scene and make contextual product recommendations — for example, selecting a matching chair from a product catalog.</p><p>Key takeaways:</p><ul><li>Gemini could not only recommend relevant products but also explain <em>why</em> they were selected</li><li>The multimodal approach (visual + textual) made the recommendations feel more intuitive and useful</li><li>It demonstrated how multimodal GenAI can enhance digital shopping experiences by combining scene understanding with product metadata</li></ul><h3>3. Multimodal Retrieval Augmented Generation (RAG) with Gemini</h3><p>This lab explored how <strong>Retrieval Augmented Generation (RAG)</strong> can be expanded using multimodal inputs. Traditional RAG pipelines focus on text, but <strong>multimodal RAG</strong> brings in additional layers of understanding by incorporating visual content.</p><p>Here’s what I practiced:</p><ul><li>Creating document embeddings using both text and images</li><li>Building a search engine that could retrieve the most relevant content from financial documents</li><li>Performing Q&amp;A over rich documents with citations, grounding, and contextual awareness</li></ul><p>Why multimodal RAG stood out:</p><ul><li>It improves the model’s ability to reason across modalities (e.g., reading a chart and interpreting the text around it)</li><li>It reduces hallucinations by grounding responses in retrieved content</li><li>It enhances information access by leveraging both textual and visual cues</li></ul><h3>4. Challenge Lab: Real-World Testing</h3><p>The final lab combined all concepts into a practical test. I was asked to:</p><ul><li>Extract information from rich documents using multimodal prompts</li><li>Generate a description for a video and retrieve additional context beyond what was visible</li><li>Work with documents that had both images and text to build a metadata framework</li><li>Retrieve relevant text chunks and output accurate citations using multimodal RAG</li></ul><p>This lab helped me reinforce both the technical and strategic aspects of working with generative AI in enterprise settings.</p><h3>What I Learned</h3><ul><li><strong>Gemini is a powerful multimodal model</strong> capable of understanding and reasoning with images, text, and videos.</li><li><strong>Multimodal RAG</strong> significantly enhances document intelligence by incorporating both visual and textual understanding.</li><li>The combination of <strong>retrieval, grounding, and generation</strong> helps create more accurate and trustworthy AI outputs.</li><li>These techniques are highly applicable to industries like retail, finance, legal, and education, where documents often contain a mix of charts, text, and visual assets.</li></ul><h3>Final Thoughts</h3><p>The “Inspect Rich Documents with Gemini Multimodality and Multimodal RAG” badge gave me a comprehensive understanding of how to work with advanced generative AI workflows. From analyzing images to answering questions about videos and retrieving information from complex documents, the experience expanded my perspective on what’s possible with modern AI.</p><p>If you’re exploring how GenAI can support tasks like content analysis, recommendation systems, or document intelligence, I highly recommend diving into this learning path.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e665ec91b81e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop GenAI Apps with Gemini and Streamlit: My Learning Journey]]></title>
            <link>https://medium.com/@rj03012002/develop-genai-apps-with-gemini-and-streamlit-my-learning-journey-5a0baea50b85?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a0baea50b85</guid>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 03 May 2025 07:52:08 GMT</pubDate>
            <atom:updated>2025-05-03T07:52:08.446Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently completed the <em>“Develop GenAI Apps with Gemini and Streamlit”</em> skill badge by Google Cloud. This course gave me hands-on experience in building, testing, and deploying generative AI applications using Gemini, the Vertex AI platform, and Streamlit. In this blog, I’ll walk you through the key components of the course, what I learned, and how everything came together in the final challenge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*xt9rUkHe0GSWnqw80qMj7w.png" /></figure><p><strong>1. Getting Started with the Gemini API using cURL</strong></p><p>This lab was a low-code introduction to Gemini’s capabilities. I learned how to interact with the Gemini 2.0 Flash model using cURL commands directly from the terminal.</p><p>Key takeaways:</p><ul><li>How to send text prompts and receive AI-generated text responses</li><li>How to adjust model parameters like temperature and max tokens</li><li>How to work with different input types such as images and videos</li><li>How to simulate chat-style conversations with the model</li></ul><p>It was a great way to understand the raw API functionality before diving into SDKs and app development.</p><p><strong>2. Introduction to Function Calling with Gemini</strong></p><p>Function calling was one of the most interesting parts of the course. It allows developers to describe a function and let the Gemini model decide when and how to call it, passing the right arguments automatically.</p><p>Here’s what I learned:</p><ul><li>Function calling returns JSON with the function name and arguments</li><li>It’s useful for scenarios like tool selection, dynamic task routing, or API integration</li><li>It differs from Vertex AI Extensions, which directly invoke the function, while function calling just returns data for the developer to use</li></ul><p>This opens up advanced interaction patterns between LLMs and software logic.</p><p><strong>3. Getting Started with the Gemini API in Vertex AI (Python SDK)</strong></p><p>This lab introduced me to using the Gemini API with the Vertex AI SDK for Python. It was more developer-friendly and allowed for more control over inputs and outputs.</p><p>What I practiced:</p><ul><li>Generating responses using text, images, and videos as input</li><li>Applying configuration options to influence model behavior</li><li>Using Python to run multiple test scenarios for different use cases</li></ul><p>This built a strong foundation for integrating Gemini into any Python-based AI application.</p><p><strong>4. Building and Deploying a GenAI App with Streamlit and Cloud Run</strong></p><p>This lab was where things got real. I used <strong>Streamlit</strong> to build a user-friendly web interface and <strong>Cloud Run</strong> to deploy the application.</p><p>The process included:</p><ul><li>Creating a Streamlit app that takes user input and uses Gemini to generate AI content (in this case, stories)</li><li>Testing the app locally in <strong>Cloud Shell</strong></li><li>Writing a <strong>Dockerfile</strong>, containerizing the app, and pushing the image to <strong>Artifact Registry</strong></li><li>Deploying the app on <strong>Cloud Run</strong> for scalable, serverless hosting</li></ul><p>This gave me end-to-end experience in deploying a full-stack GenAI app.</p><p><strong>5. Challenge Lab: Putting It All Together</strong></p><p>The final lab was a hands-on test of everything I’d learned. My tasks included:</p><ul><li>Using cURL to test a prompt with the Gemini API</li><li>Completing a Python file (chef.py) using Streamlit and prompt logic</li><li>Testing the app functionality</li><li>Modifying the Dockerfile and building a container image</li><li>Pushing the image to Artifact Registry and deploying it to Cloud Run</li></ul><p>It was a great way to validate all the skills in one go and build confidence in real-world deployment workflows.</p><p><strong>Key Learnings</strong></p><ul><li>The Gemini API supports rich multimodal inputs and flexible configurations</li><li>Function calling bridges the gap between AI outputs and programmatic action</li><li>Streamlit is a powerful tool for building GenAI interfaces quickly</li><li>Cloud Run enables smooth, scalable deployment with minimal overhead</li></ul><p><strong>Final Thoughts</strong></p><p>This course helped me go beyond experimentation and build deployable GenAI apps. From API testing with cURL to creating a web interface and deploying it in the cloud, it gave me a practical blueprint for building modern AI solutions.</p><p>If you’re a developer interested in bringing generative AI to real applications, I highly recommend exploring this pathway with Vertex AI, Gemini, and Streamlit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a0baea50b85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I Learned from the “Prompt Design in Vertex AI” Course by Google Cloud]]></title>
            <link>https://medium.com/@rj03012002/what-i-learned-from-the-prompt-design-in-vertex-ai-course-by-google-cloud-f5c444ffab1d?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5c444ffab1d</guid>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 03 May 2025 07:39:31 GMT</pubDate>
            <atom:updated>2025-05-03T07:39:31.388Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently completed the “Prompt Design in Vertex AI” skill badge by Google Cloud. This course was a deep dive into the world of prompt engineering and generative AI using Google’s Vertex AI platform and Gemini models. Through a series of labs, I learned how to craft effective prompts, work with multimodal inputs, and apply generative AI techniques in real-world scenarios like marketing and content generation.</p><p>Here’s a breakdown of what I learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*AAsuiMNB04ZvPXrrM22Pmw.png" /></figure><h3>Generative AI with Vertex AI: Prompt Design</h3><p>This lab focused on the basics of prompt engineering using the Google GenAI SDK. It emphasized how to design prompts that are concise, specific, and task-focused. I practiced using prompt design techniques for various text generation tasks including:</p><ul><li>Ideation</li><li>Question answering</li><li>Text classification</li><li>Text extraction</li><li>Text summarization</li></ul><p>These tasks helped me understand how prompt design can be tailored for different business and technical needs.</p><h3>Get Started with Vertex AI Studio</h3><p>In this lab, I explored the capabilities of Vertex AI Studio, especially for working with multimodal content. I learned how to:</p><ul><li>Analyze images using Gemini multimodal models</li><li>Design prompts that use examples to guide output</li><li>Add contextual information to improve prompt accuracy</li></ul><p>This lab showed me how combining different data types, like text and images, can create more intelligent and flexible AI applications.</p><h3>Getting Started with the Gemini API in Vertex AI</h3><p>This lab introduced me to using the Gemini 2.0 Flash model via the Vertex AI SDK for Python. I learned how to:</p><ul><li>Send text prompts and receive generated responses</li><li>Use configuration settings to guide output style and tone</li><li>Generate text using both text and image inputs</li><li>Generate text from video combined with text prompts</li></ul><p>This hands-on experience using the Gemini API gave me the confidence to begin building real-world generative AI applications in Python.</p><h3>Prompt Design in Vertex AI: Challenge Lab</h3><p>The final lab tested everything I had learned. I was asked to:</p><ul><li>Craft effective prompts with well-defined parameters</li><li>Generate product descriptions and taglines for marketing use cases</li><li>Export and analyze Python code from Vertex AI Studio</li><li>Modify and run generative AI code in Jupyter Notebooks</li></ul><p>This lab helped solidify my understanding of both prompt engineering and the technical implementation behind the scenes.</p><h3>Key Takeaways</h3><ul><li>Prompt engineering is a skill that significantly affects the quality of generative AI outputs</li><li>Vertex AI provides a powerful set of tools to build and test AI solutions quickly</li><li>Multimodal inputs (text, image, video) open up exciting possibilities for real-world applications</li><li>With a basic understanding of Python, it’s easy to integrate GenAI models into custom workflows</li></ul><h3>Final Thoughts</h3><p>Completing this course gave me a practical and clear understanding of prompt design and the capabilities of Google’s generative AI stack. I now feel more confident in building smart, AI-powered applications using the tools available in Vertex AI.</p><p>If you’re interested in prompt engineering or generative AI, I highly recommend taking this course. It’s hands-on, well-structured, and provides real-world context to help you apply what you learn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5c444ffab1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a Star Rating Component in React: A CSS Deep Dive]]></title>
            <link>https://medium.com/@rj03012002/creating-a-star-rating-component-in-react-a-css-deep-dive-d376e6d99ea9?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d376e6d99ea9</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[star-rating]]></category>
            <category><![CDATA[frontend-machine-coding]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 11:38:51 GMT</pubDate>
            <atom:updated>2024-08-11T11:38:51.970Z</atom:updated>
            <content:encoded><![CDATA[<p>Star rating components are widely used in modern web applications for gathering user feedback, particularly on e-commerce websites, blogs, or review platforms. In this blog, I will walk you through the process of creating a star rating component using React. We’ll break down the code line by line, explaining every part in detail. By the end of this tutorial, you’ll have a functional and stylish star rating component that you can integrate into your projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kw24LrRX_DrDOsy9_9NNTw.png" /></figure><h3>Demo</h3><p>Before we dive into the code, you can check out the <a href="https://frontend-machine-coding-problems.netlify.app/">live demo</a> and the <a href="https://github.com/Rohit0301/Frontend-Machine-Coding-Round/tree/master/src/Ratings">GitHub repository</a> for the full project. Feel free to explore and fork the repo for your own use!</p><h3>1. Project Setup</h3><p>First, let’s start by setting up a basic React project. If you haven’t already, you can create a new React app using the following command:</p><pre>npx create-react-app star-rating-component<br>cd star-rating-component</pre><h3>2. Creating the Star Rating Component</h3><p>Let’s start by creating a simple React component for the star rating. Here is the complete code for our Ratings component.</p><p><strong>Ratings.jsx</strong></p><pre>import React from &quot;react&quot;;<br>import &#39;./style.css&#39;;<br><br>export default function Ratings() {<br>    return (<br>        &lt;div className=&quot;rating&quot;&gt;<br>            &lt;input id=&quot;star-1&quot; type=&quot;radio&quot; name=&quot;rating&quot; /&gt;<br>            &lt;label htmlFor=&quot;star-1&quot;&gt;★&lt;/label&gt;<br>            &lt;input id=&quot;star-2&quot; type=&quot;radio&quot; name=&quot;rating&quot; /&gt;<br>            &lt;label htmlFor=&quot;star-2&quot;&gt;★&lt;/label&gt;<br>            &lt;input id=&quot;star-3&quot; type=&quot;radio&quot; name=&quot;rating&quot; /&gt;<br>            &lt;label htmlFor=&quot;star-3&quot;&gt;★&lt;/label&gt;<br>            &lt;input id=&quot;star-4&quot; type=&quot;radio&quot; name=&quot;rating&quot; /&gt;<br>            &lt;label htmlFor=&quot;star-4&quot;&gt;★&lt;/label&gt;<br>            &lt;input id=&quot;star-5&quot; type=&quot;radio&quot; name=&quot;rating&quot; /&gt;<br>            &lt;label htmlFor=&quot;star-5&quot;&gt;★&lt;/label&gt;<br>        &lt;/div&gt;<br>    );<br>}<br></pre><h3>Why Use Radio Buttons for Star Ratings?</h3><p>In our star rating component, radio buttons are used for several reasons:</p><ol><li><strong>Single Selection</strong>: Radio buttons allow users to select only one option from a group. This is exactly what we need for a star rating, where a user should be able to select a rating from 1 to 5 stars but not multiple ratings simultaneously.</li><li><strong>Accessibility</strong>: Radio buttons are inherently accessible, providing built-in keyboard navigation and screen reader support. This ensures that our star rating component is usable by everyone, including those relying on assistive technologies.</li><li><strong>Form Integration</strong>: If your rating component is part of a form, radio buttons allow the selected rating to be easily submitted as form data, making it straightforward to handle on the backend.</li></ol><p>The radio buttons are visually hidden, and the stars themselves are clickable labels associated with each radio button. This gives the illusion of clicking on stars, while under the hood, the radio button captures the rating value.</p><h3><strong>3. CSS: Styling the Star Rating Component</strong></h3><p><strong>style.css</strong></p><pre><br>.rating:not(:checked)&gt;label {<br>    color: #ccc;<br>}<br><br>.rating {<br>    gap: 4px;<br>    display: flex;<br>    flex-direction: row-reverse;<br>    justify-content: start;<br>}<br><br>.rating label {<br>    cursor: pointer;<br>    transition: color 0.2s ease;<br>}<br><br>.rating label {<br>    font-size: 36px;<br>}<br><br>input[type=&quot;radio&quot;] {<br>    display: none;<br>}<br><br>.rating&gt;input:checked~label {<br>    color: orange<br>}<br><br>.rating:hover input:checked~label {<br>    color: #ccc;<br>}<br><br>.rating&gt;label:hover,<br>.rating&gt;label:hover~label {<br>    color: orange !important;<br>}</pre><p>Let’s break down what each part of the CSS does.</p><pre>.rating:not(:checked)&gt;label {<br>    color: #ccc;<br>}</pre><ul><li><strong>rating:not(:checked)&gt;label { color: #ccc; }</strong>: This CSS rule ensures that any label inside the .rating div that is not associated with a checked radio button will have a grey color (#ccc). This gives the unselected stars a faded appearance.</li></ul><pre>.rating {<br>    gap: 4px;<br>    display: flex;<br>    flex-direction: row-reverse;<br>    justify-content: start;<br>}</pre><ul><li><strong>.rating { display: flex; flex-direction: row-reverse; }</strong>: Here, we are using flexbox to layout the stars. The row-reverse direction is used to make sure that the stars appear from right to left.</li></ul><pre>.rating&gt;input:checked~label {<br>    color: orange;<br>}</pre><ul><li><strong>input:checked~label { color: orange; }</strong>: When a radio button is checked, this CSS rule changes the color of the associated label and all previous labels to orange. This creates the effect of a filled star.</li></ul><pre>.rating:hover input:checked~label {<br>    color: #ccc;<br>}</pre><ul><li><strong>rating:hover input:checked~label { color: #ccc; }</strong>: When hovering over the rating component, this rule resets all stars to grey, ensuring that the hover effect works correctly.</li></ul><pre>.rating&gt;label:hover,<br>.rating&gt;label:hover~label {<br>    color: orange !important;<br>}</pre><ul><li><strong>.rating&gt;label:hover, .rating&gt;label:hover~label { color: orange !important; }</strong>: This rule changes the color of the hovered star and all previous stars to orange, creating an interactive effect when hovering over different stars.</li></ul><h3>4. Use This Component in App.js file</h3><p><strong>App.js</strong></p><pre>import React from &quot;react&quot;;<br>import Ratings from &quot;./Ratings&quot;; <br>import &#39;./App.css&#39;; <br><br>function App() {<br>  return (<br>    &lt;div className=&quot;App&gt;<br>      &lt;Ratings /&gt;  <br>   &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><h3>5. Conclusion</h3><p>Congratulations! You’ve just built a fully functional star rating component using React and CSS. This component can be easily integrated into any of your projects. Whether you are building a review system or just need a user-friendly rating interface, this solution is both elegant and easy to implement.</p><p>Feel free to leave any questions or comments below. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d376e6d99ea9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing a serverless architecture for initiating and terminating EC2 instances on a scheduled…]]></title>
            <link>https://medium.com/@rj03012002/implementing-a-serverless-architecture-for-initiating-and-terminating-ec2-instances-on-a-scheduled-68531b30cb18?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/68531b30cb18</guid>
            <category><![CDATA[lambda-function]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[eventbridge]]></category>
            <category><![CDATA[serverental]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 16 Sep 2023 09:14:25 GMT</pubDate>
            <atom:updated>2023-09-16T09:14:25.105Z</atom:updated>
            <content:encoded><![CDATA[<h3>Implementing a serverless architecture for initiating and terminating EC2 instances on a scheduled basis.</h3><p>Suppose we have several EC2 servers, such as testing servers, that are currently running continuously despite only being needed during office hours. This continuous operation leads to increased EC2 costs. We are seeking an architecture solution that operates these instances solely during office hours and places them in a stopped state outside of these hours. Today, we will design and implement such an architecture that automates the starting and stopping of EC2 instances based on a predefined schedule. This architecture effectively manages your AWS billing by reducing instance costs during non-office hours while ensuring availability during the required times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pTePVdvHia5rRb133rANkg.png" /></figure><h4>Key Points:</h4><ol><li>Develop a Lambda Function</li><li>Establish Event Bridge Schedules</li><li>Configure SES (Simple Email Service)</li><li>Compute EC2 Costs</li></ol><h4>Develop a Lambda Function</h4><p>Go to the lambda function dashboard and create a lambda function by entering the function name and selecting the programming language (e.g. Python). You need to fill in some details in the lambda function given below such as aws-region your ec2 instance id, and to and from email address.</p><p>After creating the lambda function give EC2 and SES access to your lambda function. For testing purposes, you can give full access of EC2 and SES.</p><pre>import json<br>import boto3<br><br>region = &#39;&lt;region_name&gt;&#39;<br>instances = [&#39;&lt;instance_id_1&gt;&#39;]<br>ec2 = boto3.client(&#39;ec2&#39;, region_name=region)<br>ses = boto3.client(&#39;ses&#39;, region_name=region)<br><br>def lambda_handler(event, context):<br>    email_body = &#39;&#39;<br>    <br>    if event[&quot;action&quot;] == &quot;start_instance&quot;:<br>        try:<br>            ec2.start_instances(InstanceIds=instances)<br>            email_body = &quot;Your instance {} has started successfully&quot;.format(instances[0])<br>        except Exception as e:<br>            email_body = &quot;Your instance {} failed to start: {}&quot;.format(instances[0], str(e))<br>    elif event[&quot;action&quot;] == &quot;stop_instance&quot;:<br>        try:<br>            ec2.stop_instances(InstanceIds=instances)<br>            email_body = &quot;Your instance {} has stopped successfully&quot;.format(instances[0])<br>        except Exception as e:<br>            email_body = &quot;Your instance {} failed to stop: {}&quot;.format(instances[0], str(e))<br>    else:<br>        email_body = &quot;You have sent a wrong payload to Lambda!&quot;<br>    <br>    return send_email(email_body)<br><br>def send_email(email_body):<br>    try:<br>        response = ses.send_email(<br>            Destination={<br>                &quot;ToAddresses&quot;: [&quot;&lt;to_email_address&gt;&quot;]<br>            },<br>            Message={<br>                &quot;Body&quot;: {<br>                    &quot;Text&quot;: {<br>                        &quot;Charset&quot;: &quot;UTF-8&quot;,<br>                        &quot;Data&quot;: email_body,<br>                    }<br>                },<br>                &quot;Subject&quot;: {<br>                    &quot;Charset&quot;: &quot;UTF-8&quot;,<br>                    &quot;Data&quot;: &quot;EC2 Instance Status&quot;,<br>                },<br>            },<br>            Source=&quot;&lt;source_email_address&gt;&quot;<br>        )<br><br>        return {<br>            &quot;statusCode&quot;: 200,<br>            &quot;body&quot;: json.dumps(&quot;Email Sent Successfully. MessageId is: &quot; + response[&#39;MessageId&#39;])<br>        }<br>    except Exception as e:<br>        return {<br>            &quot;statusCode&quot;: 500,<br>            &quot;body&quot;: json.dumps(&quot;Something went wrong while sending the email: &quot; + str(e))<br>        }</pre><h4>Establish Event Bridge Schedules</h4><p>Go to the Aws EventBridge dashboard select schedules from the sidebar and then click on Create Schedule button. Then Enter the name of the schedule (e.g. Instance start schedule), then in the occurrence section select Recurring schedule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK76Ph8vaVv1F4KaWNyLBQ.png" /></figure><p>Now, select the schedule type to Cron-based schedule and write the cron expression. Also, select the flexible time window. (This cron will run Monday to Friday at 10:00 AM). Then click on the next button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dssWksMJGeRn5y4jVOI5hA.png" /></figure><p>Now, select the lambda from the given target and then select the lambda function which you have created above and enter the payload for that lambda.</p><pre>{<br>    &quot;action&quot;: &quot;start_instance&quot;<br>}</pre><p>Now, the next button two times review the changes and create the schedule. After creating this schedule you need to create one more schedule for stopping the instance with the below payload.</p><pre>{<br>    &quot;action&quot;: &quot;stop_instance&quot;<br>}</pre><h4>Configure SES (Simple Email Service)</h4><p>Go to the SES console, click on the Create identity button, enter your email ID and create the identity. Create an identity for your to and from email address which you have entered in the lambda function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uEQBKI9oJqOJIGZsI6NZRg.png" /></figure><h4>Compute EC2 Costs</h4><p>Suppose you have six EC2 instances of type t2.micro running continuously every day for 24 hours. For one instance it will cost around $8.5/month, so for 6 instances the total cost will be $51/month.</p><p>Now using this architecture your instance will only run 8 hours/day. So for one instance, it will cost around $ 2.833/month (including weekends), so for 6 instances the total cost will be $17/month. This architecture the EC2 instance costs by 66%.</p><blockquote>Cost may vary from region to region.</blockquote><p>Now, go and try it on your own. If you have any queries then contact me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68531b30cb18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Host any static website in just 10 min on AWS Amplify]]></title>
            <link>https://medium.com/@rj03012002/host-any-static-website-in-just-10-min-on-aws-amplify-88cf11b912b8?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/88cf11b912b8</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[static-websites]]></category>
            <category><![CDATA[amplify]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 19 Aug 2023 07:44:58 GMT</pubDate>
            <atom:updated>2023-08-19T07:44:58.090Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*pRHkJJgDRt1nhulV" /></figure><p>Today, I am going to host a simple website which is built using HTML on AWS Amplify. A prerequisite for deploying your website is, you need an AWS account and you have to push your website’s entire code on GitHub. So Are you excited to host your application on Amplify?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*LC_dcOmCndlzc_zug-zF_w.gif" /></figure><h4><strong>Let’s start with the Introduction. What is AWS Amplify</strong></h4><p>AWS Amplify is a set of purpose-built tools and features that enables frontend web and mobile developers to quickly and easily build full-stack applications on AWS. Amplify provides two services: Amplify Hosting and Amplify Studio. Amplify Hosting provides a git-based workflow for hosting full-stack serverless web apps with continuous deployment. This user guide provides the information you need to get started with Amplify Hosting.</p><p>This service comes under the AWS free tier. It expires at the end of your 12-month AWS Free Tier term and then converts to pay-as-you-go.</p><p><em>Open the link:- </em><a href="https://aws.amazon.com/amplify/getting-started/"><em>https://aws.amazon.com/amplify/getting-started/</em></a></p><h4>Steps to deploy our application.</h4><ol><li>Click on the button “Connect your repository” and you will redirect to this page. Here you have to select any hosting service, for now, I am using GitHub.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PSWw2RgWv7cU-OzUSle3Rw.png" /></figure><p>2. After selecting the hosting service you have to authorize your account and give read-access to AWS Amplify.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lflQ3RsaJo34_T7JC7hiiw.png" /></figure><p>3. Now select the repository and the branch which you have to deploy and press “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kQE5JzLMtqsY1uL09DhYJQ.png" /></figure><p>4. Enter the name of your app and select the checkbox given at the bottom and then press “Next”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUAoIOJ1vujQfd2BhbEW-g.png" /></figure><p>5. In the last step you just have to press “Save and deploy” and then the deployment process will automatically start. It takes 2–3 minutes to deploy your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5G4xsZXtUMRYaH2h9-rEQ.png" /></figure><p>6. Kudos, your website is deployed and you can access it using the link given below the image. ex:- <a href="https://master.d2434w6q2tbzmu.amplifyapp.com/">https://master.d2434w6q2tbzmu.amplifyapp.com/</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-VegqNnqXuqbYr0EMYn7SQ.png" /></figure><p>Internally Amplify uses CI/CD tools for deployment, so if you have pushed any new changes on your GitHub repo then Amplify detects those changes and deploys the application again with those new changes so you don’t need to deploy every time if you change anything in your application</p><p>Now, go and try it on your own. If you have any queries then connect me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*ECcxd4pb1A-fpZypYvVq7w.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88cf11b912b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scale your application automatically based on server load in AWS]]></title>
            <link>https://medium.com/@rj03012002/scale-your-application-automatically-based-on-server-load-in-aws-33fa1eccf06?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/33fa1eccf06</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[autoscaling]]></category>
            <category><![CDATA[elastic-compute-service]]></category>
            <category><![CDATA[begginer]]></category>
            <category><![CDATA[horizontal-scaling]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sat, 19 Aug 2023 06:38:55 GMT</pubDate>
            <atom:updated>2023-08-19T06:38:55.495Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This blog is the extension of my <a href="https://medium.com/@rj03012002/handle-ec2-server-traffic-using-load-balancing-in-aws-3b58f9e6ed9c">previous blog</a> in which I taught you how you can scale your application horizontally and handle the huge server traffic using Application load balancer. So first go though that blog and then again come to this page.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/0*-0SLzgxmRq2yiV9Q.png" /></figure><p>You have seen in the previous blog we have created two EC2 instances and attached a load balancer to balance the load on both servers. But if we don’t know about the traffic, how can we decide how many EC2 instances are required? There are two cases, Case 1: If there is enormous traffic and we have only created 2 servers, in this case, our server goes down and the user can able to use our application. Case 2: If we have 5 servers and there are a very less number of people using our application, so, in this case, 1 or 2 servers are capable to serve our application, but we are running 5 servers which will increase our cost. To handle this situation we will use <strong>Auto-Scaling Groups(ASG)</strong> in AWS.</p><p>Auto-Scaling Groups are collections of EC2 instances which automatically increase or decrease the server capacity based on the traffic(on demand). It scales up and down our application based on different conditions such as CPU utilization, memory remaining, scheduled time etc.</p><h4>Create Launch Template</h4><p>Launch templates are used by ASG to create an EC2 instance of the configuration given in that template. In simple terms when ASG wants to create an EC2 instance, how ASG will know what instance type, operating system and other configuration it has to choose to create an EC2 instance? So ASG uses Launch templates where we define the configuration of our EC2 instance.</p><p>To create a launch template, first go to the EC2 dashboard page, in the sidebar you will Auto-Scaling Group. Go there and click on the “Create launch template” button. The procedure for creating the EC2 instance is the same as for creating the launch template. I have already taught you how you can create an EC2 instance so I am not covering the procedure to create a launch template in this blog.</p><p>After creating a launch template you will see something like this. I have given the “MyASGTemplate” name to my template you can give any name you want. Also, attach the “EC2-security-group” security group to our Launch template which we have created in the previous blog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBcygSyzxECQHLZDvyzEGg.png" /></figure><h4>Create Auto-Scaling Group</h4><p>To create an auto-scaling group, first go to the EC2 dashboard page, in the sidebar you will Auto-Scaling Group. Go there and click on the “Create Auto-Scaling Group” button.</p><p>Enter the name of ASG, then choose the launch template which we have created in the above step. You can create different versions of your template, initially, the default version will be selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VHD1wiItMg0oHXyvABd3UQ.png" /></figure><p>Click on the “Next” button and select VPC and availability zones. It is recommended to select all the availability zones to make our application highly available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cr-WnrcZAZEenSprrRkNgQ.png" /></figure><p>Click on the “Next” button and select the Load balancer we have created in the previous blog. If you want health checks and monitoring of your instances so you can select the given checkboxes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uotJSG4M_xTTszGpLX8KVg.png" /></figure><p>Now go to the next step where you have to choose the capacity of your Ec2 instances.</p><p>Here you will see 3 different capacities.</p><p>Desired capacity:- It means how many instances currently you want.</p><p>Minimum capacity:- It means what is the minimum count of instances you need in case of no traffic.</p><p>Maximum capacity:- It means up to what capacity of instances you need in case of huge traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZFyEzCUv23tf0xZ1pAXc0A.png" /></figure><p>Now create a Scaling policy, this will dynamically create or delete the ec2 instance base on some condition. In the below image, you can see that I have added a condition when the Average CPU utilization will go beyond 50% then create a new instance. You can create conditions based on your requirements. Now just click on skip to review and then click on the “Create” button. ASG will take some time to do some setup and configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1xqbb2xlErOPOQTxn21uw.png" /></figure><p>If you go to the instances page you will see 4 instances are running, this is because we have set the desired capacity to 4 that&#39;s why ASG initially created 4 EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPM-enWO4BD26EMgcQo0HA.png" /></figure><p>Our Auto-scaling group is created, and now based on traffic it will increase the decrease in the number of EC2 instances between 1 to 10 because this is our minimum and maximum capacity.</p><p>If you have an EC2 instance in which your application is running, you can do one thing just create an AMI of that instance and use that AMI for creating the launch template of your Auto-Scaling group.</p><p>If you have any queries then connect me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33fa1eccf06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handle EC2 server traffic using Load balancing in AWS.]]></title>
            <link>https://medium.com/@rj03012002/handle-ec2-server-traffic-using-load-balancing-in-aws-3b58f9e6ed9c?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b58f9e6ed9c</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[availability]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-elastic-cloud]]></category>
            <category><![CDATA[scalability]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sun, 06 Aug 2023 08:50:58 GMT</pubDate>
            <atom:updated>2023-08-06T08:50:58.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h0syD9JMNuqOSXbOFW91xg.png" /></figure><h4>Introduction to the Load balancer</h4><p>A single server can able to handle the huge traffic, you need to scale your servers either horizontally or vertically. In this tutorial, I will discuss horizontal scaling. In horizontal scaling, we increase the no of instances and balance the load using load balancers. When we create multiple servers then it will create different IP addresses for each server and we need a single endpoint to trigger our server, so the load balancer will become that starting endpoint and send the request to our server based on some rules.</p><blockquote>Prerequisite:- AWS account</blockquote><h4>Different steps to be followed in this blog</h4><ol><li>Create security groups</li><li>Create EC2 instances</li><li>Create a target group and attach our ec2 instances</li><li>Attach Load balancer</li></ol><h4>Create Security groups</h4><p>We have to create 2 Security groups first one for the EC2 instance and the second one for the load balancer. So the reason behind the two security groups is we want the load balancer to be accessed publically and the instance can only be accessed by the load balancer. So we add an HTTP port in the inbound rule of the load balancer security group and in the case of the EC2 instance, we will add the security group of the load balancer in the inbound rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MJYw8ZX_QziLyN5QH-T5ow.png" /><figcaption>Load balancer Security Group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zHPxDF1gkG0RtwBazlH36w.png" /><figcaption>EC2 Instance Security Group</figcaption></figure><h4>Create EC2 instance:-</h4><p>In my <a href="https://medium.com/@rj03012002/deploy-your-first-hello-world-application-on-aws-ec2-instance-e474028964a9">previous blog</a>, I taught you how to create an Ec2 instance and run Apache server on it using httpd. Just create 2 EC2 instances in the same way given in that blog but there are two changes first one is to use the security group for instance which we have created in the above step and instead of echoing “Hello world”, echo the below text by running the below command.</p><pre>echo &quot;&lt;h1&gt;Hello World from $(hostname -f)&lt;/h1&gt;&quot; &gt; /var/www/html/index.html</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LfOVkCi2FxSuYhyKvJQQvQ.png" /></figure><h4>Create a target group and attach our EC2 instance:-</h4><p>Target group:- In simple terms, a target group is a group of instances, functions, IP addresses etc. // do it later</p><p>Create a target group:-</p><ol><li>In the EC2 dashboard select the target group from the sidebar, then select the target type in our case it is “instances”, then enter the target group name ex:- “Load-balancer-target-group” and click on the Next button.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JuNwmZ-x_DZ9ZbTJvffl8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KbGN07Ip_uANj2QEV0rzRg.png" /></figure><p>2. In the next step select the EC2 instances you want to register in this target group. In our case select all the 3 instances you have created in the above step and then click on the “Include as pending below” button then click on the “Create target group” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHZEeZMMSi5jnGT1r8vhBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1L1nELxLDYkuO-INLtzHSg.png" /></figure><h4>Attach Load balancer:-</h4><p>Now our target group is created our next task is to create an application load balancer(ALB) and attach the target group to this ALB. The Application load balancer works HTTP and HTTPS ports so the users can easily able to access the load balancer using public IP address. Now whenever the user hit the load balancer IP address the load balancer does some calculations and selects an Ec2 instance based on their calculation from the target group and sends the request to that instance.</p><p>To create an application load balancer first go to the EC2 dashboard, select load balancer from the sidebar and then choose the ALB option.</p><p>After choosing you will redirect to the next page, where you have to enter the name of the load balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZk0BllYwb3QJJy_ltcGJw.png" /></figure><p>Then select the VPC if you have created it or use the default one. Select all the availability zones to make our application available all the time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n52hfiZeIcNoBRRfok8iJw.png" /></figure><p>Now select the security group of ALB and the target group which we have created in the above steps. Then scroll to the end and click on the Create load balancer button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4pZ0EiHuPy24UB-XlHLuFQ.png" /></figure><p>Now open the public DNS of the load balancer in any browser and continuously refresh the page, you will get to know that the load balancer sends the request to different EC2 instances. In the below image, you can see that the URL is the same but the EC2 instances are different. It means the load balancer balances the load to different EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pU_XfScnNKdSUcOeA1CKog.png" /><figcaption>Instance-1 IP Address</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrSwvFl4dHQdrOgaQEFQaw.png" /><figcaption>Instance-2 IP Address</figcaption></figure><p>Congratulation, you have learnt how to scale your application horizontally and balance the load using a load balancer.</p><p>The next blog will be the continuation of this blog. In the next blog, I will teach you how you can attach an Auto-Scaling Group to our instances so that our instances are automatically created and terminated according to server load.</p><p>If you have any queries then connect me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b58f9e6ed9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy your React.js application on AWS EC2 Instance in less than 10 minutes (Easy Method)]]></title>
            <link>https://medium.com/@rj03012002/deploy-your-react-js-application-on-ec2-instance-in-10-minutes-easy-method-f24cf190f46f?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f24cf190f46f</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[aws-ec2-instance]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Wed, 19 Jul 2023 12:16:43 GMT</pubDate>
            <atom:updated>2023-07-19T14:04:26.932Z</atom:updated>
            <content:encoded><![CDATA[<p>Generally whatever application we create runs on localhost and other people can&#39;t able to see and use your application. So today we will learn how to deploy your application on an AWS ec2 instance so everyone can use your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDfhgirtrY0ys7qJc29mXg.jpeg" /></figure><blockquote>Note:- Don’t run more than 1 instance of EC2 for more than 1 month it will generate some bills. In the free tier, you can run EC2 instances for 750 hours.</blockquote><p>Prerequisite:-</p><ol><li>AWS account</li><li>Github account (Push your source code on GitHub)</li></ol><h3>Step1: — Create An EC2 Instance</h3><ol><li>Open AWS Console and search EC2 on the search bar</li><li>Navigate to the Ec2 dashboard and open the instance from the sidebar</li><li>Click on the Launch Instance button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tQITiw_6KoKYSuB6DVP8sw.png" /></figure><p>6. Enter the name of your instance</p><p>7. Then select the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html">AMI (Amazon machine image) </a>(Currently I am using a free tier account that’s why I have the AMI which is available in the free tier)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xvTUgwHICV1pn5BTarbD9A.png" /></figure><p>8. Choose the instance type, I am choosing t2.micro because it is in the free tier</p><p>9. Select the default value of the key pair. It is required when you use CLI to connect to your EC2 instance. But today we are not using the CLI instead we will use EC2 connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1LEUcR9gPcM-EicPsacD1w.png" /></figure><p>10. In the Network setting, Allow the HTTP request, This will allow HTTP traffic to come into your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fDBOt5HUNBYUtUqGrlmNPg.png" /></figure><p>11. (Optional) You can also use the existing security group, but make sure that the inbound rules should be proper.</p><p>13. Now do not change any other settings and click on the Launch Instance button. It will take 1–2 min time to create your instance.</p><h3>Step 2- Connect your instance with EC2 connect</h3><ol><li>Select your instance and click on connect button</li><li>Select EC2 instance connect and then click on connect button, this will open a terminal where you can write your Linux commands.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXBxCMRClN-tWr5MheN6kg.png" /></figure><p>3. We are using an Apache server in this tutorial so for that we need to install httpd to run apache server. httpd is Produced by Apache Foundation and it is a piece of software that listens for network requests and responds to them.</p><pre>sudo su<br>yum update -y<br>yum install httpd</pre><p>Now start and enable the httpd</p><pre>systemctl start httpd<br>systemctl enable httpd</pre><p>This command will create a directory /var/www/html. It is the default root folder of the web server. Before creating our HTML file first we need to change the ownership of this folder.</p><pre>chown -R $USER /var/www/html</pre><p>Using the above command we are giving access to the user to do some changes in the /var/www/html folder.</p><p>4. Now install git and nvm in the terminal</p><pre><br>yum install -y git<br>git --version # check the if it is properly installed or not<br>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash<br>source ~/.nvm/nvm.sh<br>nvm --version # check the if it is properly installed or not<br><br># install the node version which you have used in your application. <br># I have used node 14 version that&#39;s why I am installing node 14 verison <br><br>nvm install 14<br><br># check if both npm and node installed properly or not<br>node --version<br>npm  --version</pre><p>5. Now clone your git repository in any directory in the terminal.</p><pre>git clone &lt;repo_url&gt;</pre><p>6. Now navigate to the folder in which the package.json file is present and run the bellow command.</p><pre>npm i # install all the packages for your application<br>npm run build # this will create a build folder in the same directory<br><br># Now copy all the content of build directory into /var/www/html<br> sudo cp -r build/* /var/www/html/</pre><p>7. Navigate to /var/www/html folder and check whether all the files got copies into that directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oKGYBxMydtp1aG0xh5Ud-g.png" /></figure><p>8. Now open the Public IPv4 DNS of your EC2 instance in the browser and you will see your website is deployed on ec2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i9x7ORQBdjI99FSLl8yh0A.png" /></figure><p>Congratulation, you have deployed your React.js application on the EC2 instance. Now share the URL with your friends and colleague so they can also able to use your application.</p><p>In my next Blog, I will teach you how you can add and configure load-balancer and auto-scaling groups so your server can able to handle large traffic. Stay tuned with me.</p><p>If you have any queries then connect me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f24cf190f46f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy your first hello world application on AWS EC2 Instance]]></title>
            <link>https://medium.com/@rj03012002/deploy-your-first-hello-world-application-on-aws-ec2-instance-e474028964a9?source=rss-77d24d2bab3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e474028964a9</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2-instance]]></category>
            <category><![CDATA[ec2-instance-connect]]></category>
            <category><![CDATA[hello-world]]></category>
            <dc:creator><![CDATA[Rohit Jain]]></dc:creator>
            <pubDate>Sun, 16 Jul 2023 10:38:15 GMT</pubDate>
            <atom:updated>2023-07-19T10:42:27.589Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*oQHcGpYs3_YcmzQmAe5abA.jpeg" /><figcaption>Aws Ec2 Instance</figcaption></figure><p>Prerequisite:- AWS Account</p><h4>Step1: — Create An EC2 Instance</h4><ol><li>Open AWS Console and search EC2 on the search bar</li><li>Navigate to the Ec2 dashboard and open the instance from the sidebar</li><li>Click on the Launch Instance button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ixu3Ti-Eb_mXus4wPzqS5Q.png" /></figure><p>6. Enter the name of your instance</p><p>7. Then select the <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html">AMI (Amazon machine image) </a>(Currently I am using a free tier account that’s why I have the AMI which is available in the free tier)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iTN4qgfJZb9lSdqBgZ_aw.png" /></figure><p>8. Choose the instance type, I am choosing t2.micro because it is in the free tier</p><p>9. Select the default value of key pair. It is required when you use CLI to connect to your EC2 instance. But today we are not using the CLI instead we will use EC2 connect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZcUUNZzxubWzIShHTsTsg.png" /></figure><p>10. In the Network setting, Allow the HTTP request, This will allow HTTP traffic to come into your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jgl1aRuTFTBHEYaqmGMmAw.png" /></figure><p>11. (Optional) You can also use the existing security group, but make sure that the inbound rules should be proper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVCbtJ0j3qRFImgl-752bw.png" /></figure><p>12. Now do not change any other settings and click on the Launch Instance button. It will take 1–2 min time to create your instance.</p><h4>Step 2- Connect your instance with EC2 connect</h4><ol><li>Select your instance and click on connect button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzmBggDS7X-P0wVvO2xi5A.png" /></figure><p>2. Select EC2 to connect and then click on connect button, this will open a terminal where you can write your Linux commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8-89p4PZR24MT9LFlcuoA.png" /></figure><p>3. We are using an Apache server in this tutorial so for that we need to install httpd to run apache server. httpd is Produced by Apache Foundation and it is a piece of software that listens for network requests and responds to them</p><pre>sudo su<br>yum update -y<br>yum install httpd</pre><p>Now start and enable the httpd</p><pre>systemctl start httpd<br>systemctl enable httpd</pre><p>This command will create a directory /var/www/html. It is the default root folder of the web server. Before creating our HTML file first we need to change the ownership of this folder</p><pre>chown -R $USER /var/www/html</pre><p>Now enter your content in /var/www/html/index.html</p><pre>echo &quot;&lt;h1&gt;Hello World&lt;/h1&gt;&quot; &gt; /var/www/html/index.html</pre><p>Now go to the instances page -&gt; select your instance -&gt; open the public IPv4 DNS of your instance in the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HSKlDSbbRhqcMlVfp5_Rw.png" /></figure><p>Congratulation, you have deployed your first hello world application on the EC2 instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMqthWuw1aEaw332XPmpXQ.png" /></figure><p>In my next Blog, I will teach you how you can deploy a real-world application which you have built in React.Js. Stay tuned with me.</p><p>If you have any queries then connect me on LinkedIn, and I will help you there.</p><p>LinkedIn Profile link:- <a href="https://www.linkedin.com/in/rohitjain0301/">https://www.linkedin.com/in/rohitjain0301/</a></p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e474028964a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>