<?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: Marawan Mamdouh</title>
    <description>The latest articles on DEV Community by Marawan Mamdouh (@marawanxmamdouh).</description>
    <link>https://dev.to/marawanxmamdouh</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%2F892737%2F070b726d-4f23-4aea-8465-8ca88084b132.jpg</url>
      <title>DEV Community: Marawan Mamdouh</title>
      <link>https://dev.to/marawanxmamdouh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marawanxmamdouh"/>
    <language>en</language>
    <item>
      <title>Mastering ROUGE Matrix: Your Guide to Large Language Model Evaluation for Summarization with Examples</title>
      <dc:creator>Marawan Mamdouh</dc:creator>
      <pubDate>Sun, 08 Oct 2023 06:05:52 +0000</pubDate>
      <link>https://dev.to/aws-builders/mastering-rouge-matrix-your-guide-to-large-language-model-evaluation-for-summarization-with-examples-jjg</link>
      <guid>https://dev.to/aws-builders/mastering-rouge-matrix-your-guide-to-large-language-model-evaluation-for-summarization-with-examples-jjg</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In this article, we will start discussing everything you might want to learn about the ROUGE Matrix. Let's begin by welcoming you to the world of Large Language Models (LLMs), where natural language processing has been revolutionized, becoming a cornerstone across various applications. However, with this innovation, the challenge of evaluating LLMs' or any text generation model performance and capabilities becomes visible. Traditional machine learning evaluation methods fall short due to the non-predictable nature of language-based outputs. &lt;/p&gt;

&lt;p&gt;In the realm of Natural Language Processing (NLP), evaluating model performance is very important. But what does it mean when we say, "the model performed well on this task" or "the fine-tuned model showed substantial performance over the original model"? For this article, our focus turns to exploring the realm of ROUGE metrics in the context of summarization tasks. We'll dive into how these metrics shed light on the evaluation, reliability, and safety of Large Language Models (LLMs) when it comes to summarizing content. As we navigate through the process of evaluating summarization models, we'll uncover methodologies that enrich our understanding of the strengths and limitations of LLMs in creating summaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;The Tricky Part of Model Evaluation in Language Stuff&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;In traditional machine learning, assessing a model's performance often involves comparing its predictions with known ground truth labels. Metrics like accuracy work well when predictions are deterministic. However, evaluating NLP models poses unique challenges due to the non-predictable nature of their outputs and the complexities of human language.&lt;/p&gt;

&lt;p&gt;Imagine comparing two sentences: "John likes ice cream" and "John enjoys ice cream.” While these sentences convey similar meanings, determining their similarity isn't straightforward. Furthermore, understood differences in sentences like "John likes ice cream.” and "John doesn't like ice cream.” can lead to entirely different meanings. Evaluating such details requires an automated and structured approach, especially when dealing with large language models trained on vast amounts of text.&lt;/p&gt;

&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Meeting ROUGE and BLEU Measures&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;ROUGE and BLEU are tools that help us measure how well the computer understands language. ROUGE checks if the short summaries the computer makes are like what a person would write. It's like comparing a student's summary to the teacher's. BLEU is about checking if the computer's translations are good. It's like seeing how well the computer changes a sentence from one language to another and we will talk about this in the next article.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Understanding ROUGE Metrics&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;ROUGE is all about checking if the computer summaries make sense. Imagine your friend tells you a story, and you want to tell someone else the main parts of it. ROUGE helps us see if the computer did a good job at that. It looks at the important words the computer used and compares them to the words your friend used. ROUGE checks if they match. in other words it measures how well the machine-generated summaries match up with human-written reference summaries.&lt;/p&gt;

&lt;p&gt;ROUGE works by emphasizing a recall-oriented assessment. This means it focuses on how much of the important content from the human-written summary is captured in the machine-generated summary. To achieve this, ROUGE examines various sets of words called n-grams, which are just word groups. For example,ROUGE-1, for instance, looks at individual words or unigrams, while ROUGE-2 considers pairs of words or bigrams, and so on. Additionally, ROUGE-L examines the longest common subsequence between the machine-generated and human reference summaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  ROUGE-1: Capturing Unigrams
&lt;/h2&gt;

&lt;p&gt;Let's dive into an example to understand ROUGE metrics better. Imagine a reference sentence created by a person: "The car is fast." Now, let's say the computer-generated summary reads: "The new red car is extremely incredibly fast." We want to assess how well the computer's output matches the reference. We use metrics like recall, precision, and F1 with ROUGE-1.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt; sentence: "The car is fast."&lt;br&gt;
&lt;strong&gt;Machine-Generated&lt;/strong&gt; summary: "The new red car is extremely incredibly fast."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Recall:
&lt;/h3&gt;

&lt;p&gt;measure of how many words from the machine-generated summary match words in the reference summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Common terms in reference and machine-generated summaries are: "The" (1), "car" (1), "is" (1), "fast" (1) leading to &lt;code&gt;4&lt;/code&gt; matched words.&lt;/li&gt;
&lt;li&gt;The total words in the reference summary are: "The" (1), "car" (1), "is" (1), "fast" (1), totaling &lt;code&gt;4&lt;/code&gt; words.&lt;/li&gt;
&lt;li&gt;Therefore, the recall is &lt;code&gt;4/4 = 1&lt;/code&gt;, because the machine-generated summary has correctly included all the words in the reference summary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Precision
&lt;/h3&gt;

&lt;p&gt;reflects the ratio of words in the machine-generated summary that match the words in the reference summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With &lt;code&gt;4&lt;/code&gt; matched words and the machine-generated summary including: "The" (1), "new" (1), "red" (1), "car" (1), "is" (1), "extremely" (1), "incredibly" (1), "fast" (1), summing up to &lt;code&gt;8 words&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;The precision is &lt;code&gt;4/8 = 0.5&lt;/code&gt;. Half of the words in the machine-generated summary are present in the reference summary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  F1 Score
&lt;/h3&gt;

