<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Debabrata Halder</title>
    <description>The latest articles on DEV Community by Debabrata Halder (@debabrata2050).</description>
    <link>https://dev.to/debabrata2050</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%2F2374841%2Fe3654f55-ca60-4c8f-98c2-8de0282f039f.png</url>
      <title>DEV Community: Debabrata Halder</title>
      <link>https://dev.to/debabrata2050</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/debabrata2050"/>
    <language>en</language>
    <item>
      <title>Second Largest - Java</title>
      <dc:creator>Debabrata Halder</dc:creator>
      <pubDate>Mon, 02 Dec 2024 09:14:14 +0000</pubDate>
      <link>https://dev.to/debabrata2050/second-largest-13b3</link>
      <guid>https://dev.to/debabrata2050/second-largest-13b3</guid>
      <description>&lt;h3&gt;
  
  
  Find the Second Largest Element in an Array
&lt;/h3&gt;

&lt;p&gt;This method returns the second largest number in an integer array. If the array has fewer than 2 elements or all elements are the same, it returns &lt;code&gt;-1&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Approach&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Edge Case Check&lt;/strong&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Return &lt;code&gt;-1&lt;/code&gt; if the array is null or has less than 2 elements.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Initialize Variables&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;largest&lt;/code&gt;: Tracks the largest element (&lt;code&gt;Integer.MIN_VALUE&lt;/code&gt; initially).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;secondLargest&lt;/code&gt;: Tracks the second largest element (&lt;code&gt;Integer.MIN_VALUE&lt;/code&gt; initially).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Traverse the Array&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Update Largest&lt;/strong&gt;: If the current number is greater than &lt;code&gt;largest&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;Assign &lt;code&gt;largest&lt;/code&gt; to &lt;code&gt;secondLargest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Update &lt;code&gt;largest&lt;/code&gt; with the current number.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update Second Largest&lt;/strong&gt;: If the current number is not equal to &lt;code&gt;largest&lt;/code&gt; but greater than &lt;code&gt;secondLargest&lt;/code&gt;, update &lt;code&gt;secondLargest&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Return Result&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;secondLargest&lt;/code&gt; remains &lt;code&gt;Integer.MIN_VALUE&lt;/code&gt;, return &lt;code&gt;-1&lt;/code&gt;. Otherwise, return &lt;code&gt;secondLargest&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Code Explanation&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;getSecondLargest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Handle edge cases&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; 
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Initialize largest and second largest&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MIN_VALUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;secondLargest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MIN_VALUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Traverse array&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;secondLargest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// Update second largest&lt;/span&gt;
            &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;            &lt;span class="c1"&gt;// Update largest&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;secondLargest&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;secondLargest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// Update second largest&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Check if second largest exists&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;secondLargest&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;MIN_VALUE&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;secondLargest&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Key Points&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;n != largest&lt;/code&gt; check ensures duplicates of the largest number are ignored.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Integer.MIN_VALUE&lt;/code&gt; acts as a placeholder to handle negative numbers effectively.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Complexity&lt;/strong&gt;:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Time&lt;/strong&gt;: O(n) — Single pass through the array.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Space&lt;/strong&gt;: O(1) — No additional space used.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This code is efficient and handles edge cases gracefully.&lt;/p&gt;

</description>
      <category>dsa</category>
      <category>java</category>
      <category>programming</category>
    </item>
    <item>
      <title>Build Chatbot with Amazon Lex</title>
      <dc:creator>Debabrata Halder</dc:creator>
      <pubDate>Sun, 01 Dec 2024 10:05:27 +0000</pubDate>
      <link>https://dev.to/debabrata2050/build-chatbot-with-amazon-lex-40n</link>
      <guid>https://dev.to/debabrata2050/build-chatbot-with-amazon-lex-40n</guid>
      <description>&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Why talk to humans when you can build a bot that does it for you?
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;p&gt;This quote summarizes my experience of diving into Amazon Lex, AWS's superpower for building chatbots. I began on a journey to create my own bot: BankerBot. What a rollercoaster ride this was, with its learning curves, errors, and eureka moments! More on that below.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It All Started
&lt;/h2&gt;

