<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Hardeep Jethwani</title>
    <description>The latest articles on Forem by Hardeep Jethwani (@hardeepjethwani).</description>
    <link>https://forem.com/hardeepjethwani</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%2F1050172%2F730c37c4-780f-40c6-9550-1223621f20b2.png</url>
      <title>Forem: Hardeep Jethwani</title>
      <link>https://forem.com/hardeepjethwani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hardeepjethwani"/>
    <language>en</language>
    <item>
      <title>VAR, LET, &amp; CONST in JavaScript</title>
      <dc:creator>Hardeep Jethwani</dc:creator>
      <pubDate>Tue, 23 Dec 2025 14:33:33 +0000</pubDate>
      <link>https://forem.com/aws-builders/var-let-const-in-javascript-52fa</link>
      <guid>https://forem.com/aws-builders/var-let-const-in-javascript-52fa</guid>
      <description>&lt;h1&gt;
  
  
  🤹‍♂️ &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt;, and &lt;code&gt;const&lt;/code&gt; in JavaScript
&lt;/h1&gt;

&lt;h2&gt;
  
  
  &lt;em&gt;Three variables walk into a scope… and only two behave properly&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;If you’ve worked with JavaScript, you’ve definitely met these three:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They look similar.&lt;br&gt;
They behave very differently.&lt;br&gt;
And one of them (&lt;code&gt;var&lt;/code&gt;) is responsible for a lot of emotional damage in production systems 😄&lt;/p&gt;

&lt;p&gt;Let’s understand &lt;strong&gt;what really happens behind the scenes&lt;/strong&gt;, without jargon overload and without falling asleep.&lt;/p&gt;


&lt;h2&gt;
  
  
  🧠 How JavaScript Runs Your Code (Very Important)
&lt;/h2&gt;

&lt;p&gt;JavaScript doesn’t execute your code line by line immediately.&lt;br&gt;
It first &lt;strong&gt;prepares everything&lt;/strong&gt;, then runs it.&lt;/p&gt;
&lt;h3&gt;
  
  
  JavaScript runs in two phases:
&lt;/h3&gt;
&lt;h3&gt;
  
  
  1️⃣ Memory Creation Phase
&lt;/h3&gt;

&lt;p&gt;The JS engine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scans the entire code&lt;/li&gt;
&lt;li&gt;Allocates memory for variables &amp;amp; functions&lt;/li&gt;
&lt;li&gt;Does &lt;strong&gt;not&lt;/strong&gt; assign actual values yet&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2️⃣ Execution Phase
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Executes code line by line&lt;/li&gt;
&lt;li&gt;Assigns values&lt;/li&gt;
&lt;li&gt;Runs functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This all happens inside something called an &lt;strong&gt;Execution Context&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  🧪 &lt;code&gt;var&lt;/code&gt; — The OG Troublemaker
&lt;/h2&gt;

&lt;p&gt;Let’s start with an example everyone has seen:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Expected by beginners:
&lt;/h3&gt;

&lt;p&gt;❌ Error&lt;/p&gt;

&lt;h3&gt;
  
  
  Given by JavaScript:
&lt;/h3&gt;

&lt;p&gt;✅ &lt;code&gt;undefined&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Why? Because JavaScript is… forgiving.&lt;/p&gt;

&lt;h3&gt;
  
  
  Behind the scenes 👇
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Memory Phase&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Execution Phase&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// undefined&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key takeaways about &lt;code&gt;var&lt;/code&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;✅ Hoisted&lt;/li&gt;
&lt;li&gt;✅ Initialized with &lt;code&gt;undefined&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;❌ Not block-scoped&lt;/li&gt;
&lt;li&gt;❌ Can be redeclared&lt;/li&gt;
&lt;li&gt;❌ Easy to mess up&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚨 &lt;code&gt;var&lt;/code&gt; Does Not Respect Block Scope
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;I should not escape&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 😱 It escaped&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; is &lt;strong&gt;function-scoped&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;{}&lt;/code&gt; blocks mean nothing to it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This behavior caused &lt;strong&gt;real bugs in real applications&lt;/strong&gt;, which is why &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; were introduced.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Enter &lt;code&gt;let&lt;/code&gt; — The Responsible One
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;❌ Error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ReferenceError: Cannot access 'b' before initialization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  But wait… isn’t &lt;code&gt;let&lt;/code&gt; hoisted?
&lt;/h3&gt;

&lt;p&gt;👉 &lt;strong&gt;Yes, it is hoisted. Plot twist.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So why the error?&lt;/p&gt;




&lt;h2&gt;
  
  
  ⏳ Temporal Dead Zone (TDZ) — Explained Simply
&lt;/h2&gt;

&lt;p&gt;TDZ is the time between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory allocation&lt;/li&gt;
&lt;li&gt;Variable initialization&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Memory Phase
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;uninitialized&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Execution Phase
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ❌ TDZ error&lt;/span&gt;
&lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;         &lt;span class="c1"&gt;// TDZ ends here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The JS engine basically says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I know you exist… but don’t touch me yet.”&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🔐 Block Scope (Finally!)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ❌ ReferenceError&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; respects block boundaries.&lt;br&gt;
Much safer. Much cleaner.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔒 &lt;code&gt;const&lt;/code&gt; — The Strict One
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;pi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.14159&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ❌ TypeError&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rules of &lt;code&gt;const&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Must be initialized immediately&lt;/li&gt;
&lt;li&gt;Cannot be reassigned&lt;/li&gt;
&lt;li&gt;Block-scoped&lt;/li&gt;
&lt;li&gt;Hoisted (with TDZ)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ❌ SyntaxError&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript wants commitment here.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤯 The Famous &lt;code&gt;const&lt;/code&gt; + Object Confusion
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hardeep&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Singh&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ✅ Allowed&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;           &lt;span class="c1"&gt;// ❌ Not allowed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;const&lt;/code&gt; means:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“The &lt;strong&gt;reference&lt;/strong&gt; cannot change, not the contents.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Address is fixed&lt;/li&gt;
&lt;li&gt;Furniture inside can move&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📊 Quick Comparison Table
&lt;/h2&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;var&lt;/th&gt;
&lt;th&gt;let&lt;/th&gt;
&lt;th&gt;const&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Scope&lt;/td&gt;
&lt;td&gt;Function&lt;/td&gt;
&lt;td&gt;Block&lt;/td&gt;
&lt;td&gt;Block&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hoisted&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Initialized on hoisting&lt;/td&gt;
&lt;td&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌ TDZ&lt;/td&gt;
&lt;td&gt;❌ TDZ&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redeclare&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reassign&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recommended today&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 Behind the Scenes (Slightly Nerdy)
&lt;/h2&gt;