&lt;p&gt;This is a balance between recall and precision, giving us a single value to gauge overall performance. It's calculated using a formula that takes both recall and precision into account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Given our values, the F1 Score calculation is &lt;code&gt;2 * ((1 * 0.5) / (1 + 0.5))&lt;/code&gt; approximately equal to &lt;code&gt;0.67&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  In this example:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The recall is high because all the information in the reference text was captured in the generated text.&lt;/li&gt;
&lt;li&gt;However, the precision is lower because the generated text included extra information not in the reference text.&lt;/li&gt;
&lt;li&gt;This demonstrates that recall and precision can behave differently depending on the length and content of the generated summary.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;In the upcoming sections of this article, we will concentrate solely on the recall aspect, as it is the central concern of ROUGE metrics. Yet, I wanted to inform you about all the common approaches to address this, as outlined in this section.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  ROUGE-2: Capturing Bigrams
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Suppose we have:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt; sentence: "John is a talented musician."&lt;br&gt;
&lt;strong&gt;Machine-Generated&lt;/strong&gt; summary: "John is an accomplished artist."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Breaking down each sentence into bigrams (pairs of words), we have:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bigrams in the reference summary:&lt;/strong&gt; "John is", "is a", "a talented", "talented musician"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bigrams in the machine-generated summary:&lt;/strong&gt; "John is", "is an", "an accomplished", "accomplished artist"&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Overlap refers to the count of bigrams present in both the machine-generated and reference summaries. Upon inspecting the bigrams, we find that only the bigram "John is" appears in both summaries. As a result, the overlap count is &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The ROUGE-2 Score is calculated by taking the number of overlapping bigrams and dividing it by the total number of bigrams in the reference summary. Given &lt;code&gt;1&lt;/code&gt; overlapping bigram and &lt;code&gt;4&lt;/code&gt; total bigrams in the reference summary, the ROUGE-2 score computes to &lt;code&gt;1/4 = 0.25&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Hence, in this instance, the ROUGE-2 score is &lt;code&gt;0.25&lt;/code&gt;, indicating that 25% of the bigrams in the reference summary are present in the machine-generated summary.&lt;/p&gt;

&lt;h2&gt;
  
  
  ROUGE-L: Longest Common Subsequence
&lt;/h2&gt;

&lt;p&gt;Let's examine the following sentences:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt; sentence: "The quick brown fox jumps over the lazy dog."&lt;br&gt;
&lt;strong&gt;Machine-Generated&lt;/strong&gt; summary: "The quick dog jumps on the log."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;strong&gt;Longest Common Subsequence (LCS)&lt;/strong&gt; method identifies the longest sequence of words that appear in the same order in both the reference and machine-generated summaries.&lt;/p&gt;

&lt;p&gt;In this case, the LCS includes: "The quick" and "jumps the".&lt;/p&gt;

&lt;p&gt;To calculate the &lt;strong&gt;ROUGE-L Score&lt;/strong&gt;, we divide the length of the LCS by the total number of words in the reference summary.&lt;/p&gt;

&lt;p&gt;Length of LCS: &lt;code&gt;4&lt;/code&gt; words (for "The quick" and "jumps the")&lt;br&gt;
Total words in reference: &lt;code&gt;9&lt;/code&gt; words (for "The quick brown fox jumps over the lazy dog.")&lt;/p&gt;

&lt;p&gt;Thus, the ROUGE-L score is computed as: &lt;code&gt;4/9 = 0.44&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This indicates that around 44% of the reference summary is mirrored in the machine-generated summary when considering the longest common subsequence of words.&lt;/p&gt;

&lt;p&gt;Keep in mind that in real-world contexts, the LCS typically emphasizes the longest sequence of consecutive words shared by both texts. The example provided here is a simplified and concatenated scenario intended for abstract illustration purposes.&lt;/p&gt;
&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;ROUGE-Lsum: A Twist on ROUGE-L&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;The ROUGE-Lsum is related to the ROUGE-L metric but applies a slightly different calculation method. It applies the ROUGE-L calculation method at the sentence level and then aggregates all the results for the final score. This metric is seen as more suitable for tasks where sentence level extraction is valuable such as extractive summarization tasks.&lt;br&gt;
In simpler terms, whereas ROUGE-L looks at the summary as a whole, ROUGE-Lsum considers sentence-level information, potentially providing more granularity in some use cases.&lt;/p&gt;

&lt;p&gt;ROUGE-L ignores newlines and computes the LCS for the entire text. ROUGE-Lsum splits the text into sentences based on newlines and computes the LCS for each pair of sentences and take the average score for all sentences.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Example: calculating the ROUGE-L and ROUGE-Lsum&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To truly grasp the beauty of these metrics, let's embark on an illustrative journey using an example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Reference Summary (A):&lt;/strong&gt; "John is a talented musician.&lt;code&gt;\n&lt;/code&gt; He has band called (The Forest Rangers) Recently"&lt;br&gt;
&lt;strong&gt;Generated Summary by System (B):&lt;/strong&gt; "John is an accomplished artist.&lt;code&gt;\n&lt;/code&gt; He is part of band called (The Forest Rangers)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;ROUGE-L Calculation:&lt;/em&gt;&lt;/strong&gt;*
&lt;/h3&gt;

&lt;p&gt;ROUGE-L looks at the whole story without caring about where lines break. It wants to find similar parts between the two versions. &lt;/p&gt;

&lt;p&gt;In our example, it finds that LCS equals &lt;code&gt;9&lt;/code&gt; common words: "John is a. He band called (The Forest Rangers)"&lt;/p&gt;

&lt;p&gt;Thus, the ROUGE-L score for (A, B) would be &lt;code&gt;9/13 = 0.69&lt;/code&gt; (approximated)&lt;/p&gt;
&lt;h3&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;ROUGE-Lsum: Looking at Sentences Level.&lt;/em&gt;&lt;/strong&gt;*
&lt;/h3&gt;