&lt;p&gt;I've always wanted to learn AWS, and when one day, I found a website called &lt;strong&gt;&lt;a href="https://nextwork.org/" rel="noopener noreferrer"&gt;Nextwork&lt;/a&gt;&lt;/strong&gt;. It had a tutorial wherein they explained how to build chatbots with Amazon Lex. Curiosity gripped me, and I plunged into action.&lt;/p&gt;

&lt;p&gt;Lex looked like a youthful, fun playground for chatbot enthusiasts. It demanded you to reduce the complexity of a conversational interface into easy clicks and configuration steps, a task in itself for a newcomer in chatbots! Armed with the tutorial, I hoped to develop a bot capable of greeting users, fetching bank balance, and following up with subsequent queries. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F7rgq4o9fwyt64em2ucsb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F7rgq4o9fwyt64em2ucsb.png" alt="Image description" width="340" height="668"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Amazon Lex?
&lt;/h2&gt;

&lt;p&gt;We can think of Amazon Lex as that friend you have who just makes your life easier. It helps in creating chatbots that would just chat with users via text or by talking with them via voice. You could think of it as a bridge between you and artificial intelligence. It is pretty intuitive, integrates seamlessly with other AWS services, and allows automating the mundane conversations. This is great for applications like banking, customer service, or even ordering pizza.&lt;/p&gt;

&lt;p&gt;I initially planned to create a bot where the back-and-forth with the customer on banking queries would be minimized. Pretty simple, right? Now what "Spoiler" it wasn't! At least not right at the beginning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Set-up of BankerBot
&lt;/h2&gt;

&lt;p&gt;To start with, I created a bot named BankerBot on the Amazon Lex. Here is what I did:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Created Intents&lt;/strong&gt;: Intents are like aims of a bot. I created &lt;strong&gt;WelcomeIntent&lt;/strong&gt;, to greet users, &lt;strong&gt;CheckBalance&lt;/strong&gt;, to fetch account balance, and &lt;strong&gt;FollowupCheckBalance&lt;/strong&gt;, to respond to a follow-up query.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Added Slots&lt;/strong&gt;: Slots are allotted to take input from the user. For example, I added two slots - accountType (Savings, Checking, Credit) and dateOfBirth - to personalize the response.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Designed Responses&lt;/strong&gt;: I put in the dynamic responses, using placeholders. For instance:
&lt;em&gt;""Your balance in the {accountType} account is $XYZ."&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The entire setup process was quite smooth, thanks to Lex's user-friendly interface. At least so I thought. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fennnh8idt027omq1dcw0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fennnh8idt027omq1dcw0.png" alt="Image description" width="800" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Mistake That Taught Me a Lesson 🤦‍♂️❌
&lt;/h2&gt;

&lt;p&gt;Everything was going just fine until I came across a very frustrating roadblock. The bot had been working like a charm in English (India) (&lt;code&gt;en_IN&lt;/code&gt;) for basic tasks-greet the user, take input from the user, and check the balance. When the &lt;code&gt;FollowupCheckBalance&lt;/code&gt; intent was designed, it got stuck.  &lt;/p&gt;

&lt;p&gt;Picture yourself in this situation:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To know your balance in your savings bank account, you are required to provide your date of birth.
&lt;/li&gt;
&lt;li&gt;You next wanted to check the balance in your credit account.
&lt;/li&gt;
&lt;li&gt;The bot asks for your date of birth again. Very frustrating, isn't it?
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My intention was to have the user provide the date of birth once (through context tags), and continue using the same for further queries. But the fatal flaw was that context tags were unsupported in &lt;code&gt;en_IN&lt;/code&gt;.  &lt;/p&gt;