&lt;p&gt;Internally, JavaScript maintains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Variable Environment&lt;/strong&gt; → &lt;code&gt;var&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lexical Environment&lt;/strong&gt; → &lt;code&gt;let&lt;/code&gt; &amp;amp; &lt;code&gt;const&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; leaks scope&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; don’t&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Best Practices (Learned the Hard Way)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Use &lt;code&gt;const&lt;/code&gt; by default&lt;/li&gt;
&lt;li&gt;✅ Use &lt;code&gt;let&lt;/code&gt; only when reassignment is required&lt;/li&gt;
&lt;li&gt;❌ Avoid &lt;code&gt;var&lt;/code&gt; unless you’re working on legacy code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If JavaScript were designed today, &lt;code&gt;var&lt;/code&gt; probably wouldn’t exist.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎯 Final Thoughts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;var&lt;/code&gt; → risky and outdated&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt; → safe and flexible&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;const&lt;/code&gt; → safest and preferred&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;JavaScript didn’t get weird.&lt;br&gt;
We just finally understood how it works 😄&lt;/p&gt;

&lt;p&gt;So, whether you're seeking JS advice, a good laugh, or simply a friendly chat about code and coffee preferences, I'm just a click away on these cloud-astic platforms. &lt;/p&gt;

&lt;p&gt;LinkedIn: 🚀💼 &lt;a href="https://www.linkedin.com/in/hardeepjethwani/" rel="noopener noreferrer"&gt;hardeepjethwani@LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TopMate: ☕🤝 &lt;a href="http://topmate.io/hardeepjethwani" rel="noopener noreferrer"&gt;hardeepjethwani@topmate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instagram: 📸🌩️ &lt;a href="https://www.instagram.com/hardeepjethwani/" rel="noopener noreferrer"&gt;hardeepjethwani@Instagram&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;X: 🐦☁️ &lt;a href="https://x.com/hardeepjethwani" rel="noopener noreferrer"&gt;hardeepjethwani@X&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Soundtrack Sorcery: Extracting Hidden Harmonies from Your Videos with AWS</title>
      <dc:creator>Hardeep Jethwani</dc:creator>
      <pubDate>Wed, 21 Feb 2024 18:20:23 +0000</pubDate>
      <link>https://forem.com/aws-builders/soundtrack-sorcery-extracting-hidden-harmonies-from-your-videos-with-aws-5hnl</link>
      <guid>https://forem.com/aws-builders/soundtrack-sorcery-extracting-hidden-harmonies-from-your-videos-with-aws-5hnl</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTE: This is a repost of my&lt;/strong&gt; &lt;a href="https://blog.hardeepjethwani.com/soundtrack-sorcery-extracting-hidden-harmonies-from-your-videos-with-aws"&gt;Original Blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🎬 Lights, camera, action! You've captured some fantastic videos, but there's a tiny twist to our story. We're not making the videos silent film stars; we're giving the soundtrack the limelight it deserves.&lt;/p&gt;

&lt;p&gt;🌟 In this whimsical journey through the cloud, I'll show you how to take your video uploads and, with the help of AWS S3, Lambda, and AWS MediaConvert, conjure the audio right out of them. It's like pulling a rabbit out of a hat, but in our world, I'm pulling melodies out of videos! Join me for a magical adventure where your videos reveal their musical talents, and I promise you a touch of humour, a pinch of technical enchantment, and a whole lot of AWS magic. 🪄🎶&lt;/p&gt;

