<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by NathSantos on Medium]]></title>
        <description><![CDATA[Stories by NathSantos on Medium]]></description>
        <link>https://medium.com/@nathsantos2703?source=rss-61284f43b426------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*W9aVlLK09AYApkZL</url>
            <title>Stories by NathSantos on Medium</title>
            <link>https://medium.com/@nathsantos2703?source=rss-61284f43b426------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:44:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nathsantos2703/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Exploring Serverless Architectures with AWS: Authentication and Authorization.]]></title>
            <link>https://medium.com/@nathsantos2703/exploring-serverless-architectures-with-aws-authentication-and-authorization-a8b339820e81?source=rss-61284f43b426------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8b339820e81</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[aws-cognito]]></category>
            <dc:creator><![CDATA[NathSantos]]></dc:creator>
            <pubDate>Mon, 19 Aug 2024 21:01:28 GMT</pubDate>
            <atom:updated>2024-08-19T21:01:28.181Z</atom:updated>
            <content:encoded><![CDATA[<p>During the past week, I’ve been focusing on learning how to build well-structured serverless applications on AWS. I’ve decided to document my progress here, even if it’s just small steps…</p><p>I’ll start by discussing some different ways to secure our APIs, such as <strong>API Keys</strong>, <strong>Lambda Authorizers</strong>, and <strong>Cognito User Pool Authorizers</strong>. Each of these methods has its own unique features, and I’ll explain how each one works in the following lines:</p><h3>📌 <strong>API Keys</strong></h3><h4><strong>How it Works:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UlHEL35OM-KhI1QFt43EiA.png" /></figure><p>⇒ Create a unique API key in AWS API Gateway. The key is associated with a usage plan that defines access limits, such as how many requests can be made.</p><p>⇒ Then, as shown in the first diagram:</p><ul><li>The users accessing the API must send the API key in the request header (x-api-key).</li><li>API Gateway checks whether the key is valid and within the limits. If everything is correct, the request is processed.</li><li>In this way, the API key controls and monitors who can access the API and how many times.</li></ul><h4><strong>Use Cases:</strong></h4><p>⇒ Although it is a method, it is not recommended to use it alone for authentication and authorization. Instead, it can be used with other access control methods.</p><ul><li>API Key is a static stream, so anyone can take this string and share with anyone else. Also, if you use the same API key with multiple API gateways, any user who have access to that API is able to access all the APIs.</li></ul><p>⇒ Used to enforce throttling limits to APIs daily quota.</p><p>⇒ Can be used in microservices to acess internal APIs (from protected env’s).</p><h4>📌 Lambda Authorizer<br> <br><strong>How it Works:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NC6YGTyQp4fUaes-IaqCMA.png" /></figure><p>⇒ As shown in the second diagram:</p><ul><li>A client sends a request to an API Gateway endpoint.</li><li>API Gateway triggers a Lambda function (the authorizer) before the request reaches the backend.</li><li>The Lambda authorizer processes the request by running custom logic (e.g., verifying tokens, checking headers, etc.).</li><li>Based on the logic, the Lambda authorizer returns an IAM policy that either allows or denies the request. This policy contains the permissions for the requested API resource.</li><li>API Gateway evaluates the returned policy. If the policy allows access, the request is forwarded to the appropriate backend resource (e.g., another Lambda function, a service, etc.); otherwise, the request is rejected.</li><li>You can enable caching of the IAM policy generated by the Lambda authorizer. Caching improves performance by storing the policy for a specified time, so the authorizer doesn’t have to run on every request, reducing latency and load.</li></ul><h4><strong>Use Cases:</strong></h4><p>⇒ Allows implementation of complex and custom authorization logic beyond what is natively supported by AWS services.</p><p>⇒ Requires writing and maintaining custom Lambda functions, which can add complexity to your setup.</p><h3>📌 Cognito User Pool Authorizers</h3><h4><strong>How it Works</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsprMbpoOUsPEOo1YmE-Ew.png" /></figure><p>⇒ As shown in the third diagram:</p><ul><li>The client (e.g., a web or mobile app) authenticates a user through the Amazon Cognito User Pool. This involves providing credentials (username/password or social login) to obtain an identity or access token (JWT).</li><li>The client sends an HTTP request to an API Gateway endpoint, including the JWT token in the Authorization header.</li><li>API Gateway triggers the Authorizer, which automatically verifies the JWT token against the associated Cognito User Pool.</li><li>If the token is valid, the Cognito authorizer generates an IAM policy that allows or denies access to the API resources.</li><li>API Gateway evaluates the policy. If the policy allows access, the request proceeds to the backend service; otherwise, it is rejected.</li></ul><h4><strong>Use Cases:</strong></h4><p>⇒ Simplifies user authentication and authorization by directly integrating with Amazon Cognito User Pools without requiring custom code.</p><p>⇒ Handles token validation, expiration, and user management automatically, reducing the need for custom validation logic.</p><p>⇒ Limited to the authentication and authorization features provided by Cognito. Custom authorization scenarios might be challenging to implement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8b339820e81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arduino Connection With NodeJS and TypeScript]]></title>
            <link>https://medium.com/@nathsantos2703/arduino-connection-with-nodejs-and-typescript-afdf78e14a75?source=rss-61284f43b426------2</link>
            <guid isPermaLink="false">https://medium.com/p/afdf78e14a75</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[NathSantos]]></dc:creator>
            <pubDate>Tue, 06 Feb 2024 21:55:47 GMT</pubDate>
            <atom:updated>2024-02-06T21:55:47.678Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8QQ147GAqYzmAijiCRs_8g.jpeg" /></figure><h3>Step 1: Upload Firmata in your Arduino IDE</h3><ol><li>Connect your Arduino to your laptop/desktop.</li><li>Open your Arduino IDE.</li><li>Choose the board and port that connects your Arduino.</li><li>Go to <strong>File &gt; Examples &gt; Firmata &gt; StandardFirmata.</strong></li><li>This will open another window, just click on the <strong>Upload</strong> button from this new window and the library will be loaded onto your Arduino.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*tytYlJaY2oaBXrtLHkSsuA.png" /></figure><h3>Step 2: Create a project with NodeJS and TypeScript</h3><ol><li>Create a directory in any location.</li><li>Navigate to the created directory and start the <em>package.json</em> file with the following command:</li></ol><pre>npm init -y</pre><p>3. Install the required dependencies:</p><ul><li>typescript: The TypeScript compiler.</li><li>johnny-five: The library for interacting with Arduino.</li><li>@types/node: Type definitions for Node.js.</li><li>@types/johnny-five: Type definitions for the johnny-five library.</li></ul><pre>npm install typescript johnny-five<br>npm install --save @types/node @types/johnny-five</pre><p>4. Create a file called <em>tsconfig.json</em> in the project root directory:</p><pre>tsc --init</pre><p>Open the <em>tsconfig.json</em> file and adjust it with the following settings:</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;target&quot;: &quot;es2016&quot;,<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;rootDir&quot;: &quot;./src&quot;,<br>    &quot;outDir&quot;: &quot;./build&quot;,<br>    &quot;esModuleInterop&quot;: true,<br>    &quot;forceConsistentCasingInFileNames&quot;: true,<br>    &quot;strict&quot;: true,<br>    &quot;skipLibCheck&quot;: true<br>  },<br>  &quot;include&quot;: [&quot;src/**/*&quot;],<br>  &quot;exclude&quot;: [&quot;node_modules&quot;]<br>}</pre><h3>Step 3: The code itself</h3><ol><li>Create a <strong><em>/src</em></strong> directory and inside it, create an <strong><em>app.ts</em></strong> file with the following content:</li></ol><blockquote>We are basically making a LED blink every 1000 milliseconds (1 second), where 10 is the pin number where the LED is connected.</blockquote><pre>import { Board, Led } from &quot;johnny-five&quot;;<br><br>const board = new Board();<br><br>board.on(&quot;ready&quot;, () =&gt; {<br>  const led = new Led(10);<br>  led.blink(1000);<br>});</pre><p>2. Now compile the code by running:</p><pre>tsc</pre><p>After following these steps you should have a structure similar to this in your project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*JifW4jWDBjimGSQuVzzp5w.png" /></figure><h3>Step 4: Connect your Arduino</h3><ol><li>There are several ways to connect your Arduino to turn on an LED, but one of the ways is as shown in the image below, so make sure your connection is like this or is at least working.</li></ol><blockquote>Note that I connected the LED to digital pin 10, which was the pin we specified in the code.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*pC_X3cedigKbLt7mUNlarQ.png" /></figure><p>2. Assuming your Arduino is connected to your laptop/desktop, run the code:</p><pre>node build/app.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*cRmpi_Jozy47DG4eOgM9fQ.png" /></figure><p><strong>And <em>voilà</em>… just like that, you’ll have your Arduino being controlled through NodeJS using TypeScript!</strong></p><p>Now you can modify the code however you want to control your Arduino.</p><p>To stop the application, simply press <em>“CTRL+C”</em> in the terminal.</p><p>If you want to see the different possibilities that <strong>johnny-five</strong> provides, visit: <a href="https://www.npmjs.com/package/johnny-five">https://www.npmjs.com/package/johnny-five</a></p><p><strong>Happy programming with your Arduino! </strong>👩‍💻✨</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afdf78e14a75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arduino connection troubleshooting: Serial port not being recognized in Linux Ubuntu 22]]></title>
            <link>https://medium.com/@nathsantos2703/arduino-connection-troubleshooting-serial-port-not-being-recognized-in-linux-ubuntu-22-5490377200c6?source=rss-61284f43b426------2</link>
            <guid isPermaLink="false">https://medium.com/p/5490377200c6</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[serial-port]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[arduino-uno]]></category>
            <dc:creator><![CDATA[NathSantos]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 22:45:32 GMT</pubDate>
            <atom:updated>2024-02-05T22:45:32.490Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Problem</h3><p>Connecting your Arduino to your laptop should be a straightforward process, but sometimes unexpected issues can arise.</p><p>In my recent experience, I faced a perplexing problem where the Arduino was powered up when connected to the USB port, yet the system failed to recognize the USB port, making it impossible to upload code or interact with the board through the Arduino IDE.</p><p>I attempted several common troubleshooting steps to resolve the Arduino connection issue. I had already run the command to grant the necessary permissions to my user: <em>sudo adduser $USER dialout</em>, and also experimented with granting read and write permissions to the port using <em>sudo chmod a+rw /dev/ttyUSB0</em>.</p><p>Despite exploring various alternatives found online, none of these attempts seemed to alleviate the problem.</p><p>It was only after a more in-depth investigation that I found that the <strong>Brltty daemon</strong> was causing the unexpected shutdown of the serial port connected to the Arduino.</p><p>Brltty, typically used for braille touch devices, was interfering with the normal functioning of the serial port and causing communication disruptions.</p><h3>The Solution</h3><p>The good news is that <strong>if you’re not utilizing Brltty for any braille touch devices</strong>, you can safely remove this package from your system. Here’s the simple command to uninstall Brltty:</p><pre>sudo apt remove brltty</pre><p>Once you’ve executed this command and removed the Brltty package, your USB serial device should remain connected without any interference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*WbXBWeFJ7yP8V3WAFLANFQ.png" /><figcaption>before removing brltty</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*CmtnbOqgnAOd0C0zjJoyvw.png" /><figcaption>after removing brltty</figcaption></figure><h3>Conclusion</h3><p>In this case, the unexpected interference from the Brltty daemon was the culprit, and by removing it, I successfully restored the connection between my Arduino and laptop.</p><p>I hope this blog post is helpful to you or others facing similar issues. If you are experiencing Arduino connection issues, consider checking for interference from background processes or unnecessary packets that may be interrupting your serial communication. Happy tinkering!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5490377200c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>