&lt;p&gt;Initially, I thought it was something that I am missing. I went through every little setting and Googled like a maniac until I finally discovered that in order to use context tags, the bot must be created in English (US) (&lt;code&gt;en_US&lt;/code&gt;). Talk about a facepalm moment but a valuable learning experience, nonetheless. I rebuilt the bot using &lt;code&gt;en_US&lt;/code&gt; and, voila, the context feature just popped up like magic. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Building a Smarter Bot with AWS Lambda
&lt;/h2&gt;

&lt;p&gt;Setup AWS Lambda to process data, fetch information or provide randomly generated responses. With Lambda, it's almost like the brain of your bot-I used it to simulate reporting on current bank balances.  &lt;/p&gt;

&lt;p&gt;What I did was as follows:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Wrote a Lambda function that generates a random number that acts as a simulated balance.
&lt;/li&gt;
&lt;li&gt;The function was connected to the bot through code hooks.
&lt;/li&gt;
&lt;li&gt;Test it by saying, &lt;em&gt;“What’s my balance in the savings account?”&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The bot responded, &lt;em&gt;“Your balance in savings is $423.”&lt;/em&gt; Success! Truly the thrill of watching a baby take their first step. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fghx1k70msfrfirnoterw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fghx1k70msfrfirnoterw.png" alt="Image description" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Adding Multiple Slots
&lt;/h2&gt;

&lt;p&gt;In the upcoming stage, I established a &lt;code&gt;TransferFunds&lt;/code&gt; intent for BankerBot. Three slots will help gather information:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Source Account Type
&lt;/li&gt;
&lt;li&gt;Target Account Type
&lt;/li&gt;
&lt;li&gt;Amount to Transfer
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used the same slot type &lt;code&gt;accountType&lt;/code&gt; two times with different names &lt;code&gt;sourceAccountType&lt;/code&gt; and &lt;code&gt;targetAccountType&lt;/code&gt; to ensure clarity in the understanding of which account to be used. I inserted confirmations like, &lt;em&gt;"Are you sure you want to transfer ₹500 from your Savings account to your Credit account?"&lt;/em&gt;  &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Automating Setup with CloudFormation 📄
&lt;/h2&gt;

&lt;p&gt;After building my bot several times (bless you, &lt;code&gt;en_IN&lt;/code&gt;!), I chanced upon AWS CloudFormation. It's sort of a magic wand to automate setups. Instead of going through the old-fashioned way of creating the bot, intents, and Lambda functions by hand, CloudFormation allowed you to define everything inside a YAML file and deploy it all as one stack.  &lt;/p&gt;

&lt;p&gt;Using CloudFormation, I set up the entire infrastructure for BankerBot within minutes. This saved me hours of manual configuration and spared me further human error. &lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and Fixes
&lt;/h2&gt;

&lt;p&gt;It was not one joyous flying leap completing the building of BankerBot. Part of the unfortunate situations I found with the bot and how I solved them is listed below.  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Error: Missing context tag in &lt;code&gt;en_IN&lt;/code&gt; ❌&lt;br&gt;
Fix: The bot was rebuilt in &lt;code&gt;en_US&lt;/code&gt; for context support 🔄&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error: Lambda function is not returning the responses ⚡&lt;br&gt;
Fix: Adjusted the IAM permissions for the function to be able to speak to Lex 🔐&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error: Slot values not occurring correctly 🛑&lt;br&gt;
Fix: Utilized detailed utterances and a validation prompt to guide user input 🗣️&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Start Simple: 🌊❌ Begin with the basics—no need to boil the ocean! Add complexity gradually.&lt;/li&gt;
&lt;li&gt;Read the Docs: 📜🔍 Small details (like language settings) can make or break your bot.&lt;/li&gt;
&lt;li&gt;Embrace Errors: ❌➡️💡 Treat errors as stepping stones to learning.&lt;/li&gt;
&lt;li&gt;Use CloudFormation: ☁️🤖 Automation = saved time + happier you! 🎉&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F57uevnkfkzbg387iiqno.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F57uevnkfkzbg387iiqno.png" alt="Image description" width="800" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;It was fine learning to build BankerBot; at first, it was not easy to handle, but it became quite fun after I learned it. With Amazon Lex and lots of trial and error, I have my bot that is interacting just like a pro. If I can do it, you can, too.  &lt;/p&gt;