&lt;p&gt;ROUGE-Lsum first splits the summaries into sentences, then performs ROUGE-L calculations for each sentence individually:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sentence 1:&lt;/strong&gt; It compares the sentences "John is a talented musician." and "John is an accomplished artist." It finds that LCS equals &lt;code&gt;3&lt;/code&gt; common words out of &lt;code&gt;5&lt;/code&gt;, making the score &lt;code&gt;0.6&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sentence 2:&lt;/strong&gt; Next, it compares "He has a band called (The Forest Rangers)." and "He is part of a band called (The Forest Rangers)." It finds that LCS equals &lt;code&gt;6&lt;/code&gt; common words out of &lt;code&gt;8&lt;/code&gt;, making the score &lt;code&gt;0.75&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Adding these scores and finding the average gives us &lt;code&gt;(0.6 + 0.75) / 2&lt;/code&gt;, which is &lt;strong&gt;&lt;code&gt;0.675&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Key Differences:&lt;/em&gt;&lt;/strong&gt;* ROUGE-Lsum VS ROUGE-L
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;ROUGE-L ignores newlines and computes the LCS for the entire text. This is appropriate when the candidate and reference summaries contain a single long sequence.&lt;/li&gt;
&lt;li&gt;ROUGE-L*&lt;em&gt;sum&lt;/em&gt;* splits the text into sentences based on newlines and computes the LCS for each pair of sentences. It then takes the union of all LCS scores. This is appropriate when the candidate and reference summaries contain multiple sentences.&lt;/li&gt;
&lt;li&gt;ROUGE-L tends to give higher scores when the summaries contain similar content, regardless of sentence structure.&lt;/li&gt;
&lt;li&gt;ROUGE-Lsum penalizes differences in sentence structure more since it computes the LCS for each pair of sentences.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Calculating ROUGE Scores Using Python: A Step-by-Step Guide&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;Let's dive into the exciting world of calculating ROUGE scores using Python. Don't worry if coding isn't your comfort zone – we'll make it as smooth.&lt;/p&gt;
&lt;h3&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Snippet 1: ROUGE Calculation with RougeScorer&lt;/em&gt;&lt;/strong&gt;*
&lt;/h3&gt;

&lt;p&gt;In this first snippet, we'll use a special tool called the &lt;strong&gt;&lt;code&gt;rouge_score&lt;/code&gt;&lt;/strong&gt; library. It's like a helper that understands ROUGE and does the math for us. Take a look:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Import the rouge_scorer function from rouge_score
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;rouge_score&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;rouge_scorer&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize the scorer
&lt;/span&gt;&lt;span class="n"&gt;scorer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rouge_scorer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RougeScorer&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s"&gt;'rouge1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'rouge2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'rougeL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'rougeLsum'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="c1"&gt;# Compute the Rouge scores for reference and candidate.
&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scorer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'The quick brown fox jumps over the lazy dog'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                      &lt;span class="s"&gt;'The quick brown dog jumps on the log.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Print the scores
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this snippet, you're using the &lt;strong&gt;&lt;code&gt;RougeScorer&lt;/code&gt;&lt;/strong&gt; class from the &lt;strong&gt;&lt;code&gt;rouge_score&lt;/code&gt;&lt;/strong&gt; library to create a scorer object for calculating ROUGE scores. The list of metrics you're calculating includes 'rouge1', 'rouge2', 'rougeL', and 'rougeLsum'. You then provide two sentences for comparison and print the resulting scores.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="s"&gt;'rouge1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;recall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.67&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmeasure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.71&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
&lt;span class="s"&gt;'rouge2'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.29&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;recall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmeasure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.27&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
&lt;span class="s"&gt;'rougeL'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.625&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;recall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.56&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmeasure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.59&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; 
&lt;span class="s"&gt;'rougeLsum'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;precision&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.625&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;recall&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.56&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmeasure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.59&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Snippet 2: Aggregated ROUGE Scores with Evaluation Module&lt;/em&gt;&lt;/strong&gt;*
&lt;/h3&gt;

&lt;p&gt;Now, let's explore the second snippet. It's like inviting a group of friends to join the fun. We'll use an extra tool called the &lt;strong&gt;&lt;code&gt;evaluate&lt;/code&gt;&lt;/strong&gt; module, which is part of a library. It's like having a group activity to see how well sentences match up. Here's how it goes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Import the load function from the evaluate module
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;evaluate&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt;

&lt;span class="c1"&gt;# Loading the 'rouge' metric from the library
&lt;/span&gt;&lt;span class="n"&gt;rouge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'rouge'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Define your predictions and references
&lt;/span&gt;&lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Your summary 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Your summary 2"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;references&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"Reference summary 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Reference summary 2"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Compute the scores
&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rouge&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;compute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;predictions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;predictions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;references&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;references&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Print the scores
&lt;/span&gt;&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, you're loading the 'rouge' metric from the library using the &lt;strong&gt;&lt;code&gt;load&lt;/code&gt;&lt;/strong&gt; function. Then, you define a list of predictions and corresponding reference summaries. By calling the &lt;strong&gt;&lt;code&gt;compute&lt;/code&gt;&lt;/strong&gt; function on the &lt;strong&gt;&lt;code&gt;rouge&lt;/code&gt;&lt;/strong&gt; metric object, you calculate aggregated ROUGE scores for all predictions and references.&lt;/p&gt;

&lt;p&gt;The resulting dictionary &lt;strong&gt;&lt;code&gt;results&lt;/code&gt;&lt;/strong&gt; contains the aggregated ROUGE scores for 'rouge1', 'rouge2', 'rougeL', and 'rougeLsum'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="s"&gt;'rouge1'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.67&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="s"&gt;'rouge2'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="s"&gt;'rougeL'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.67&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="s"&gt;'rougeLsum'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.67&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Also you can see a real world example for ROUGE Metrics in comparing a FLAN-T5 model on this &lt;a href="https://www.kaggle.com/code/marawanxmamdouh/mastering-prompt-engineering-with-generative-ai/"&gt;notebook&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;Overcoming Challenges: Enhancing ROUGE Metrics&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;While ROUGE metrics offer valuable insights into language evaluation, they come with their quirks. Think of it like this – sometimes ROUGE gives a thumbs up when it shouldn't. Imagine a computer repeating the same word over and over, like "fix, fix, fix, fix." ROUGE might support this, but that's not great writing, right? To figure this out, we have a trick we use clipping function "rule" that can be used to limit the counting of repeated words "Don't count the same word too much.". This keeps things fair and accurate, making sure our evaluation truly reflects the quality of the generated summary.&lt;/p&gt;