&lt;p&gt;So no more waiting, Let's dive in !!&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this blog, our main focus will be on crafting a workflow within the AWS platform, enabling users to effortlessly extract audio (MP4) from their video files (MP4). To achieve this, we'll harness the power of several key AWS services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Amazon S3&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS Lambda&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS Media Convert&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS IAM&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Functional Flow
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferdu8151z2kn7m8qdwxa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferdu8151z2kn7m8qdwxa.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the above workflow diagram, It explains how the video file flows and you get the desired MP4 Audio File. Below are the high-level steps of the workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The user uploads the MP4 video file to an S3 Bucket, Let's name it here as &lt;code&gt;video2audio-source-video-bucket&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;S3 Event Notification is triggered on file upload event on the bucket &lt;code&gt;video2audio-source-video-bucket&lt;/code&gt;. Event Notification hits the desired target i.e., Lambda function (named video2AudioLambda) in this case.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Lambda function creates a Media Convert Job with the respective Media Convert Properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Media Convert Job fetches the Video file from the S3 bucket from which Audio has to be extracted&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Media Convert Job sends the generated audio file to the output S3 bucket that is configured in the Media Convert Properties. Let's consider the output bucket name here as &lt;code&gt;video2audio-target-audio-bucket&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The audio file is available for download from the S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Building the system
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Creating the S3 Buckets
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Login to the AWS Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to the S3 Service Dashboard and click on "&lt;strong&gt;&lt;em&gt;Create bucket&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will land on a page where you have to fill in the name of the S3 bucket as per your choice (here I have used &lt;code&gt;video2audio-source-audio-bucket&lt;/code&gt; for bucket to be used for MP4 video files and &lt;code&gt;video2audio-target-video-bucket&lt;/code&gt; for the bucket to be used to export the MP4 Audio).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Important Note: S3 bucket names are to be kept globally unique. In case the name is not available then you can use another name accordingly&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Choose the region according to your choice leaving the rest of the details as it is and click on "&lt;strong&gt;&lt;em&gt;Create Button&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the same steps for both of the source and target buckets and the buckets will be created which you can find on the S3 dashboard.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq04jpuynpeo7mpbfor6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkq04jpuynpeo7mpbfor6.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up the Lambda function
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In our case, the Lambda function will be triggered by the S3 event notification on the upload of a file to the source S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lambda function will make use of &lt;strong&gt;"Create Job"&lt;/strong&gt; API call to AWS Media Convert service. Where Media Convert will be responsible for the Video to Audio Conversion.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So as the Lambda function has to access the Media Convert service to create a Job, We will have to create a role which has permissions to create the job. Let's create one.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Creating IAM Role for Lambda Function
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Jump on to the IAM Service and them in the Roles section for creating the role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Create Role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You will land on the IAM Role creation page which shows 3 steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Selecting Trusted Entity:&lt;/strong&gt; We are creating this role to be attached to a AWS Service i.e., Lambda here. So we will select "AWS Lambda" in trusted Entity Types. For the use case, we will select "Lambda".&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghshw18cgo5lrlvvfyiu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghshw18cgo5lrlvvfyiu.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add Permissions:&lt;/strong&gt; We will add the AWS MAnaged Policies to our role named "&lt;a href="https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/policies/details/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2FAWSElementalMediaConvertFullAccess"&gt;AWSElementalMediaConvertFullAccess&lt;/a&gt;" which will allow our Lambda to perform respective operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq22lzc46r5grqcsdjp7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq22lzc46r5grqcsdjp7.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name, Review &amp;amp; Create:&lt;/strong&gt; In the Final stage you can add the name for your role (here &lt;strong&gt;video2AudioMediaConvertRole&lt;/strong&gt;). Review the permissions and create the role.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2pd1adaxiy0iesfmcag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2pd1adaxiy0iesfmcag.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvy9xxw0w4vvuo6vjilzp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvy9xxw0w4vvuo6vjilzp.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;So now as our Lambda function Role is created, we will jump back to understand further the requirements of Media Convert Properties.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Understanding the Media Convert "Create Job" API Call configuration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the Create Job call, we need to send the configuration properties of the Media Convert Job. Configuration details for the job will be in JSON format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Below Configuration Properties are to be set in the JSON:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Queue ARN:&lt;/strong&gt; The "Queue" is set to a specific AWS Elemental MediaConvert queue. This is where the job will be processed. The "Default" queue is commonly used when you don't have specific queue requirements. We will be using the Default Queue for which ARN is of format:
&lt;code&gt;arn:aws:mediaconvert:&amp;lt;AWS-Region&amp;gt;:&amp;lt;AWS-Account-ID&amp;gt;:queues/Default&lt;/code&gt;
For this blog post, I have used &lt;strong&gt;"us-east-1"&lt;/strong&gt; region.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role:&lt;/strong&gt; The "Role" specifies the IAM role that Media Convert assumes to access the necessary resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OutputGroups:&lt;/strong&gt; This section defines the output settings. In our case, it's set to create a single "File Group" with an MP4 container, indicating that the output will be in MP4 format. Inside the "File Group," it defines the audio settings. The audio source is selected as "Audio Selector 1," and it uses AAC codec settings with a bitrate of 96,000 bits per second and a sample rate of 48,000 Hz.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OutputGroupSettings:&lt;/strong&gt; This section specifies the settings for the output file. It defines the destination S3 bucket where the output audio file will be saved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inputs:&lt;/strong&gt; Here, it defines the input settings, including the source video file path in our S3 bucket.&lt;/li&gt;
&lt;li&gt;Below JSON properties are to be used in our case.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Queue"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:mediaconvert:us-east-1:&amp;lt;AWS:ACCOUNT:ID&amp;gt;:queues/Default"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"UserMetadata"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:iam::&amp;lt;&amp;lt;AWS:ACCOUNT:ID&amp;gt;:role/mediaConvertRole"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"OutputGroups"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"Name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"File Group"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"Outputs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"ContainerSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="nl"&gt;"Container"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MP4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="nl"&gt;"Mp4Settings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"AudioDescriptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                                    &lt;/span&gt;&lt;span class="nl"&gt;"AudioSourceName"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Audio Selector 1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                    &lt;/span&gt;&lt;span class="nl"&gt;"CodecSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                                        &lt;/span&gt;&lt;span class="nl"&gt;"Codec"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AAC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                        &lt;/span&gt;&lt;span class="nl"&gt;"AacSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                                            &lt;/span&gt;&lt;span class="nl"&gt;"Bitrate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;96000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                            &lt;/span&gt;&lt;span class="nl"&gt;"CodingMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"CODING_MODE_2_0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                            &lt;/span&gt;&lt;span class="nl"&gt;"SampleRate"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;48000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                                    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"OutputGroupSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="nl"&gt;"Type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"FILE_GROUP_SETTINGS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="nl"&gt;"FileGroupSettings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"Destination"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"s3://"&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;output_bucket&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;output_file_key&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Inputs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"AudioSelectors"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="nl"&gt;"Audio Selector 1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"DefaultSelection"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"DEFAULT"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"VideoSelector"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"TimecodeSource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ZEROBASED"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"FileInput"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"s3://"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;input_bucket&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;input_file_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: Make sure to replace the Bucket Name, Role Name, Account ID, Region and File Name according to your usage.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Wait now you might be thinking about where this Role in the above property came from. So, as you remember, Our Media Convert Job will pull the changes from the source S3 bucket, Convert the Video to Audio and Push the Audio file to S3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So to perform these operations, the Media Convert Job should be assigned a role with respective permissions. Let's understand the Role creation for the Media Convert Job in our case below.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Creating IAM Role for Media Convert Job
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Jump on to the IAM Service and then in the Roles section to create the role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Create Role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You will land on the IAM Role creation page which shows 3 steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Selecting Trusted Entity:&lt;/strong&gt; We are creating this role to be attached to a AWS Service i.e., &lt;strong&gt;Media Convert&lt;/strong&gt; here. So we will select "&lt;strong&gt;MediaConvert&lt;/strong&gt;" in trusted Entity Types. For the use case, we will select "&lt;strong&gt;MediaConvert&lt;/strong&gt;".&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1v3qw4ol21zpq1uxm2r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu1v3qw4ol21zpq1uxm2r.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add Permissions:&lt;/strong&gt; For Media Convert case, we will see that, we already have two AWS MAnaged Policies attached i.e., &lt;strong&gt;AmazonS3FullAccess&lt;/strong&gt; &amp;amp; &lt;strong&gt;AmazonAPIGatewayInvokeFullAccess&lt;/strong&gt;. These two policies are enough for our case as we just need access to the S3 bucket via Media Convert.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F824em9kijwegfj89furw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F824em9kijwegfj89furw.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name, Review &amp;amp; Create:&lt;/strong&gt; In the Final stage you can add the name for your role (here &lt;strong&gt;mediaConvertRole&lt;/strong&gt;). Review the permissions and create the role.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2iogttc3kdwwwfh1vcfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2iogttc3kdwwwfh1vcfs.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlnr8k29zmbr7wdbf60x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlnr8k29zmbr7wdbf60x.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
So, now that we are done with the Role creation tasks, We can move on to the task of creating our Lambda Function using Python.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Creating the Lambda Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to the AWS Lambda Service in AWS Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on "&lt;strong&gt;Create a function&lt;/strong&gt;" button. You will land on the Lambda creation page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Author from Scratch&lt;/strong&gt; as we are going to write our lambda function code&lt;/li&gt;
&lt;li&gt;Name as &lt;strong&gt;video2AudioLambda&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Python 3.11&lt;/strong&gt; as the lambda runtime (You can make use of any other runtime too but the code changes will be needed accordingly)&lt;/li&gt;
&lt;li&gt;Expand "&lt;strong&gt;Change default execution role&lt;/strong&gt;" Select "&lt;strong&gt;Use an existing Role&lt;/strong&gt;" &amp;amp; then &lt;strong&gt;&lt;em&gt;choose the IAM role that we created for Lambda (video2AudioMediaConvertRole)&lt;/em&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on "&lt;strong&gt;Create Function&lt;/strong&gt;" and your raw Lambda function will be created.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wf5iokzsrh3sbqkcv7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8wf5iokzsrh3sbqkcv7d.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthwlmje454rgxm7isx71.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthwlmje454rgxm7isx71.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait guys, the job is not yet done, the actual thrill is below !!!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We have to make use of the Python code given below. Paste it down in our Lambda console and Click on Deploy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So this lambda function written in Python creates a &lt;code&gt;mediaconvert client&lt;/code&gt; by making use of &lt;code&gt;boto3&lt;/code&gt; library. Then this client is used for creating a media conversion job using "&lt;strong&gt;Create Job&lt;/strong&gt;" API call.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;IMPORTANT:&lt;/em&gt;&lt;/strong&gt; There is no need to hardcode the name of the Source S3 bucket here because, later on, we are going to configure the &lt;strong&gt;S3 Event Notification&lt;/strong&gt;, which is then going to trigger the Lambda function. So the Event object will have all the details of the Bucket and Object that was uploaded to S3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;However, we need to hardcode the target bucket name &amp;amp; the target audio file name &lt;em&gt;(Update the bucket name as per the name that you have used)&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have made use of the Media Convert properties that were explained in the above section and have passed the same to the &lt;code&gt;create_job&lt;/code&gt; function call&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AWS Lambda Python Code&lt;/strong&gt;&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Initialize the MediaConvert client
&lt;/span&gt;    &lt;span class="c1"&gt;# Get the Endpoint URL from --&amp;gt; MediaConvert --&amp;gt; Account --&amp;gt; API Endpoint
&lt;/span&gt;    &lt;span class="n"&gt;mediaconvert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mediaconvert&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;endpoint_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://vasjpylpa.mediaconvert.us-east-1.amazonaws.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;input_bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Records&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bucket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;input_file_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Records&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;object&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;key&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;output_bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;video2audio-target-audio-bucket&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;output_file_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;output-audio&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="c1"&gt;# Create a job settings JSON
&lt;/span&gt;    &lt;span class="n"&gt;job_settings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Queue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:mediaconvert:us-east-1:666541739853:queues/Default&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UserMetadata&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Role&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::666541739853:role/mediaConvertRole&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Settings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OutputGroups&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;File Group&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Outputs&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ContainerSettings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Container&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MP4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mp4Settings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
                            &lt;span class="p"&gt;},&lt;/span&gt;
                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AudioDescriptions&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                                &lt;span class="p"&gt;{&lt;/span&gt;
                                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AudioSourceName&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Audio Selector 1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CodecSettings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Codec&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AAC&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AacSettings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bitrate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;96000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CodingMode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CODING_MODE_2_0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SampleRate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;48000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                        &lt;span class="p"&gt;},&lt;/span&gt;
                                    &lt;span class="p"&gt;},&lt;/span&gt;
                                &lt;span class="p"&gt;}&lt;/span&gt;
                            &lt;span class="p"&gt;],&lt;/span&gt;
                        &lt;span class="p"&gt;}&lt;/span&gt;
                    &lt;span class="p"&gt;],&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OutputGroupSettings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Type&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FILE_GROUP_SETTINGS&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FileGroupSettings&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Destination&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s3://&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output_bucket&lt;/span&gt;
                            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output_file_key&lt;/span&gt;
                        &lt;span class="p"&gt;},&lt;/span&gt;
                    &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Inputs&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AudioSelectors&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Audio Selector 1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DefaultSelection&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;DEFAULT&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
                    &lt;span class="p"&gt;},&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;VideoSelector&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;TimecodeSource&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ZEROBASED&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;FileInput&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s3://&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;input_bucket&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;input_file_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;# Start the MediaConvert job