&lt;p&gt;What are you waiting for? 🚀 Dive into Lex, embrace the mistakes, and craft something amazing. 🤖✨ Have a blast building your dream bots! 🎉💻 &lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Visualizing Data with Amazon QuickSight</title>
      <dc:creator>Debabrata Halder</dc:creator>
      <pubDate>Sat, 16 Nov 2024 14:19:22 +0000</pubDate>
      <link>https://dev.to/debabrata2050/visualizing-data-with-amazon-quicksight-i2a</link>
      <guid>https://dev.to/debabrata2050/visualizing-data-with-amazon-quicksight-i2a</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Imagine you have a big bunch of data and in couple minutes you can transform it to colorful and readible graphs. I just did this with Amazon QuickSight and Netflix data. It is like taking your data and giving it a megaphone to tell its story — neat huh? 🎨  &lt;/p&gt;




&lt;h3&gt;
  
  
  What Is Amazon QuickSight?
&lt;/h3&gt;

&lt;p&gt;Imagine QuickSight is to a data visualization what Canva is to a boring spreadsheet → it somehow makes your row and columns much prettier with nice colors in the form of graphs &amp;amp; charts. It will help you get insights faster whether you're examining sales, users' trends or (in my case) Netflix shows.&lt;/p&gt;




&lt;h3&gt;
  
  
  The Project: Analyzing Netflix Data
&lt;/h3&gt;

&lt;p&gt;I uploaded the &lt;strong&gt;Netflix dataset&lt;/strong&gt; into QuickSight to find the trends like:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Genre distribution 🎭
&lt;/li&gt;
&lt;li&gt;Release year breakdown 📅
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;QuickSight instantly converted those raw numbers into colourful graphs and charts, allowing us to identify patterns easily. However, I will say that it took some time to arrive at this point in the journey—similar to how one needs to exchange before new coffee machine starts spitting out great quality brews.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 1: Setting Up My Files
&lt;/h3&gt;

&lt;p&gt;I started by uploading two files to &lt;strong&gt;Amazon S3&lt;/strong&gt;:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;netflix_titles.csv&lt;/code&gt; (the data)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;manifest.json&lt;/code&gt; (the guidebook for QuickSight).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trick here? Editing the &lt;code&gt;manifest.json&lt;/code&gt; file to replace the URI link with the one pointing to my S3 bucket. It’s like updating your GPS to point to the right address.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2F5gzrlmcu6872inc7058h.png" alt="Image description" width="800" height="205"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 2: Creating a QuickSight Account
&lt;/h3&gt;

&lt;p&gt;Getting started with QuickSight was a breeze. It’s free to try, and the sign-up process was smoother than ordering your favorite latte. ☕ In minutes, I was staring at the dashboard, ready to dive in.  &lt;/p&gt;

&lt;p&gt;💡 Fun fact: QuickSight is pay-as-you-go after the free trial, so no worries about surprise bills if you delete things when you’re done (which I did!).&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2Fu6sv7gywdfl8tcr9cbqa.png" alt="Image description" width="800" height="403"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 3: Connecting the Dots
&lt;/h3&gt;

&lt;p&gt;To connect QuickSight to my data:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I went to &lt;strong&gt;Manage Data&lt;/strong&gt; and added my S3 bucket as a data source.
&lt;/li&gt;
&lt;li&gt;QuickSight read the &lt;code&gt;manifest.json&lt;/code&gt; file, located my dataset, and imported it like a pro.
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2Fwl3e7w49c6vt6pxbvkio.png" alt="Image description" width="609" height="308"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  My First Visualization
&lt;/h3&gt;