&lt;p&gt;Now, let's get into the nitty-gritty (details). ROUGE metrics have been our trusty companions in grading text summaries and translating stuff. But just like any measuring tool, they have their own limitations. Let's look at some of these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Word Friends, but Not BFFs&lt;/strong&gt;: ROUGE loves comparing words, but it's not so great at telling if words are like cousins – different on the outside but similar on the inside. This can be a problem when words have different faces but mean similar things. Imagine "happy" and "joyful" – they're like word twins, but ROUGE doesn't always see that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Word Order? Not a Big Deal&lt;/strong&gt;: ROUGE checks if words like to be together, but it doesn't care much about where they stand. This can be tricky. Imagine shuffling the words in a sentence – ROUGE might still think it's all good even if the meaning changes a lot. A bit like mixing up the ingredients in a recipe!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Friends Matter&lt;/strong&gt;: ROUGE relies on its friends, the reference texts. If these friends talk a certain way, ROUGE kind of wants others to talk like that too. It's like a classroom where everyone wants to be friends with the popular kid. This can make things a bit biased, don't you think?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Short and Sweet&lt;/strong&gt;: Ever notice that shorter things sometimes get more attention? Same goes for ROUGE scores. Shorter summaries can get a gold star just for being short, even if they don't capture everything. We have a trick to stop this, but it's not a perfect fix.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;But fear not! We're not just here to point out problems. We've got solutions too:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Mixing Meanings&lt;/strong&gt;: Let's bring in some friends – semantic similarity metrics. These guys help ROUGE understand that words with different looks can still have the same meaning. It's like teaching ROUGE to see beyond appearances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Order Matters&lt;/strong&gt;: Enter ROUGE-L as we mentioned. It cares about word order, so mixing things up doesn't fool it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Being Fair to Everyone&lt;/strong&gt;: Still working on new ways for ROUGE to make friends with all sorts of reference texts, not just the popular ones. This way, everyone gets a chance to shine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tackling Shortness&lt;/strong&gt;: Still cooking up ways to be fair to both long and short summaries. So, even if you're brief, you won't get extra points just for keeping it short.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And guess what? researchers also thinking about blending different ROUGE versions together to get a full picture. It's like using different lenses to see a beautiful landscape – each lens gives us a unique view, and when we put them all together, we get the full beauty.&lt;/p&gt;

&lt;p&gt;So, while ROUGE metrics are awesome, we're making them even better by tweaking, combining, and inviting some new friends to the party. Together, we're creating a fairer, more accurate way to measure the awesomeness of our language models. Stay tuned for more exciting updates in the world of language evaluation!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's also good to know that there are other types of ROUGE, like ROUGE-W, ROUGE-S, and ROUGE-SU, which are not used as widely. These variations have different ways of looking at summaries, like weighted common words and skip-bigrams. While not as famous, they're still part of the family find more in Reference 4.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  *&lt;strong&gt;&lt;em&gt;In Conclusion&lt;/em&gt;&lt;/strong&gt;*
&lt;/h2&gt;

&lt;p&gt;So there you have it! To sum it up, ROUGE metrics are like guiding stars that help us understand how well language models work. We've learned about ROUGE-1, ROUGE-2, ROUGE-L, and ROUGE-Lsum, which help us figure out if computer-generated summaries match human ones.&lt;/p&gt;

&lt;p&gt;Although ROUGE has some challenges, smart people are finding ways to fix them. They're making ROUGE better by teaching it to understand similar words, care about word order, treat everyone fairly, and not favor short things.&lt;/p&gt;

&lt;p&gt;As we go forward, ROUGE metrics keep showing us the way to better language models. They're helping us see the true abilities of these models and making sure they work even better. So, keep an eye out for more exciting things in the world of language evaluation!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Thanks for reading&lt;/em&gt; ❤&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/google-research/google-research/tree/master/rouge"&gt;https://github.com/google-research/google-research/tree/master/rouge&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/huggingface/datasets/blob/main/metrics/rouge"&gt;https://github.com/huggingface/datasets/blob/main/metrics/rouge&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/huggingface/datasets/issues/617"&gt;https://github.com/huggingface/datasets/issues/617&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://aclanthology.org/W04-1013.pdf"&gt;https://aclanthology.org/W04-1013.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/spaces/evaluate-metric/rouge"&gt;https://huggingface.co/spaces/evaluate-metric/rouge&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In accordance with SEO best practices, the canonical article can be found &lt;a href="https://www.blog.marawanmamdouh.dev/mastering-rouge-matrix-your-guide-to-large-language-model-evaluation-for-summarization-with-examples"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>llm</category>
      <category>nlp</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>AWS Amplify: The One-Stop Shop for Mobile and Full-Stack Development</title>
      <dc:creator>Marawan Mamdouh</dc:creator>
      <pubDate>Sun, 23 Apr 2023 13:02:17 +0000</pubDate>
      <link>https://dev.to/aws-builders/aws-amplify-the-one-stop-shop-for-mobile-and-full-stack-development-4l2o</link>
      <guid>https://dev.to/aws-builders/aws-amplify-the-one-stop-shop-for-mobile-and-full-stack-development-4l2o</guid>
      <description>&lt;ul&gt;
&lt;li&gt;What is AWS Amplify?&lt;/li&gt;
&lt;li&gt;
AWS Amplify Features

&lt;ul&gt;
&lt;li&gt;Create an app backend&lt;/li&gt;
&lt;li&gt;Build a frontend Ul&lt;/li&gt;
&lt;li&gt;Host a web app&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Benefits of Using AWS Amplify&lt;/li&gt;