&lt;/span&gt;    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mediaconvert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_job&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;job_settings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MediaConvert job started successfully.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have to copy the above code and paste it to the Lambda console and then click on Deploy!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3z7jm5sd4tocv9ws9i9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3z7jm5sd4tocv9ws9i9.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In above Python code you might have noticed that we have made use of an endpoint URL (&lt;code&gt;https://vasjpylpa.mediaconvert.us-east-1.amazonaws.com&lt;/code&gt;)to create the mediaConvert Client. You can get that endpoint URL by going into your Media Convert Service in AWS Console at path: &lt;code&gt;MediaConvert --&amp;gt; Account --&amp;gt; API Endpoint&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucmm2d3qetqwjcywapkq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fucmm2d3qetqwjcywapkq.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Configuring S3 Event Notification&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to AWS S3 Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on your bucket (&lt;code&gt;video2audio-source-video-bucket&lt;/code&gt;). Then go to "&lt;strong&gt;Properties&lt;/strong&gt;" section of the same.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On Scrolling down, you will find the section for "&lt;strong&gt;Event Notification&lt;/strong&gt;". You have to click on "&lt;strong&gt;Create Event Notification&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc6ihg9d9zyh2s0alv1a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc6ihg9d9zyh2s0alv1a2.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You will land on a page to fill in the details for S3 Event trigger action and the target.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can name your event and then select the format of the file that we want to trigger our Audio Conversion action on. So here we are using &lt;strong&gt;&lt;em&gt;".mp4"&lt;/em&gt;&lt;/strong&gt; as the source file format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Event Types&lt;/strong&gt;, Just check on the "&lt;strong&gt;All Object Creation Events&lt;/strong&gt;", as we have to trigger this conversion on every file creation/updation event&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to the bottom to fill in the &lt;strong&gt;Destination&lt;/strong&gt; details !! In our case it is a &lt;strong&gt;lambda function&lt;/strong&gt; named "&lt;strong&gt;video2AudioLambda&lt;/strong&gt;" (You can also choose to fill the ARN of the lambda function)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And then Just click on the save changes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhw5dv5gyhb606ykfed0z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhw5dv5gyhb606ykfed0z.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Woohoooo we have finally completed the Build phase !!! Now it is the time to test our design....&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing the setup
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We have to upload a MP4 video file in the source bucket (here &lt;code&gt;video2audio-source-video-bucket)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then in a few seconds, you can check your target bucket (here &lt;code&gt;video2audio-target-audio-bucket&lt;/code&gt;) And you will finally see an MP4 Audio file over there.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0vnypiruubzak2lflpku.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0vnypiruubzak2lflpku.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Learning Capsule points
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Checking Lambda Executions: In case you want to check the Lambda Execution, you will have to first Assign an IAM policy to your Lambda Role for CloudWatch Logs Access. Which will then allow your Lambda Function to publish logs to your CloudWatch Log Dashboard.
You can access the logs via Going into the Log Group and checking for the LogGroup &lt;code&gt;"/aws/lambda/&amp;lt;your-lambda-function-name&amp;gt;"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhr6bzzkutw355d524wu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhr6bzzkutw355d524wu.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Checking Job Submissions in Media Convert Service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the Media Convert Service on AWS Console.&lt;/li&gt;
&lt;li&gt;Click on the Jobs option in the Menu on the Left.&lt;/li&gt;
&lt;li&gt;You will find all of the Job Submissions and you can check the status of each respective job easily.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fozen9jdxmbv5vyjrp5ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fozen9jdxmbv5vyjrp5ux.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As we conclude this journey into the fascinating realm of audio extraction from video, I hope you've not only gained valuable insights but also a newfound appreciation for the versatility of AWS. The possibilities are endless when you combine technology with creativity.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Thank you for being a part of this adventure. Until next time, happy cloud computing!!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you have any questions, ideas, or experiences you'd like to share, I'm all ears. Let's keep the conversation going in the comments section below. And remember, this is just the beginning; there's a world of innovation waiting for you in the cloud. Stay curious, keep exploring, and keep making technology work for you. Follow me on social media, where I promise to share cloud wisdom with a side of chuckles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LinkedIn:&lt;/strong&gt; Connect with me on LinkedIn, where my cloud prowess is only rivalled by my talent for finding the perfect GIF for every situation. 🚀💼 &lt;a href="https://www.linkedin.com/in/hardeepjethwani/"&gt;&lt;strong&gt;hardeepjethwani@LinkedIn&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TopMate:&lt;/strong&gt; Looking for a fellow cloud aficionado to share a virtual coffee with or brainstorm your next AWS masterpiece? Find me on TopMate! Because let's face it, cloud enthusiasts need to stick together. ☕🤝 &lt;a href="https://topmate.io/hardeepjethwani"&gt;&lt;strong&gt;hardeepjethwani@topmate&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Instagram:&lt;/strong&gt; For behind-the-scenes glimpses of my cloud adventures and occasional 'AWS Gone Wild' stories that even AWS engineers find amusing. 📸🌩️ &lt;a href="https://www.instagram.com/hardeepjethwani/"&gt;&lt;strong&gt;hardeepjethwani@Instagram&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X:&lt;/strong&gt; Join the cloud conversation on Twitter, where I drop cloud knowledge and quirky cloud memes faster than you can say 'Elastic Beanstalk.' 🐦☁️ &lt;a href="https://twitter.com/hardeepjethwani"&gt;&lt;strong&gt;hardeepjethwani@X&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, whether you're seeking cloud advice, a good laugh, or simply a friendly chat about cloud and coffee preferences, I'm just a click away on these cloud-tastic platforms. See you in the cloudisphere, fellow cloud builders!" 🌍☁️😄&lt;/p&gt;

&lt;p&gt;Want to support my cloud adventures and keep the coffee flowing? Feel free to buy me a virtual coffee. After all, coffee is the secret sauce behind every successful cloud deployment. ☕🙌&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The IT Comedy: An Amusing Guide to Network Ports on Linux and Beyond !</title>
      <dc:creator>Hardeep Jethwani</dc:creator>
      <pubDate>Sat, 14 Oct 2023 11:08:46 +0000</pubDate>
      <link>https://forem.com/aws-builders/the-it-comedy-an-amusing-guide-to-network-ports-on-linux-and-beyond--19nc</link>
      <guid>https://forem.com/aws-builders/the-it-comedy-an-amusing-guide-to-network-ports-on-linux-and-beyond--19nc</guid>
      <description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: This blog is a repost of my original blog which you can find at - &lt;a href="https://blog.hardeepjethwani.com/the-it-comedy-an-amusing-guide-to-network-ports-on-linux-and-beyond"&gt;https://blog.hardeepjethwani.com/the-it-comedy-an-amusing-guide-to-network-ports-on-linux-and-beyond&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the quirky realm of information technology, network ports are like the secret passages in a high-tech castle. Understanding which ones are the life of the party is essential for system administrators, network comedians, and anyone who wants to add a bit of fun to their IT game. This guide will provide you with insights into the wackiest network ports, their significance (or lack thereof), and best practices for keeping the network circus under control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Section 1: Understanding Network Ports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Picture network ports as doors with numbers—some are heavily guarded, while others are just wide open. They're grouped into three categories, sort of like a circus act:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Well-Known Ports (0-1023):&lt;/strong&gt; These are the rock stars, headlining the show with their fame and fortune. Everybody knows their moves.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Registered Ports (1024-49151):&lt;/strong&gt; These are the middle-aged port numbers. They've got some recognition, but they're not quite "The Beatles."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic or Private Ports (49152-65535):&lt;/strong&gt; These are like underground clubs. Not many know about them, but they have their own cult following.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Section 2: Common Network Ports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here are some of the network ports that are always in the spotlight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 22 (SSH):&lt;/strong&gt; This is the VIP entrance to your server. Only the cool kids with the right key can get in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 80 (HTTP):&lt;/strong&gt; It's like the highway to your website, where everyone's welcome.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 443 (HTTPS):&lt;/strong&gt; This is the secure version of the highway, with a secret handshake (SSL/TLS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 21 (FTP):&lt;/strong&gt; It's the dressing room for your files, where they prepare to perform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 25 (SMTP):&lt;/strong&gt; The postman's office, where emails are sent on their merry way.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 3306 (MySQL):&lt;/strong&gt; The backstage of your database, where the magic happens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 23 (Telnet):&lt;/strong&gt; It's the vintage telephone booth of IT, but use it wisely; it has a few holes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 67 (DHCP):&lt;/strong&gt; This is where IP addresses are handed out like party favors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 53 (DNS):&lt;/strong&gt; The directory service for the web. It translates names to numbers like a techy phone book.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 161 (SNMP):&lt;/strong&gt; The watchful eye in the control room, keeping an eye on all the IT antics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 68 (DHCP):&lt;/strong&gt; The place where devices ask for tickets to the network party.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 110 (POP3):&lt;/strong&gt; The inbox of your email server, where your messages await.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 143 (IMAP):&lt;/strong&gt; Another email stage, where messages are rehearsing for the big performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 67 (DHCP):&lt;/strong&gt; The backstage chaos where devices get assigned to the network show.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Port 69 (TFTP):&lt;/strong&gt; The quickest file transfer act in town, for those who like it fast.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these ports has its own gig, and they're at the heart of many IT operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Section 3: Security Considerations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Securing network ports is like putting a bouncer at the club's entrance. You want to keep the party safe:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Firewall Configuration:&lt;/strong&gt; Think of it as the guest list for the VIP section. Only allow the right people (or packets) inside.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access Control:&lt;/strong&gt; Imagine a velvet rope at the door. Not everyone gets to cross it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Intrusion Prevention:&lt;/strong&gt; It's like a security team with a net, ready to catch any misbehaving clowns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Least Privilege:&lt;/strong&gt; Only let performers backstage who have a legitimate role in the show.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Section 4: Less Common But Valuable Ports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While the common ports are busy in the limelight, some lesser-known ports play their own unique tune:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ICMP (Ping):&lt;/strong&gt; ICMP (I Can Make People) is the friendliest act in the networking world. It's all about saying hello and checking if someone's home.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SFTP (Port 22):&lt;/strong&gt; Secure File Transfer Protocol, with the ticket booth conveniently located at the SSH (Secret Side Hallway) entrance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Section 5: Tools for Port Scanning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Port scanning tools, like Nmap, are like the x-ray vision of the IT universe. Use them to see through the doors and check if everything's in order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Section 6: Case Studies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's look at a few case studies to see how these ports bring laughter (or sometimes chaos) to real-world IT parties:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Case Study 1 - ICMP (Ping):&lt;/strong&gt; ICMP is like a friendly neighbour who knocks on the door to see if you're home. A bit nosy, but well-intentioned.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Case Study 2 - SFTP (Port 22):&lt;/strong&gt; Secure File Transfer Protocol is the bouncer at the secret club within the club. Only the chosen ones get through.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Section 7: Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding network ports is like being a circus ringleader, keeping a show with many acts running smoothly. The most useful network ports, like SSH (port 22), HTTP (port 80), and HTTPS (port 443), are the circus stars, but don't forget the lesser-known ones—they have their unique charm.&lt;/p&gt;

&lt;p&gt;By following best practices, securing the party with bouncers (firewalls), and regularly checking for misbehaving clowns (port scanning), you'll ensure that your network circus is the talk of the town.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thank you for joining me in a thrilling Circus Show of N/W Ports. Happy Learning !! 😄🏰
&lt;/h3&gt;

&lt;p&gt;Do you have more burning questions or just need a daily dose of tech humor? Follow me on social media, where I promise to share cloud wisdom with a side of chuckles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LinkedIn:&lt;/strong&gt; Connect with me on LinkedIn, where my cloud prowess is only rivalled by my talent for finding the perfect GIF for every situation. 🚀💼 &lt;a href="https://www.linkedin.com/in/hardeepjethwani/"&gt;hardeepjethwani@LinkedIn&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TopMate:&lt;/strong&gt; Looking for a fellow cloud aficionado to share a virtual coffee with or brainstorm your next AWS masterpiece? Find me on TopMate! Because let's face it, cloud enthusiasts need to stick together. ☕🤝 &lt;a href="https://topmate.io/hardeepjethwani"&gt;hardeepjethwani@topmate&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Instagram:&lt;/strong&gt; For behind-the-scenes glimpses of my cloud adventures and occasional 'AWS Gone Wild' stories that even AWS engineers find amusing. 📸🌩️ &lt;a href="https://www.instagram.com/hardeepjethwani/"&gt;hardeepjethwani@Instagram&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X:&lt;/strong&gt; Join the cloud conversation on Twitter, where I drop cloud knowledge and quirky cloud memes faster than you can say 'Elastic Beanstalk.' 🐦☁️ &lt;a href="https://twitter.com/hardeepjethwani"&gt;hardeepjethwani@X&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, whether you're seeking cloud advice, a good laugh, or simply a friendly chat about cloud formations and coffee preferences, I'm just a click away on these cloud-tastic platforms. See you in the cloudisphere, fellow cloud builders!" 🌍☁️😄&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Turning Text into Talk on AWS: The Polly-Phonic Symphony of S3, Lambda and Amazon Polly</title>
      <dc:creator>Hardeep Jethwani</dc:creator>
      <pubDate>Mon, 09 Oct 2023 05:47:15 +0000</pubDate>
      <link>https://forem.com/aws-builders/turning-text-into-talk-on-aws-the-polly-phonic-symphony-of-s3-lambda-and-amazon-polly-3aid</link>
      <guid>https://forem.com/aws-builders/turning-text-into-talk-on-aws-the-polly-phonic-symphony-of-s3-lambda-and-amazon-polly-3aid</guid>
      <description>&lt;p&gt;🎉 Dear readers, welcome to the grand orchestration of the digital age, where we'll take you on a captivating journey from the realm of text to the symphonic world of spoken words. In this technological masterpiece, we'll explore how the dynamic quartet of AWS S3, Lambda, and Amazon Polly 📦🔗🧬🗣️ comes together to turn mere text into audio. So, get ready to be dazzled as we unravel 'Turning Text into Talk on AWS: The Polly-Phonic Symphony of S3, Lambda, and Amazon Polly.' 🎶 It's a show you won't wish to miss! 🚀 Happy Learning !!&lt;/p&gt;

&lt;p&gt;So Let's dive into the practical world now !!&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this blog, we are going to design a workflow that will be able to convert the text file of any transcript and convert them into an Audio MP3 file automatically without any manual Intervention.&lt;/p&gt;

&lt;h1&gt;
  
  
  Functional Flow
&lt;/h1&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%2Fidjlgdv93wwjlhyugjkt.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%2Fidjlgdv93wwjlhyugjkt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you can see in the above workflow diagram, It explains how the file flows and you get the desired MP3 File. Below are the high-level steps of the workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The file is uploaded to an S3 Bucket, Let's name it here as &lt;code&gt;text2talk-source-transcript-bucket&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;S3 Event Notification is triggered which is configured for the bucket &lt;code&gt;text2talk-source-transcript-bucket&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Target of the S3 Event Notification is the Lambda function (let's name it as "text2talk" which we will use to convert the text transcript file uploaded to S3 bucket text2audio-source-transcript-bucket&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The lambda function will fetch the text from the transcript file and send the content to Amazon Polly which will send back the data converted in form of an Audio file data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The audio file will finally be uploaded to another S3 bucket. Let's name it here as &lt;code&gt;text2talk-target-audio-bucket&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Building the system
&lt;/h1&gt;

&lt;h2&gt;
  
  
  -&amp;gt; Creating the S3 Buckets
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Login to the AWS console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to the S3 Service Dashboard and click on "&lt;strong&gt;Create bucket&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You will land on a page where you have to fill in the name of the S3 bucket as per your choice (here I have used &lt;code&gt;text2talk-source-transcript-bucket&lt;/code&gt; for bucket to be used for transcript text files and &lt;code&gt;text2talk-target-audio-bucket&lt;/code&gt; for bucket to be used export the Audio).&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Important Note&lt;/strong&gt;: S3 bucket names are to be kept globally unique. In case the name is not available then you can use another name accordingly&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose the region according to your choice leaving the rest of the details as it is and click on "&lt;strong&gt;&lt;em&gt;Create Button&lt;/em&gt;&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Follow the same steps for both of the source and target buckets and the buckets will be created which you can find on the S3 dashboard.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;h2&gt;
  
  
  -&amp;gt; Setting up the Lambda Function
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In our case, the lambda function will be accessing the S3 bucket to pull the transcript file and push the Audio file too !!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, the Lambda function will be making use of "Speech Synthesize" provided by Amazon Polly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So In this case, Our Lambda Function should have the respective permissions to access the S3 bucket and Polly API calls !!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So we will create an IAM role first which is then to be assigned to the Lambda function later.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  -&amp;gt; Creating IAM Role**
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Jump on to the IAM Service and them in the Roles section for creating the role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Create Role.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You will land on the IAM Role creation page which shows 3 steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Selecting Trusted Identity:&lt;/strong&gt; We are creating this role to be attached to a AWS Service i.e., Lambda here. So we will select "AWS Lambda" in trusted Entity Types. For the use case, we will select "Lambda".&lt;/li&gt;
&lt;li&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%2Ft8y2oydjlasga7fvraax.png" alt="Image description"&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Permissions:&lt;/strong&gt; We will add the AWS MAnaged Policies to our role named "&lt;strong&gt;AmazonPollyReadOnlyAccess&lt;/strong&gt;" &amp;amp; "&lt;strong&gt;AmazonS3FullAccess&lt;/strong&gt;" which will allow our Lambda to perform respective operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name, Review &amp;amp; Create:&lt;/strong&gt; In the Final stage you can add the name for your role (here text2talkRole). Review the permissions and create the role.&lt;/li&gt;
&lt;li&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%2F6e2fthh2dg80dibs7k5k.png" alt="Image description"&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;So now that we have created the IAM Role as per our needs we will jump on creating our Lambda function finally.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;-&amp;gt; Creating the Lambda Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to the AWS Lambda Service in AWS Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on "&lt;strong&gt;Create a function&lt;/strong&gt;" button. You will land to the Lambda creation page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select the following options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Author from Scratch&lt;/strong&gt; as we are going to write our lambda function code&lt;/li&gt;
&lt;li&gt;Name as &lt;strong&gt;text2talk&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Python 3.11&lt;/strong&gt; as the lambda runtime (You can make us of any other runtime too but the code changes will be needed accordingly)&lt;/li&gt;
&lt;li&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%2Fuu2xnd5jr2gn2bxlm73z.png" alt="Image description"&gt;&lt;/li&gt;
&lt;li&gt;Expand "&lt;strong&gt;Change default execution role&lt;/strong&gt;" Select "&lt;strong&gt;Use an existing Role&lt;/strong&gt;" &amp;amp; then &lt;strong&gt;&lt;em&gt;choose the IAM role that we created&lt;/em&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on "&lt;strong&gt;Create Function&lt;/strong&gt;" and your raw Lamda function will be created.&lt;/li&gt;
&lt;li&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%2F9mk3q9p4rmdmnobgray4.png" alt="Image description"&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Wait guys, the job is not yet done, the actual thrill is below !!!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We have to make use of the Python code below paste it down in our Lambda console and Click on Deploy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So this lambda function written in Python creates an &lt;code&gt;S3 client&lt;/code&gt; by making use of &lt;code&gt;boto3&lt;/code&gt; library. And then the S3 client is used for Pulling the file from our source S3 bucket.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;IMPORTANT:&lt;/strong&gt; There is no need to hardcode the name of the Source S3 bucket here because, later on, we are going to configure the &lt;strong&gt;S3 Event Notification&lt;/strong&gt;, which is then going to trigger the Lambda function. So the Event object will have all the details of the Bucket and Object that was uploaded to S3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;However, we need to hardcode the target bucket name &lt;em&gt;(Update the bucket name as per the name that you have used)&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This Python function also creates a client object for operating with polly (&lt;code&gt;polly_client&lt;/code&gt;). We are making use of &lt;code&gt;synthesize_speech&lt;/code&gt; call for Polly where we are passing the audio format, text format and the Voice ID Parameters&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We have passed the Voice ID parameter as "Salli" but you can play around with different voices and refer to &lt;a href="https://docs.aws.amazon.com/polly/latest/dg/voicelist.html" rel="noopener noreferrer"&gt;Amazon Polly Voice List Blog&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AWS Lambda Python Code&lt;/strong&gt;&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="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;

&lt;span class="c1"&gt;# Get the current timestamp
&lt;/span&gt;&lt;span class="n"&gt;current_time&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Format the timestamp as "ddmmyy"
&lt;/span&gt;&lt;span class="n"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;%d%m%y&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize AWS clients
&lt;/span&gt;&lt;span class="n"&gt;s3_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;polly_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;polly&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lambda_handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Define the source and destination S3 bucket and file names
&lt;/span&gt;    &lt;span class="n"&gt;source_bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Records&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;#These are the details received from the S3 Event and we are gathering bucket name and File name of the same
&lt;/span&gt;    &lt;span class="n"&gt;source_file_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Records&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;object&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="n"&gt;destination_bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;text2talk-target-audio-bucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;## Update the target bucket name accordingly as per bucket name in your account
&lt;/span&gt;    &lt;span class="n"&gt;destination_file_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;-audio.mp3&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

    &lt;span class="c1"&gt;# Fetch the text content from the source S3 bucket
&lt;/span&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s3_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Bucket&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;source_bucket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;source_file_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;utf-8&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Error fetching text from S3: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Use Amazon Polly to synthesize speech from the text
&lt;/span&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;polly_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;synthesize_speech&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;OutputFormat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;mp3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;VoiceId&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Salli&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;  &lt;span class="c1"&gt;# You can choose a different voice IDs too
&lt;/span&gt;        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;audio_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AudioStream&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Error synthesizing speech with Polly: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Upload the MP3 audio to the destination S3 bucket
&lt;/span&gt;    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;s3_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Bucket&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;destination_bucket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;destination_file_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Body&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;audio_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Error uploading MP3 to S3: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;statusCode&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;body&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Successfully converted and saved text to MP3: s3://&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;destination_bucket&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;destination_file_key&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You have to copy the above code and paste it to the Lambda console and then click on Deploy!!&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%2Fe5dqmg9315nwb2l9irt2.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%2Fe5dqmg9315nwb2l9irt2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So now what, We have our Lambda function ready !!&lt;/p&gt;

&lt;p&gt;Now we will move to our final step !! i.e, configuring S3 Event Notification on our source S3 bucket !!&lt;/p&gt;

&lt;h2&gt;
  
  
  -&amp;gt; Configuring S3 Event Notification
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to AWS S3 Console&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on your bucket (here &lt;code&gt;text2talk-source-transcript-bucket&lt;/code&gt;). And then go to "&lt;strong&gt;Properties&lt;/strong&gt;" section of the same.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;On Scrolling down, you will find the section for "&lt;strong&gt;Event Notification&lt;/strong&gt;". You have to click on "&lt;strong&gt;Create Event Notification&lt;/strong&gt;"&lt;/p&gt;&lt;/li&gt;
&lt;li&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%2F6xuep5v2d9kwp8yb3srl.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%2F6xuep5v2d9kwp8yb3srl.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will land on a page to fill in the details for S3 Event trigger action and the target.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can name your event and then select the format of the file that we want to trigger our Audio Conversion action on. So here we are using &lt;strong&gt;&lt;em&gt;".txt"&lt;/em&gt;&lt;/strong&gt; as the source file format.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Event Types&lt;/strong&gt;, Just check on the "&lt;strong&gt;All Object Creation Events&lt;/strong&gt;", as we have to trigger this conversion on every file creation/updation event&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll down to the bottom to fill in the &lt;strong&gt;Destination&lt;/strong&gt; details !! In our case it is a &lt;strong&gt;lambda function&lt;/strong&gt; named "&lt;strong&gt;text2talk&lt;/strong&gt;" (You can also choose to fill the ARN of the lambda function)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And then Just click on the save changes &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Woohoooo we have finally completed the Build phase !!! Now it is the time to test our design....&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing the setup !!!!
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You have to just upload a test file in the source bucket (here &lt;code&gt;text2talk-source-transcript-bucket)&lt;/code&gt; (I have made sample text which you can find &lt;a href="https://github.com/hardeepjethwani/BlogCodeFiles/blob/main/text2talk/text2talk-transcript.txt" rel="noopener noreferrer"&gt;HERE on GitHub !!&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then in a few seconds, you can check your target bucket (here ) Andddddd you will finally see an Audio file over there !! (You can find my results &lt;a href="https://github.com/hardeepjethwani/BlogCodeFiles/blob/main/text2talk/081023-audio.mp3" rel="noopener noreferrer"&gt;HERE on GitHub&lt;/a&gt;)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;So Finally we were able to make it up !!! Congratulations !!!&lt;/p&gt;

&lt;h3&gt;
  
  
  Thank you for joining me on this Polly-Phonic conversion journey, where reality is stranger than fiction, and the only drama involves coding conundrums. Happy cloud building, and may your infrastructure always stay drama-free! ☁️😄🏰
&lt;/h3&gt;

&lt;p&gt;Do you have more burning questions or just need a daily dose of cloud-related humor? Follow me on social media, where I promise to share cloud wisdom with a side of chuckles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;LinkedIn:&lt;/strong&gt; Connect with me on LinkedIn, where my cloud prowess is only rivalled by my talent for finding the perfect GIF for every situation. 🚀💼 &lt;a href="https://www.linkedin.com/in/hardeepjethwani/" rel="noopener noreferrer"&gt;hardeepjethwani@LinkedIn&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TopMate:&lt;/strong&gt; Looking for a fellow cloud aficionado to share a virtual coffee with or brainstorm your next AWS masterpiece? Find me on TopMate! Because let's face it, cloud enthusiasts need to stick together. ☕🤝 &lt;a href="https://topmate.io/hardeepjethwani" rel="noopener noreferrer"&gt;hardeepjethwani@topmate&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Instagram:&lt;/strong&gt; For behind-the-scenes glimpses of my cloud adventures and occasional 'AWS Gone Wild' stories that even AWS engineers find amusing. 📸🌩️ &lt;a href="https://www.instagram.com/hardeepjethwani/" rel="noopener noreferrer"&gt;hardeepjethwani@Instagram&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;X:&lt;/strong&gt; Join the cloud conversation on Twitter, where I drop cloud knowledge and quirky cloud memes faster than you can say 'Elastic Beanstalk.' 🐦☁️ &lt;a href="https://twitter.com/hardeepjethwani" rel="noopener noreferrer"&gt;hardeepjethwani@X&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, whether you're seeking cloud advice, a good laugh, or simply a friendly chat about cloud formations and coffee preferences, I'm just a click away on these cloud-tastic platforms. See you in the cloudisphere, fellow cloud builders!" 🌍☁️😄&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>aws</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