&lt;p&gt;Now comes the fun part—creating a chart! Here’s how I made my first one:  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Dragged the &lt;code&gt;release_year&lt;/code&gt; field to the Y-axis.
&lt;/li&gt;
&lt;li&gt;Dropped the &lt;code&gt;type&lt;/code&gt; field (Movies, TV Shows) into the Group/Color tab.
&lt;/li&gt;
&lt;li&gt;Picked a bar chart.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And boom! QuickSight gave me a clear breakdown of Netflix’s content over the years. It was like watching a story unfold, but with data.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2Fn40rrs8ikpozie7jzj21.png" alt="Image description" width="487" height="400"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Filters: The Secret Sauce
&lt;/h3&gt;

&lt;p&gt;Filters are like sifting through your coffee beans to pick only the best ones. 🌟&lt;br&gt;&lt;br&gt;
For example, I filtered by genres (Action &amp;amp; Adventure, TV Comedies, Thrillers) to focus on just those. The result? A laser-focused view of what Netflix has to offer in those categories.  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2Fdqx9u4bs73nk68cfhcn1.png" alt="Image description" width="535" height="267"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Building a Dashboard
&lt;/h3&gt;

&lt;p&gt;Once I had my visualizations, I combined them into a sleek dashboard:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Added titles to make everything clear.
&lt;/li&gt;
&lt;li&gt;Tweaked layouts to keep it neat and tidy.
&lt;/li&gt;
&lt;li&gt;Exported the final version as a PDF (yes, QuickSight can do that!).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It felt like wrapping up a gift box of insights—ready to share with anyone. 🎁  &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.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%2F42ji1hf5jtbsyk5a5ry1.png" alt="Image description" width="800" height="350"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Lessons Learned
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Data Isn’t Scary:&lt;/strong&gt; QuickSight makes even complex datasets approachable.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tweaking Is Key:&lt;/strong&gt; Filters, fields, and formatting make all the difference.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visualization Is Power:&lt;/strong&gt; A good chart tells a story at a glance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't Forget to Clean Up:&lt;/strong&gt; I deleted my S3 bucket and QuickSight setup after I was done to avoid unnecessary charges.
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Why You Should Try It
&lt;/h3&gt;

&lt;p&gt;If you’ve got data to analyze but feel overwhelmed, QuickSight is like having a coffee chat with your data—it simplifies everything. Give it a try, and I promise you’ll feel like a data wizard in no time. 🪄  &lt;/p&gt;

&lt;p&gt;What do you think? Ready to dive in? Let’s talk data over coffee! ☕ &lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>tutorial</category>
      <category>database</category>
    </item>
    <item>
      <title>Host a Static Website on Amazon S3</title>
      <dc:creator>Debabrata Halder</dc:creator>
      <pubDate>Fri, 15 Nov 2024 17:33:26 +0000</pubDate>
      <link>https://dev.to/debabrata2050/host-a-static-website-on-amazon-s3-45hn</link>
      <guid>https://dev.to/debabrata2050/host-a-static-website-on-amazon-s3-45hn</guid>
      <description>&lt;h2&gt;
  
  
  Introducing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is Amazon S3?
&lt;/h3&gt;

&lt;p&gt;Amazon S3 (Simple Storage Service) provides cloud storage for scalable data management. It's ideal for securely archiving, accessing, and backing up data, with high availability and simple integration possibilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I used Amazon S3 in this project
&lt;/h3&gt;

&lt;p&gt;In today's project, I designed a simple asd.html file, uploaded it to the S3 bucket "&lt;strong&gt;first-aws-project-debabrata&lt;/strong&gt;" made it public, and gained a lot about utilizing Amazon Web Services.&lt;/p&gt;

&lt;p&gt;The one surprise I wasn't expecting in this project was to receive the "Access Denied" error, which forced me to alter the permissions in order to make the file in public readily available.&lt;/p&gt;

&lt;p&gt;This project took me a few hours to do, including producing the HTML file, sending it to S3, and debugging the permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Set Up an S3 Bucket
&lt;/h2&gt;