&lt;li&gt;Use Cases for AWS Amplify&lt;/li&gt;

&lt;li&gt;AWS Amplify Pricing&lt;/li&gt;

&lt;li&gt;Getting Started with AWS Amplify&lt;/li&gt;

&lt;li&gt;Real story&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Do you want to build, Ship, or Host full-stack web and mobile apps faster and easier?
&lt;/h2&gt;

&lt;p&gt;If so, then AWS Amplify is the solution for you. Amplify is a set of purpose-built tools and features that enable frontend web and mobile developers to quickly and easily build full-stack applications on AWS. With Amplify, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a cross-platform backend for your iOS, Android, Flutter, web, or React Native app with real-time and offline functionality in just a few clicks.&lt;/li&gt;
&lt;li&gt;Visually build a pixel-perfect UI and connect your frontend UI to a cloud backend in clicks.&lt;/li&gt;
&lt;li&gt;Easily deploy your web app or website to the fast, secure, and reliable AWS content delivery network (CDN), with hundreds of points of presence globally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amplify is a powerful tool that can help you save time and money on your next web or mobile app project. To learn more, visit the AWS Amplify website today.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is AWS Amplify?
&lt;/h2&gt;

&lt;p&gt;AWS Amplify is a set of tools and services that helps you build and deploy full-stack web and mobile applications on AWS. Amplify provides a unified interface for managing your application's backend, frontend, and hosting, and it can be used with a variety of frameworks and technologies.&lt;/p&gt;

&lt;p&gt;With Amplify, you can quickly and easily build an application that is secure, scalable, and reliable. Amplify also provides a number of features that can help you improve the user experience of your application, such as offline support and push notifications.&lt;/p&gt;

&lt;p&gt;If you're looking for a way to build and deploy full-stack web and mobile applications on AWS, Amplify is a great option. It's easy to use, scalable, and secure. And it can be used with a variety of frameworks and technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Amplify Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Create an app backend
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpwi9t2144l68hslkycph.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpwi9t2144l68hslkycph.png" alt="Create an app backend using AWS Amplify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend as a Service (BaaS)&lt;/strong&gt;: Amplify provides a BaaS that makes it easy to build and manage backend services for your applications. With Amplify, you can quickly and easily create APIs, databases, and storage for your applications.&lt;/p&gt;

&lt;p&gt;It provides a lot of features such as:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Enable sign-in, sign-up and sign-out within minutes with pre-built UI components and powerful authentication APIs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage&lt;/td&gt;
&lt;td&gt;A simple mechanism for managing user content in public, protected or private storage.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GraphQL API&lt;/td&gt;
&lt;td&gt;Easy and secure solution to access your backend data with support for real-time updates using GraphQL.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DataStore&lt;/td&gt;
&lt;td&gt;Seamlessly synchronize and persist online &amp;amp; offline data to the cloud as well as across devices.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Geo&lt;/td&gt;
&lt;td&gt;Modern, interactive maps with location markers and location search.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REST API&lt;/td&gt;
&lt;td&gt;A straightforward and secure solution for making HTTP requests using REST APIs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analytics&lt;/td&gt;
&lt;td&gt;Make informed decisions with drop-in analytics to track user sessions, custom user attributes and in-app metrics.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push Notifications&lt;/td&gt;
&lt;td&gt;Drive customer engagement using push notifications with campaign analytics and targeting.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PubSub&lt;/td&gt;
&lt;td&gt;Provide best-in-class real-time experiences by connecting your application with a message-oriented middleware in the cloud.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interactions&lt;/td&gt;
&lt;td&gt;Automate customer workflows by enlisting the help of conversational chatbots powered by deep learning technologies.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI / ML Predictions&lt;/td&gt;
&lt;td&gt;Design delightful experiences with the power of AI and ML functionality such as computer vision, translation, transcription and more.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  2. Build a frontend Ul
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s2c2ux72lc3sw3cnyyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s2c2ux72lc3sw3cnyyd.png" alt="Build a frontend Ul using AWS Amplify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify also provides a design-to-code Figma integration that allows you to visually build a frontend UI in Figma and connect it to a backend in just a few clicks. To get started, simply create a new project in Figma and import your design files. Then, open the AWS Amplify plugin and select the "Create project" button.&lt;/p&gt;

&lt;p&gt;The AWS Amplify plugin will automatically generate code for your UI based on your Figma design files. You can then customize the code to meet your specific needs. Once you're happy with the code, you can deploy your application to AWS with a single click.&lt;/p&gt;

&lt;p&gt;The AWS Amplify design-to-code Figma integration can help you build a frontend UI quickly and easily. The platform provides a number of pre-built components and tools that can be used to create a responsive web and mobile-friendly UI.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Host a web app
&lt;/h3&gt;

&lt;p&gt;Once you've built your UI, Amplify can help you deploy it to production. Amplify provides a number of deployment options, including AWS Amplify Hosting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7zyb445r3n4ne23b90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8j7zyb445r3n4ne23b90.png" alt="Host a web app using AWS Amplify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify Hosting is a fully managed CI/CD and hosting service for fast, secure, and reliable static and server-side rendered apps that scale with your business. It supports modern web frameworks such as React, Angular, Vue, Next.js, Gatsby, Hugo, Jekyll, and more. Amplify Hosting features include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support for common SPA frameworks and static site generators&lt;/li&gt;
&lt;li&gt;Management of production and staging environments&lt;/li&gt;
&lt;li&gt;Custom domain support&lt;/li&gt;
&lt;li&gt;Deployment and hosting of SSR web apps created using Next.js&lt;/li&gt;
&lt;li&gt;Pull request previews&lt;/li&gt;
&lt;li&gt;End-to-end testing&lt;/li&gt;
&lt;li&gt;Password protection&lt;/li&gt;
&lt;li&gt;Rewrites and redirects&lt;/li&gt;
&lt;li&gt;Instant cache invalidations&lt;/li&gt;
&lt;li&gt;Atomic deployments&lt;/li&gt;
&lt;li&gt;Mobile device screen shots&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;📌 Host your Static Web App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Get started with static web hosting. AWS Amplify Console offers a simple Git-based workflow for building and deploying static web apps to AWS. It only takes 15 minutes to connect your repository, configure build settings, and deploy.&lt;/p&gt;

&lt;p&gt;Amplify Hosting is a great choice for developers who want to quickly and easily build and deploy high-quality web apps on AWS. It offers a wide range of features and support for a variety of frameworks and technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using AWS Amplify
&lt;/h2&gt;

&lt;p&gt;Using AWS Amplify can provide a number of benefits to developers looking to build and deploy full-stack web and mobile applications. Here are some of the key benefits of using AWS Amplify:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi8wkthpa7rm89w6l6iv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqi8wkthpa7rm89w6l6iv.png" alt="Benefits of Using AWS Amplify"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Simplified Development Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify provides a unified interface for managing your application's backend, frontend, and hosting. This means you can use a single tool to manage your entire development workflow, from creating APIs and databases to building and deploying your frontend UI. This can help streamline your development process and make it easier to manage your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Scalability and Security&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify is built on top of the AWS cloud infrastructure, which is designed to be highly scalable and secure. This means you can easily scale your application as your user base grows, and you can be confident that your application is secure and reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Easy Integration with Other AWS Services&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify integrates seamlessly with other AWS services, such as Amazon S3, Amazon DynamoDB, and Amazon Cognito. This means you can easily add additional functionality to your application as needed, such as file storage or user authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Cross-Platform Support&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify supports a variety of frameworks and technologies, including iOS, Android, Flutter, web, and React Native. This means you can build applications for multiple platforms using the same set of tools and services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Offline Functionality&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify provides offline functionality that enables your application to work even when the user is offline. This can help improve the user experience of your application and make it more reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Analytics and Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify provides built-in analytics and monitoring functionality that enables you to track user behavior and application performance. This can help you make informed decisions about how to improve your application over time.&lt;/p&gt;

&lt;p&gt;Overall, using AWS Amplify can help you save time and money on your next web or mobile app project. Its ease of use, scalability, and security make it a great choice for developers looking to build and deploy high-quality applications on AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases for AWS Amplify
&lt;/h2&gt;

&lt;p&gt;AWS Amplify can be used to build a wide range of web and mobile applications. Here are some common use cases for Amplify:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 E-commerce Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;E-commerce applications require a robust backend to handle product catalogs, orders, and payments. With AWS Amplify, you can quickly build a scalable and secure e-commerce backend that integrates with popular payment gateways like Stripe and PayPal. You can also use Amplify's analytics features to track user behavior and improve your conversion rates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Social Media Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Social media applications require real-time communication and notifications. With AWS Amplify, you can quickly build a backend that supports real-time messaging, comments, and likes. You can also use Amplify's push notifications feature to send notifications to users when new content is available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Mobile Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mobile applications require a backend that can handle offline data synchronization and push notifications. With AWS Amplify, you can quickly build a backend that supports offline data synchronization using DataStore and push notifications using the Push Notifications feature. Amplify also supports cross-platform mobile development with React Native and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 IoT Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IoT applications require a backend that can handle large volumes of data from sensors and devices. With AWS Amplify, you can quickly build a backend that supports IoT data streams using AWS IoT Core. You can also use Amplify's PubSub feature to publish and subscribe to messages from IoT devices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Progressive Web Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Progressive Web Applications (PWAs) require a fast and responsive user interface that can work offline. With AWS Amplify, you can quickly build a PWA that supports offline data synchronization using DataStore and fast content delivery using Amplify Hosting.&lt;/p&gt;

&lt;p&gt;Overall, AWS Amplify provides a wide range of features and integrations that make it easy to build and deploy full-stack web and mobile applications on AWS. Whether you're building an e-commerce application, a social media application, a mobile application, an IoT application, or a PWA, AWS Amplify can help you build a secure, scalable, and reliable backend and frontend.&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS Amplify Pricing
&lt;/h2&gt;

&lt;p&gt;With AWS Amplify you only pay for the resources you use. There are no upfront costs or commitments. AWS Amplify also offers a free tier that includes the following:&lt;/p&gt;

&lt;p&gt;here is the AWS Amplify pricing table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Free tier&lt;/th&gt;
&lt;th&gt;After free tier&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hosting&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;5 GB&lt;/code&gt; of storage and &lt;code&gt;100,000&lt;/code&gt; monthly visits.&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.023&lt;/code&gt; per &lt;code&gt;GB&lt;/code&gt; of storage and &lt;code&gt;$0.15&lt;/code&gt; per &lt;code&gt;1 million&lt;/code&gt; visits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push Notifications&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1 million&lt;/code&gt; notifications per month&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.01&lt;/code&gt; per notification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analytics&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;10 GB&lt;/code&gt; of data per month&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.02&lt;/code&gt; per GB of data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BUILD &amp;amp; DEPLOY&lt;/td&gt;
&lt;td&gt;No cost up to &lt;code&gt;1,000&lt;/code&gt; build minutes per month&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.01&lt;/code&gt; per minute&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DATA STORAGE&lt;/td&gt;
&lt;td&gt;No cost up to &lt;code&gt;5 GB&lt;/code&gt; stored on CDN per month&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.023&lt;/code&gt; per GB per month&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;REQUEST COUNT (SSR)&lt;/td&gt;
&lt;td&gt;No cost up to &lt;code&gt;500,000&lt;/code&gt; requests per month&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;$0.30&lt;/code&gt; per &lt;code&gt;1 million&lt;/code&gt; requests&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For more information on AWS Amplify pricing, please visit the AWS Amplify pricing page &lt;a href="https://aws.amazon.com/amplify/pricing/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are some tips for reducing your AWS Amplify costs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Optimize your code:&lt;/strong&gt; The more efficient your code is, the less it will cost to run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use caching:&lt;/strong&gt; Caching can help reduce the number of requests you make to your backend, which can save you money.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Group your notifications:&lt;/strong&gt; You can group your notifications together and send them at a later time to reduce the number of notifications you send each month.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use the right storage tier:&lt;/strong&gt; AWS Amplify offers three different storage tiers: Standard, Reduced Redundancy (RRS), and Glacier. The Standard tier is the most expensive, but it also offers the best performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these tips, you can reduce your AWS Amplify costs and save money on your next web or mobile app project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with AWS Amplify
&lt;/h2&gt;