&lt;p&gt;Creating an S3 bucket took only a few seconds. The process is quick and simple, involving selecting a name, region, and settings, followed by immediate bucket creation.&lt;/p&gt;

&lt;p&gt;I chose the Europe (Stockholm) region (eu-north-1) for its low latency, data sovereignty, and GDPR compliance, ensuring high performance and alignment with European data protection standards.&lt;/p&gt;

&lt;p&gt;S3 bucket names must be unique across all of AWS to avoid confusion, since the name is part of the web address used to access your files from anywhere in the world.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fmibqgtfrzz9cvmfm328e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fmibqgtfrzz9cvmfm328e.png" alt="Image description" width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Upload Website Files to S3
&lt;/h2&gt;

&lt;p&gt;I uploaded a single file to my S3 bucket—that was the simple asd.html file. &lt;/p&gt;

&lt;p&gt;This file is the main webpage, and I have basic styling to display the page correctly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fr6mic1avaix86bqs6gd7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fr6mic1avaix86bqs6gd7.png" alt="Image description" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Static Website Hosting on S3
&lt;/h2&gt;

&lt;p&gt;Website hosting means storing website files on a server that is accessible over the internet, allowing users to view and interact with the site using a domain name or URL.&lt;/p&gt;

&lt;p&gt;Static website hosting is where the magic happens.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I went to the &lt;strong&gt;Properties&lt;/strong&gt; tab in my bucket.
&lt;/li&gt;
&lt;li&gt;Scrolled down to &lt;strong&gt;Static Website Hosting&lt;/strong&gt;, clicked &lt;strong&gt;Edit&lt;/strong&gt;, and turned it on.
&lt;/li&gt;
&lt;li&gt;Then, I set &lt;code&gt;asd.html&lt;/code&gt; as the "index document"—basically, the homepage. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This step is where your bucket stops being just storage and starts being a real website.  &lt;/p&gt;

&lt;p&gt;An Access Control List (ACL) is used to manage permissions on your resources, specifying who can access them. I enabled ACLs to make my project public and allow broader access to the files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Frrtu5hzsnpky2t9qon9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Frrtu5hzsnpky2t9qon9y.png" alt="Image description" width="800" height="823"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bucket Endpoints
&lt;/h2&gt;

&lt;p&gt;A bucket website endpoint URL in Amazon S3 enables web hosting. &lt;/p&gt;

&lt;p&gt;It follows the format: &lt;br&gt;
&lt;code&gt;http://&amp;lt;bucket-name&amp;gt;.s3-website-&amp;lt;region&amp;gt;.amazonaws.com &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For your example: &lt;br&gt;
&lt;code&gt;http://first-aws-project-debabrata.s3-website.eu-north-1.amazonaws.com/asd.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When I first visited the bucket endpoint URL, I saw an "Access Denied" error. &lt;br&gt;
The reason for this error was likely due to insufficient bucket permissions or missing public read access on the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F9h2epkhlvs9o795ayxua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F9h2epkhlvs9o795ayxua.png" alt="Image description" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Success!
&lt;/h2&gt;

&lt;p&gt;To resolve this connection error, I went to the Actions dropdown, selected "Make public using ACL," and confirmed by choosing "Make public." This granted public access to the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Ff04r9rf41wvsfycrtn5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Ff04r9rf41wvsfycrtn5o.png" alt="Image description" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Permissions Matter&lt;/strong&gt;: S3 doesn’t mess around with security, which is great once you know what you’re doing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Start Simple&lt;/strong&gt;: Hosting a static website on S3 is a fantastic way to learn AWS. It’s like training wheels for the cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You’ll Feel Like a Tech Wizard&lt;/strong&gt;: Seriously, hosting a website feels way cooler than it probably is, but that’s the fun part.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't Forget to Clean Up&lt;/strong&gt;: I deleted my S3 bucket after I was done to avoid unnecessary charges.&lt;/li&gt;
&lt;/ul&gt;

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