&lt;p&gt;If you're ready to get started with AWS Amplify, there are a few steps you'll need to follow. Here's an overview of what you'll need to do:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Sign up for AWS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you can use AWS Amplify, you'll need to sign up for a free AWS account. &lt;/p&gt;

&lt;p&gt;2*&lt;em&gt;. Install the Amplify CLI&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;Once you have an AWS account, you'll need to install the Amplify Command Line Interface (CLI). The Amplify CLI is a tool that you can use to create and manage your Amplify projects from the command line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @aws-amplify/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3*&lt;em&gt;. Initialize a new Amplify project&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;Create a new Amplify project. by navigating to the directory where you want to create your project and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;amplify init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4*&lt;em&gt;. Add Amplify features to your project&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;Start adding features to your project using the Amplify CLI. For example, you can use the following command to add authentication to your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;amplify add auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5*&lt;em&gt;. Deploy your Amplify project&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;Once you've added the features you need to your Amplify project, you can deploy your project to AWS. by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;amplify push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use the Amplify CLI to quickly and easily create and manage your Amplify projects.&lt;/li&gt;
&lt;li&gt;Use the Amplify Console to visualize your Amplify projects and manage your AWS resources.&lt;/li&gt;
&lt;li&gt;Use the Amplify Libraries to add backend functionality to your frontend applications.&lt;/li&gt;
&lt;li&gt;Use the Amplify UI Components to build responsive and mobile-friendly UIs.&lt;/li&gt;
&lt;li&gt;Use the Amplify Hosting service to deploy your Amplify projects to production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real story
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;📌 The Challenge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A few years ago, I was working on a project that required me to build a mobile application that could process and store data. It was a complex project, and I was excited to take it on. However, as I began to dive into the development process, I quickly realized that there was a problem. I needed to find a way to store and process data in a secure and efficient way, but I didn't have the infrastructure or resources to do so.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 The Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS Amplify is a development platform that makes it easy to build scalable, secure, and fast applications. It provides developers with a suite of tools and services that can be used to build applications without having to worry about the underlying infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How AWS Amplify Helped Me&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using AWS Amplify, I was able to quickly and easily set up a secure and efficient infrastructure for my mobile application. I didn't have to worry about managing servers, configuring databases, or setting up authentication and authorization. AWS Amplify handled all of this for me.&lt;/p&gt;

&lt;p&gt;One of the key features of AWS Amplify is its ability to integrate with other AWS services. For example, I was able to use AWS AppSync to set up a GraphQL API that allowed my mobile application to communicate with the backend. I also used Amazon Cognito for user authentication and authorization. With AWS Amplify, I was able to seamlessly integrate these services into my application, saving me a lot of time and effort.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, AWS Amplify is an excellent solution for developers looking to build full-stack web and mobile applications quickly and efficiently. Its powerful features and tools enable developers to create scalable and secure applications with ease. With Amplify, developers can build a cross-platform backend for their iOS, Android, Flutter, web, or React Native app, visually create a UI, and deploy their web app or website to the fast, secure, and reliable AWS content delivery network. Amplify also provides a design-to-code Figma integration, a Backend as a Service (BaaS), and AWS Amplify Hosting, making it a complete solution for building, managing, and deploying full-stack applications. Overall, Amplify is an excellent choice for developers seeking to build complex, high-performance applications without having to worry about managing their infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Thanks for reading&lt;/em&gt; ❤&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How AWS Beanstalk Helped Me Tackle a Real Developer Problem?</title>
      <dc:creator>Marawan Mamdouh</dc:creator>
      <pubDate>Sun, 16 Apr 2023 22:33:26 +0000</pubDate>
      <link>https://dev.to/aws-builders/how-aws-beanstalk-helped-me-tackle-a-real-developer-problem-ebe</link>
      <guid>https://dev.to/aws-builders/how-aws-beanstalk-helped-me-tackle-a-real-developer-problem-ebe</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The problem I faced was that my application was growing, and I needed to scale it to meet the demands of my users. At first, I tried deploying the application manually, but this quickly became cumbersome, and I found myself spending more time troubleshooting than coding. I knew there had to be a better way.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Solution&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;That's when I turned to AWS Beanstalk. AWS Beanstalk is a fully managed service that makes it easy to deploy and scale applications. With Beanstalk, you can simply upload your code, and Beanstalk will automatically handle the deployment and scaling for you. This meant that I no longer had to worry about the underlying infrastructure, and I could focus on developing my application.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Benefits of using AWS Beanstalk:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Beanstalk's benefits is thinking of it like a personal assistant. Just like how a personal assistant handles the mundane tasks of scheduling appointments and managing emails, Beanstalk handles the tedious work of deploying and scaling your application. This frees up your time and allows you to focus on the more important aspects of your application, like writing clean and efficient code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ease of use:&lt;/strong&gt; AWS Beanstalk is very easy to use, even for developers who are new to deploying and scaling applications. The platform is well-documented and easy to follow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic scaling:&lt;/strong&gt; AWS Beanstalk automatically scales your application up or down based on demand. This means that as your application grows, Beanstalk will automatically add more resources to meet the demand. This is much like a restaurant that hires more staff when it gets busy. The restaurant doesn't have to worry about hiring new staff every time it gets busy, because the process is automated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; AWS Beanstalk is highly scalable. As your application grows, AWS Beanstalk will automatically scale the infrastructure to support it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; AWS Beanstalk takes security very seriously. It provides a secure, isolated environment for your application, which means that your application is protected from attacks and vulnerabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrated services:&lt;/strong&gt; AWS Beanstalk integrates with other AWS services, such as Amazon EC2, Amazon S3, and Amazon RDS. This makes it easy to add features to your application, such as user authentication, authorization, and real-time data processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Results&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Using AWS Beanstalk has not only made my life easier as a developer, but it has also allowed me to provide a better experience for my users. By being able to quickly deploy and scale my application, I can ensure that my users have a fast and responsive experience, even during periods of high traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use AWS Beanstalk
&lt;/h2&gt;

&lt;p&gt;Here are the steps on how to use AWS Beanstalk:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create an AWS account.&lt;/strong&gt; You can create an AWS account for free. Once you have an account, you will need to sign in to the AWS Management Console.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create an Elastic Beanstalk environment.&lt;/strong&gt; To create an Elastic Beanstalk environment, you will need to choose a platform, such as Java, .NET, PHP, Node.js, Python, Ruby, Go, or Docker. You will also need to provide a name for your environment and select a region.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upload your application code.&lt;/strong&gt; You can upload your application code to Elastic Beanstalk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy your application.&lt;/strong&gt; To deploy your application, you will need to click the &lt;code&gt;Deploy&lt;/code&gt; button in the AWS Management Console. Elastic Beanstalk will then deploy your application to AWS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor your application.&lt;/strong&gt; Elastic Beanstalk provides built-in monitoring for your application, including health checks, metrics, and logs.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;In Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AWS Beanstalk has been a game-changer for me as a developer. It has allowed me to overcome one of the biggest challenges I faced and has given me more time to focus on developing my application. The automatic scaling, security features, and ease of deployment have made Beanstalk my go-to solution for deploying and scaling my applications. If you're a developer facing similar challenges, I highly recommend giving AWS Beanstalk a try. It's like having your own personal assistant for your application!&lt;/p&gt;

&lt;p&gt;Thanks for reading ❤&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Overcoming Front-End Back-End Coupling with AWS Event-Driven Architecture</title>
      <dc:creator>Marawan Mamdouh</dc:creator>
      <pubDate>Sat, 15 Apr 2023 04:15:49 +0000</pubDate>
      <link>https://dev.to/aws-builders/overcoming-front-end-back-end-coupling-with-aws-event-driven-architecture-3ob9</link>
      <guid>https://dev.to/aws-builders/overcoming-front-end-back-end-coupling-with-aws-event-driven-architecture-3ob9</guid>
      <description>&lt;h2&gt;
  
  
  introduction
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;As a developer, I've always been interested in event-driven architectures (EDAs) and how they can improve the overall performance and scalability of web applications. However, I never truly understood the power of EDAs until I faced a real problem with a project I was working on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The project was a web application that required real-time updates to be displayed on the user interface. Users needed to be able to see changes made by other users in real-time without having to manually refresh the page. Initially, I implemented a solution that involved continuously polling the server for updates, but this approach was not only resource-intensive, but it also led to a slow and unresponsive performance.&lt;/p&gt;

&lt;p&gt;It was then that I realized that what I needed was an EDA that would allow me to send real-time updates to the front-end without continuously polling the server. I knew that this would require a lot of work and was unsure where to start.&lt;/p&gt;

&lt;p&gt;That's when I decided to turn to AWS, a cloud computing platform that offers a wide range of serverless services, including AWS Lambda, AWS API Gateway, and AWS SNS. These services would allow me to build a scalable and efficient EDA that would work seamlessly with my front-end application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How AWS Serverless Services Helped Me Build an EDA
&lt;/h2&gt;

&lt;p&gt;I started by using AWS Lambda, a serverless compute service that lets you run your code without provisioning or managing servers. With Lambda, I could write a function that would be triggered whenever an event occurred. I wrote a function that would be triggered whenever a user made a change to the application. The function would then send a message to an SNS topic using the AWS SNS service.&lt;/p&gt;

&lt;p&gt;AWS SNS, or Simple Notification Service, is a fully managed pub/sub messaging service that enables you to send messages to multiple recipients at once. With SNS, I could create a topic and subscribe to all the clients that needed to receive real-time updates to that topic. Whenever a message was sent to the topic, SNS would automatically distribute it to all subscribed clients.&lt;/p&gt;

&lt;p&gt;To connect the front-end application to the AWS SNS service, I used AWS API Gateway, a fully managed service that makes it easy to create, deploy, and manage APIs at any scale. With API Gateway, I created an endpoint that would receive messages from the SNS topic and send them to the connected clients using web sockets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using AWS Serverless Services to Build EDAs
&lt;/h2&gt;

&lt;p&gt;There are many benefits to using AWS serverless services to build EDAs. These benefits include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; AWS serverless services are designed to scale automatically with demand. This means that you don't have to worry about provisioning or managing servers, and you can focus on building your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability:&lt;/strong&gt; AWS serverless services are highly reliable and are designed to be highly available. This means that your application will be available even if there are problems with individual servers or regions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost-effectiveness:&lt;/strong&gt; AWS serverless services are very cost-effective. You only pay for the resources that you use, and you don't have to worry about upfront costs or long-term commitments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;The result was a highly scalable and efficient EDA that allowed real-time updates to be sent to the front-end application without continuously polling the server. The front-end application was now highly responsive and provided an excellent user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  In Conclusion
&lt;/h2&gt;

&lt;p&gt;Event-driven architectures have become a crucial aspect of modern web development, and using AWS serverless services has made it easier than ever to build highly scalable and efficient EDAs. By leveraging services like AWS Lambda, AWS SNS, and AWS API Gateway, developers can build highly responsive and scalable web applications that provide an excellent user experience.&lt;/p&gt;

&lt;p&gt;To those who are considering implementing an EDA, I highly recommend exploring AWS serverless services. With a little bit of effort and some knowledge of these services, you can build highly efficient and scalable EDAs that will take your web development projects to the next level.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>serverless</category>
      <category>eventdriven</category>
    </item>
  </channel>
</rss>
