<?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 John Rochon on Medium]]></title>
        <description><![CDATA[Stories by John Rochon on Medium]]></description>
        <link>https://medium.com/@johnasrochon?source=rss-3fa9699cc135------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*InjQemi_gqJ9AJzX</url>
            <title>Stories by John Rochon on Medium</title>
            <link>https://medium.com/@johnasrochon?source=rss-3fa9699cc135------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 12:15:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@johnasrochon/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[Building A Serverless URL Shortner]]></title>
            <link>https://medium.com/@johnasrochon/building-a-serverless-url-shortner-3e275b5e98ca?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e275b5e98ca</guid>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Fri, 21 Aug 2026 01:31:56 GMT</pubDate>
            <atom:updated>2026-08-21T01:31:56.708Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*KxP2vfM7A2qBLagXL9cRGw.jpeg" /></figure><p>Building a serverless URL shortener that reports on itself lets you track link clicks instantly without managing servers, saving money while giving you live data. It gives you fast tracking, zero server upkeep, and a custom setup.</p><p><strong>Key Benefits</strong></p><ul><li><strong>Low Cost</strong>: You only pay when people use the links, which is often free for small projects.</li><li><strong>No Server Work</strong>: Cloud tools handle the setup, updates, and scaling for you automatically.</li><li><strong>Live Reports</strong>: You can see who clicks your links and when they do it right away.</li><li><strong>Full Control</strong>: You own the code and the data without relying on a third-party app.</li></ul><p><strong>Why Add Self-Reporting?</strong></p><ul><li><strong>Instant Insights</strong>: Watch traffic go up the second you share a link on social media.</li><li><strong>Easy Fixes</strong>: Find broken links or dead pages fast when traffic drops to zero.</li><li><strong>Data Privacy</strong>: Keep your users’ click data safe in your own cloud storage.</li></ul><h3><strong>Tools &amp; Technology</strong></h3><p><strong>AWS Lambda</strong>: Hosts logic for shortening URLs and redirecting users.</p><p><strong>Amazon DynamoDB</strong>: Stores short codes and click analytics.</p><p><strong>API Gateway</strong>: Creates HTTP endpoints for the URL shortner.</p><p><strong>Amazon IAM</strong>: Ensures each component has only the permission it needs.</p><p><strong>Amazon CloudWatch</strong>: Gives visibility into performance, errors, and system behavior in real time.</p><p><strong>Python</strong>: Backend logic for lambda functions.</p><h3>Problem:</h3><p>Our application needs a place to remember which short ID belongs to which long URL.</p><h3>Step 1: Create an IAM Administrator User</h3><ol><li>Open the IAM service.</li><li>Create a new user (for example, project-admin).</li><li>Enable AWS Management Console access.</li><li>Attach the <strong>AdministratorAccess</strong> policy to this user.</li><li>Sign in with this new user and use it for the rest of the project.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fW2lr-8m-oA9JAc-ZZlhQg.png" /></figure><h3>Step 2: Open DynamoDB</h3><ol><li>Search for <strong>DynamoDB</strong> in the AWS Console.</li><li>Click <strong>Create table</strong>.</li></ol><h3>Table configuration</h3><ul><li>Table name: <em>url-shortner</em></li><li>Partition key: <em>shortCode</em></li><li>Type: String</li></ul><p>Leave sort key blank.</p><p>Choose <strong>On-demand</strong> capacity mode so AWS automatically scales and you only pay for usage.</p><p>Click <strong>Create table</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9WPOR2wfWKENG3MNp_sDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtbtXUnXyI3Ktp3yve7jYQ.png" /></figure><h3>Step 3: Design the Data</h3><p>Each shortened URL will be stored as one item.</p><ul><li>Open your table.</li><li>Click <strong>Explore table items</strong>.</li><li>Click <strong>Create item</strong>.</li><li>Switch to <strong>JSON view</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DCg8WHN7Do39EecqVU9vLg.png" /></figure><h3>Step 4: Create a Lambda Execution Role</h3><ol><li>Open IAM.</li><li>Click <strong>Roles</strong>.</li><li>Click <strong>Create role</strong>.</li><li>Trusted entity:</li></ol><ul><li>AWS Service</li><li>Lambda</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BblRpvD-MFLPkEmpR3Sn_A.png" /></figure><h3>Permissions</h3><p>Attach:</p><ul><li>AWSLambdaBasicExecutionRole</li></ul><p>This enables logging to CloudWatch.</p><p>Next, create an inline policy that allows access only to your DynamoDB table.</p><h3>Step 5: Open Lambda</h3><p>Create a function.</p><p>Configuration:</p><ul><li>Name: createShortUrl</li><li>Runtime: Python 3.14</li><li>Execution role: Use existing role</li><li>Select LambdaURLRole</li></ul><p>Click <strong>Create function</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bp_KQnoEDxn3kY61CFPt7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QB26qtrMe2Mo82SK6Zt7jQ.png" /></figure><h3>Step 7: Configure Environment Variables</h3><p>Open:</p><p>Configuration</p><p>→ Environment Variables</p><p>KEY= TABLE_NAME</p><p>VALUE= url-shortner</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGz7bSY3NgbUh27cYJ2wKQ.png" /></figure><h3>Step 8: Write the Python Code</h3><p>Your function will:</p><ol><li>Read the JSON request body.</li><li>Validate the URL.</li><li>Generate a random six-character code.</li><li>Save the mapping to DynamoDB.</li><li>Return the shortened URL.</li></ol><p>import json<br>import os<br>import secrets<br>import string<br>from urllib.parse import urlparse</p><p>import boto3<br>from botocore.exceptions import ClientError</p><p>dynamodb = boto3.resource(“dynamodb”)<br>table = dynamodb.Table(os.environ[“TABLE_NAME”])</p><p>ALPHABET = string.ascii_letters + string.digits</p><p>def generate_code(length=6):<br> return “”.join(secrets.choice(ALPHABET) for _ in range(length))</p><p>def valid_https://medium.com/url(url):<br> try:<br> parsed = urlparse(url)</p><p>return (<br> parsed.scheme in (“http”, “https”)<br> and bool(parsed.netloc)<br> )</p><p>except Exception:<br> return False</p><p>def response(status_code, body):<br> return {<br> “statusCode”: status_code,<br> “headers”: {<br> “Content-Type”: “application/json”,<br> “Access-Control-Allow-Origin”: “*”<br> },<br> “body”: json.dumps(body)<br> }</p><p>def lambda_handler(event, context):</p><p>try:<br> body = json.loads(event.get(“body”) or “{}”)</p><p>long_url = body.get(“longUrl”, “”).strip()</p><p>if not valid_url(https://medium.com/long_url):<br> return response(<br> 400,<br> {<br> “error”: “A valid HTTP or HTTPS URL is required.”<br> }<br> )</p><p>for _ in range(10):</p><p>short_code = generate_code()</p><p>try:<br> table.put_item(<br> Item={<br> “shortCode”: short_code,<br> “longUrl”: long_url,<br> “clickCount”: 0<br> },<br> ConditionExpression=”attribute_not_exists(shortCode)”<br> )</p><p>return response(<br> 201,<br> {<br> “shortCode”: short_code,<br> “longUrl”: long_url<br> }<br> )</p><p>except ClientError as exc:</p><p>if exc.response[“Error”][“Code”] == “ConditionalCheckFailedException”:<br> continue</p><p>raise</p><p>return response(<br> 500,<br> {<br> “error”: “Unable to generate a unique short code.”<br> }<br> )</p><p>except Exception as exc:</p><p>print(f”Error: {exc}”)</p><p>return response(<br> 500,<br> {<br> “error”: “Internal server error.”<br> }<br> )</p><h3>9. Test the Create Function</h3><p>Before connecting API Gateway, test the Lambda function.</p><p>Choose:</p><p><strong>Test → Create new event</strong></p><p>Name the event:</p><pre>CreateUrlTest</pre><p>Use:</p><pre>{<br>  &quot;body&quot;: &quot;{\&quot;longUrl\&quot;:\&quot;https://www.example.com\&quot;}&quot;<br>}</pre><p>Click:</p><p><strong>Test</strong></p><p>A successful response should look similar to:</p><pre>{<br>  &quot;statusCode&quot;: 201,<br>  &quot;headers&quot;: {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;<br>  },<br>  &quot;body&quot;: &quot;{\&quot;shortCode\&quot;: \&quot;aB72xQ\&quot;, \&quot;longUrl\&quot;: \&quot;https://www.example.com\&quot;}&quot;<br>}</pre><p>Now open DynamoDB and verify that the new item exists in:</p><pre>url-shortener</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TR_BTzLe2Qwdg7JrKeDI9w.png" /></figure><h3>11. Create the Redirect Lambda Function</h3><p>The second Lambda function handles requests such as:</p><pre>/aB72xQ</pre><p>Its job is to:</p><ol><li>Read the short code.</li><li>Find the corresponding DynamoDB item.</li><li>Increment the click count.</li><li>Record the latest click time.</li><li>Redirect the visitor to the original URL.</li></ol><p>Create another Lambda function:</p><pre>Function name: redirectShortUrl<br>Runtime: Python 3.14<br>Execution role: LambdaURLRole</pre><p>Add the same environment variable:</p><pre>TABLE_NAME = url-shortener</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILv3vVGZb3xgbfVSF9bdEQ.png" /></figure><h3>12. Add the Redirect Python Code</h3><p>Replace the Lambda code with:</p><pre>import json<br>import os<br>from datetime import datetime, timezone</pre><pre>import boto3<br></pre><pre>dynamodb = boto3.resource(&quot;dynamodb&quot;)<br>table = dynamodb.Table(os.environ[&quot;TABLE_NAME&quot;])<br></pre><pre>def lambda_handler(event, context):</pre><pre>    try:</pre><pre>        path_parameters = event.get(&quot;pathParameters&quot;) or {}</pre><pre>        short_code = path_parameters.get(&quot;shortCode&quot;)</pre><pre>        if not short_code:<br>            return {<br>                &quot;statusCode&quot;: 400,<br>                &quot;headers&quot;: {<br>                    &quot;Content-Type&quot;: &quot;application/json&quot;<br>                },<br>                &quot;body&quot;: json.dumps({<br>                    &quot;error&quot;: &quot;Short code is required.&quot;<br>                })<br>            }</pre><pre>        result = table.get_item(<br>            Key={<br>                &quot;shortCode&quot;: short_code<br>            }<br>        )</pre><pre>        item = result.get(&quot;Item&quot;)</pre><pre>        if not item:<br>            return {<br>                &quot;statusCode&quot;: 404,<br>                &quot;headers&quot;: {<br>                    &quot;Content-Type&quot;: &quot;application/json&quot;<br>                },<br>                &quot;body&quot;: json.dumps({<br>                    &quot;error&quot;: &quot;Short URL not found.&quot;<br>                })<br>            }</pre><pre>        now = datetime.now(timezone.utc).isoformat()</pre><pre>        table.update_item(<br>            Key={<br>                &quot;shortCode&quot;: short_code<br>            },<br>            UpdateExpression=&quot;&quot;&quot;<br>                SET clickCount = if_not_exists(clickCount, :zero) + :one,<br>                    lastClickedAt = :now<br>            &quot;&quot;&quot;,<br>            ExpressionAttributeValues={<br>                &quot;:zero&quot;: 0,<br>                &quot;:one&quot;: 1,<br>                &quot;:now&quot;: now<br>            }<br>        )</pre><pre>        return {<br>            &quot;statusCode&quot;: 302,<br>            &quot;headers&quot;: {<br>                &quot;Location&quot;: item[&quot;longUrl&quot;]<br>            },<br>            &quot;body&quot;: &quot;&quot;<br>        }</pre><pre>    except Exception as exc:</pre><pre>        print(f&quot;Error: {exc}&quot;)</pre><pre>        return {<br>            &quot;statusCode&quot;: 500,<br>            &quot;headers&quot;: {<br>                &quot;Content-Type&quot;: &quot;application/json&quot;<br>            },<br>            &quot;body&quot;: json.dumps({<br>                &quot;error&quot;: &quot;Internal server error.&quot;<br>            })<br>        }</pre><p>Click:</p><p><strong>Deploy</strong></p><h3>13. Get a real short code</h3><p>Before testing the redirect, you need a short code that already exists in DynamoDB.</p><p>Go to:</p><p><strong>DynamoDB → Tables → url-shortner → Explore table items</strong></p><p>You should see an item similar to:</p><pre>shortCode: t3UL08</pre><pre>longUrl: https://www.example.com</pre><p>Now Go Back and test like you did the previous lambda event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXHRNRhkR867zJMNSzMN4w.png" /></figure><h3>14. Create the API Gateway</h3><p>Now we need public HTTP endpoints.</p><p>Open:</p><p><strong>AWS Console → API Gateway</strong></p><p>Choose:</p><p><strong>Create API</strong></p><p>Create an:</p><pre>HTTP API</pre><p>The API will have two routes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76P1y3guNp6N-CJcNb-Avw.png" /><figcaption>This is the API , now we create the routes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-x8CRwSPQh_LEwv8B9oNnw.png" /></figure><h3>Step 15. Deploy the APIHTTP</h3><p>APIs auto-create a default stage ($default) that deploys automatically on every change, so there’s usually nothing extra to click here.</p><p>Go to Stages in the left menu, click $default, and copy the Invoke URL at the top — <a href="https://ky8nd80uob.execute-api.us-east-1.amazonaws.com/">https://ky8nd80uob.execute-api.us-east-1.amazonaws.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8o20A9-Kbf12VKTZFfpe3w.png" /></figure><h3>Step 16. Test the create endpoint</h3><p>From a terminal : curl -X POST <a href="https://your-invoke-url/shorten">https:</a><a href="https://ky8nd80uob.execute-api.us-east-1.amazonaws.com/">//ky8nd80uob.execute-api.us-east-1.amazonaws.com</a><a href="https://your-invoke-url/shorten">/shorten</a> -H “Content-Type: application/json” -d “{“longUrl”:”https://www.example.com&quot;}”</p><p>You should get back a 201 with a JSON body containing a shortCode. Check DynamoDB → your table → Explore table items to confirm the new row is there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2PB0OHtrj3mQx3AsTlGNg.png" /></figure><h3>Step 17. Test the redirect endpoint</h3><p>Paste <a href="https://your-invoke-url/THE_SHORT_CODE">https://</a><a href="https://ky8nd80uob.execute-api.us-east-1.amazonaws.com/">ky8nd80uob.execute-api.us-east-1.amazonaws.com</a><a href="https://your-invoke-url/THE_SHORT_CODE">/THE_SHORT_CODE</a> into a browser, using the shortCode from the previous step. It should redirect you to <a href="https://www.example.com,/">https://www.example.com,</a> and if you check DynamoDB again, clickCount should have gone from 0 to 1 and lastClickedAt should be filled in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vutBQI1V6MTw4A0EdMSbGg.png" /></figure><h3>Problems:</h3><p><strong>1. curl quoting on Windows</strong></p><ul><li><strong>Mistake:</strong> Used single quotes around the JSON body (-d &#39;{&quot;longUrl&quot;:...}&#39;), which Windows Command Prompt doesn&#39;t parse the way Mac/Linux terminals do.</li><li><strong>Symptom:</strong> Expecting value: line 1 column 1 (char 0) — Lambda received an empty body.</li><li><strong>Lesson:</strong> On Windows, wrap the JSON in double quotes and escape the inner ones (-d &quot;{\&quot;longUrl\&quot;:\&quot;...\&quot;}&quot;). Quoting rules aren&#39;t universal across terminals — what works in a tutorial written for Mac/Linux can silently break on Windows.</li></ul><p><strong>2. Table name typo risk (</strong><strong>url-shortener vs </strong><strong>url-shortner)</strong></p><ul><li><strong>Mistake:</strong> The original notes had two different spellings floating around for the same DynamoDB table — a classic copy/paste inconsistency.</li><li><strong>Symptom:</strong> Would have caused ResourceNotFoundException or a 500 Internal server error if it had actually been mismatched.</li><li><strong>Lesson:</strong> When a Lambda’s TABLE_NAME env var doesn&#39;t match the real table name character-for-character, boto3 fails outright. Worth checking early — it turned out both your functions were already consistent, but it was the right first suspect given the doc&#39;s error.</li></ul><p><strong>3. “Short URL not found” on redirect</strong></p><ul><li><strong>Mistake:</strong> Tested with a stale/old shortCode instead of a freshly generated one.</li><li><strong>Symptom:</strong> 404 from your own code’s if not item branch — which looks identical whether the code truly doesn&#39;t exist or you&#39;re just testing the wrong value.</li><li><strong>Lesson:</strong> shortCodes are single-use test data — every create call makes a new one. When debugging a “not found,” always regenerate fresh and copy the value directly from DynamoDB (not from memory or an old terminal scrollback) before concluding it’s a real bug.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e275b5e98ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serverless API]]></title>
            <link>https://medium.com/@johnasrochon/serverless-api-149194680471?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/149194680471</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Fri, 17 Jul 2026 04:28:19 GMT</pubDate>
            <atom:updated>2026-07-17T04:28:19.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NCzje6qFCQmrFzg0q4oSeA.jpeg" /></figure><p><strong>We are going to setup a lambda funcgtion that generates QR codes and setup an API gateway so we can call that function from anywhere.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*NqTjiCQKFqqnDnlopVyxcw.png" /></figure><p><strong>Step 1: Create a lambda function</strong></p><p>(We will call it QRcodeGenerator)</p><p>For runtime we will be using Python 3.14 beccause that is the language we used to write our function.</p><p>Everything else wil be in default</p><p>Usually we would switch the architecture from x86_64 (default) to arm64. Switching a Lambda function from x86_64 to arm64 usually requires no code changes (if using standard runtimes like Python, Node.js, or Java) and cuts execution costs by roughly 20% but thats for a later date.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQu432JwIf1cAQd-_S-lPg.png" /></figure><p><strong>Step 2: Overwrite the “hello world” code with our own.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PwZR69xoEsI9wqblH01Kg.png" /><figcaption>replace this code with below</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7JwMjKt_FF0pRrCCuxc1eg.png" /></figure><p>code that was written:</p><p>import json</p><p>import base64</p><p>import qrcode</p><p>from io import BytesIO</p><p>def lambda_handler(event, context):</p><p>try:</p><p># Parse the incoming request</p><p>body = json.loads(event.get(‘body’, ‘{}’))</p><p>url = body.get(‘url’, ‘’)</p><p>if not url:</p><p>return {</p><p>‘statusCode’: 400,</p><p>‘headers’: {</p><p>‘Content-Type’: ‘application/json’,</p><p>‘Access-Control-Allow-Origin’: ‘*’</p><p>},</p><p>‘body’: json.dumps({‘error’: ‘URL is required’})</p><p>}</p><p># Generate QR code</p><p>qr = qrcode.QRCode(</p><p>version=1,</p><p>error_correction=qrcode.constants.ERROR_CORRECT_L,</p><p>box_size=10,</p><p>border=4,</p><p>)</p><p>qr.add_data(url)</p><p>qr.make(fit=True)</p><p># Create image</p><p>img = qr.make_image(fill_color=”black”, back_color=”white”)</p><p># Convert to base64</p><p>buffer = BytesIO()</p><p>img.save(buffer, format=’PNG’)</p><p>img_str = base64.b64encode(buffer.getvalue()).decode()</p><p>return {</p><p>‘statusCode’: 200,</p><p>‘headers’: {</p><p>‘Content-Type’: ‘application/json’,</p><p>‘Access-Control-Allow-Origin’: ‘*’</p><p>},</p><p>‘body’: json.dumps({</p><p>‘message’: ‘QR Code generated successfully’,</p><p>‘qr_code’: img_str,</p><p>‘url’: url</p><p>})</p><p>}</p><p>except Exception as e:</p><p>return {</p><p>‘statusCode’: 500,</p><p>‘headers’: {</p><p>‘Content-Type’: ‘application/json’,</p><p>‘Access-Control-Allow-Origin’: ‘*’</p><p>},</p><p>‘body’: json.dumps({‘error’: str(e)})</p><p>}</p><p><strong>Step 3: Test</strong></p><p>Create a new test event to see if a QR code will be generated and the lambda function runs. Now click test! It should say test succeeded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdbCQiFl0FBfP9nCxnA1rQ.png" /></figure><p><strong>Step 4: Expose this function to the public</strong></p><p>The most common way to do this is to deploy a REST API via teh AWS API gateway service. It’s the middle man between your end users and this Lambda function because its going to expose a public URL by which request can be made then forwarded to this Lambda function which will then send back a response.</p><p>Go to API gateway in search bar and click create API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEblY8zECfxyX8HZ3aqS1g.png" /></figure><p>Click on Build REST API</p><p>I am going to name it QRcodeAPI put a small description and click create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_sMtKT_PVKAhpg_DkHONVw.png" /></figure><p>Now we create a resource and name it “generate”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qKpgcblmGpSTtjLHqCsFOg.png" /></figure><p>Click on box to allow for Cross Origin Resource Sharing, it basically allows websites from other domains to make JavaScript requests to your API via the browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ygYg_xTGSvReJurEX8XJFQ.png" /></figure><p>Now we create a method</p><p>Method type is Post</p><p>Click on Lambda proxy intergration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17Up2OQKUufVmUT05PQw0Q.png" /><figcaption><strong>Also make sure Lambda function is in the correct location *US-east-1</strong></figcaption></figure><p>Next we are going to deploy the API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j6EtCcWsq4oKX9s56gqtHw.png" /><figcaption><strong>Pick New Stage and give a name</strong></figcaption></figure><p><strong>Step 5: Run curl command in CMD and see if it generates QR code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrsZ_tTZyVtYyeNv0WcxOA.png" /><figcaption><strong>Congratulations it work!</strong></figcaption></figure><p><strong>Step 6: Turn code into QR picture</strong></p><p>Copy const base64= “copy_your_base64_here” + const img = document.createElement(&#39;img&#39;);<br>img.src = &#39;data:image/png;base64,&#39; + base64;<br>img.style.width = &#39;300px&#39;;<br>document.body.appendChild(img);</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nvjTu5lyuE3U6dY92Ky-7g.png" /><figcaption><strong>RESULTS</strong></figcaption></figure><h3>Summary</h3><p>A serverless API that takes a URL and returns a QR code image as a base64-encoded PNG. Send a POST request with a URL in the body, get back a scannable QR code pointing to that URL.</p><p>Here are the mistakes I made and what I learned:</p><p><strong>1. Missing POST method on the API resource</strong></p><ul><li><strong>Mistake:</strong> Only an OPTIONS method existed on /generate — POST was never created.</li><li><strong>Lesson:</strong> When setting up API Gateway, always verify each HTTP method you need is explicitly created under each resource. OPTIONS alone (usually auto-added for CORS) won’t route real requests.</li></ul><p><strong>2. Wrong stage name in the URL</strong></p><ul><li><strong>Mistake:</strong> Assumed the stage was called prod, but it was actually named production.</li><li><strong>Lesson:</strong> Always check the exact <strong>Invoke URL</strong> shown in the Stages section rather than guessing based on convention — API Gateway stage names are whatever you (or your template) typed in, not a fixed default.</li></ul><p><strong>3. Pillow installed for the wrong platform</strong></p><ul><li><strong>Mistake:</strong> Ran pip install pillow normally on Windows, which builds Windows-compatible binaries — incompatible with Lambda&#39;s Linux environment.</li><li><strong>Lesson:</strong> Any Python package with compiled C extensions (Pillow, numpy, etc.) needs to be installed with --platform manylinux2014_x86_64 --only-binary=:all: and a matching --python-version when deploying to Lambda. Pure-Python packages (like qrcode) don&#39;t need this.</li></ul><p><strong>4. Running commands from an Administrator Command Prompt</strong></p><ul><li><strong>Mistake:</strong> Opening cmd “as Administrator” defaults to C:\Windows\System32, so all the pip installs silently landed there instead of your project folder.</li><li><strong>Lesson:</strong> Always cd into your intended working directory first and confirm with dir before running install commands — don&#39;t assume the terminal&#39;s starting location.</li></ul><p><strong>5. Moving files into a OneDrive-synced folder</strong></p><ul><li><strong>Mistake:</strong> Cutting and pasting a large batch of nested folders into Desktop (OneDrive-synced) resulted in silently empty folders — likely due to OneDrive&#39;s on-demand sync interfering mid-move.</li><li><strong>Lesson:</strong> For dev/deployment work involving lots of files, use a plain local folder (like C:\lambdaDeploy) outside of any cloud-synced directory to avoid sync conflicts corrupting file operations.</li></ul><p><strong>6. Not verifying folder contents after moving/copying</strong></p><ul><li><strong>Mistake:</strong> Assumed the move worked because dir showed the folders existed — but didn&#39;t check <em>inside</em> them, so the empty-folder problem went unnoticed for a few rounds of testing.</li><li><strong>Lesson:</strong> After any bulk file operation, spot-check that key files (like __init__.py, main.py) actually exist inside subfolders, not just that the folder names appear.</li></ul><p><strong>7. File Explorer’s “Send to → Compressed folder” silently failing</strong></p><ul><li><strong>Mistake:</strong> Relied on the GUI zip method, which threw an “Access is denied” error, likely from antivirus locking files mid-copy.</li><li><strong>Lesson:</strong> For zipping deployment packages with many files/binaries, command-line tools like tar -a -c -f name.zip * are more reliable and easier to script/repeat than GUI-based compression.</li></ul><p><strong>8. Diagnosing blindly instead of reading logs early</strong></p><ul><li><strong>Mistake:</strong> Spent a lot of turns testing hypotheses (WAF, resource policy, endpoint type, gateway responses) before pulling actual CloudWatch logs, which immediately showed the real errors (ImportModuleError, missing qrcode, etc.).</li><li><strong>Lesson:</strong> When you get an opaque error like “Forbidden” or “Internal server error,” go straight to the actual logs (CloudWatch for Lambda, execution logs for API Gateway) as early as possible — they usually reveal the exact cause in one look, saving many rounds of guessing.</li></ul><p><strong>The big-picture takeaway:</strong> most of the pain here was packaging Python dependencies correctly for Lambda’s Linux environment from a Windows machine — that’s a genuinely common friction point, and now you’ve got a repeatable process (pip install --platform manylinux2014_x86_64 --target . --only-binary=:all: + tar to zip) you can reuse for future Lambda functions with dependencies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=149194680471" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Receipt Processor Using The Cloud & AI]]></title>
            <link>https://medium.com/@johnasrochon/automated-receipt-processor-using-the-cloud-ai-8a2d4e0033e1?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a2d4e0033e1</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-textract]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 17:00:59 GMT</pubDate>
            <atom:updated>2026-04-02T17:00:59.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdZwymW4rEC0vTrLA4oagA.png" /></figure><p><strong>AWS Cloud Services Used:</strong></p><ul><li>Amazon S3 to upload and store receipts</li><li>Amazon Textract to extract the details</li><li>DynamoDB to save and organize important data</li><li>SES to send receipt summaries via email</li><li>AWS Lambda to automate the whole thing</li></ul><p><strong>Problem:</strong></p><p>Organizing receipts can be a very stressfull task. A grocery store needs to find a way to upload and organize its store receipts for tax purposes.</p><p><strong>Solution:</strong></p><p><strong>Step 1</strong></p><p>Set up the storage by creating a S3 bucket</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZiG3gieh3yUS58rRkFZv8g.png" /></figure><p>Once bucket is created, navigate into it and create a folder for new receipt uploads</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1VfOdsIAsDo62xMHo63ZQ.png" /></figure><p><strong>Step 2</strong></p><p>Go to AWS console and navigate to DynamoDB and create a table</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*006HLZq1kdZEX1kJWLqt0A.png" /></figure><ul><li>This table will store all the extracted receipt information.</li><li>Create a table name</li><li>Create a Partition Key indentifier that will be used for each receipt</li><li>Enter date for the sort key so the receipts can be arranged by dates</li></ul><p><strong>Step 3</strong></p><p>Navigate back to AWS console and go to Amazon SES</p><ul><li>Click on configuration</li><li>Click on identities</li></ul><p>Add you email. This will setup notifications and allow to receive details of the receipts you upload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fadHk_vyQ9t7S9m10v7Mlw.png" /></figure><p>AWS will then send a verification email to the email you provided</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9og3onMcKBu1YwJxw0B3PA.png" /></figure><p>Go to your email and click on the verificaton link.</p><p><strong>Step 4</strong></p><p>This will be your security setup. Navigate back to AWS console and go to IAM (Identity &amp; Access Managment).</p><ul><li>Click create role</li><li>Click AWS as the trusted entity type (this specifies which AWS service can assume this role</li><li>Choose Lambda as the service, then click next</li><li>Attach the following 5 permission policies using the search box</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvJOBRKYm_WNFmD07IKRyA.png" /></figure><ul><li>Click next</li><li>Give a role name, click create role to finalize</li></ul><p><strong>Step 5</strong></p><p>Go to AWS console and navigate to Lambda. This is one of the most important part of this process, this is the magic that will connect everything together.</p><ul><li>Click create function</li><li>Click author from scratch which will allow you to create a custom function from the begining</li><li>Create a function name</li><li>For runtime select Python 3.10</li><li>Expand change default execution role</li><li>Select use existing role</li><li>Choose the role you created earlier from the drop down menu (ReceiptProcessingLambdaRole)</li><li>Click create function</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36DSO18QMGUb9nplYlFmfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBD7boXH_wP55RXvmV3Z0Q.png" /></figure><ul><li>Navigate to the configuration tab from the pic above</li><li>Click edit</li><li>Change the timeout from the default to 3 mins, this will allow time for processing complex receipts</li><li>Click save</li><li>Stay in the configuration tab and click Environment Variables in the menu to the left</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RzGVMW5frbpJnTN26U7Gzg.png" /></figure><ul><li>Enter the 3 Key and Value info from above</li></ul><p>(These will come into play once we add the code to our Lambda function)</p><ul><li>Click on the the code tab on the same row as the configuration tab</li><li>Replace this Hello Code with the following code:</li></ul><p>import json<br>import os<br>import boto3<br>import uuid<br>from datetime import datetime<br>import urllib.parse</p><p># Initialize AWS clients<br>s3 = boto3.client(‘s3’)<br>textract = boto3.client(‘textract’)<br>dynamodb = boto3.resource(‘dynamodb’)<br>ses = boto3.client(‘ses’)</p><p># Environment variables<br>DYNAMODB_TABLE = os.environ.get(‘DYNAMODB_TABLE’, ‘Receipts’)<br>SES_SENDER_EMAIL = os.environ.get(‘SES_SENDER_EMAIL’, ‘<a href="/service/mailto:your-email@example.com">your-email@example.com</a>’)<br>SES_RECIPIENT_EMAIL = os.environ.get(‘SES_RECIPIENT_EMAIL’, ‘<a href="/service/mailto:recipient@example.com">recipient@example.com</a>’)</p><p>def lambda_handler(event, context):<br> try:<br> # Get the S3 bucket and key from the event<br> bucket = event[‘Records’][0][‘s3’][‘bucket’][‘name’]<br> # URL decode the key to handle spaces and special characters<br> key = urllib.parse.unquote_plus(event[‘Records’][0][‘s3’][‘object’][‘key’])</p><p>print(f”Processing receipt from {bucket}/{key}”)</p><p># Verify the object exists before proceeding<br> try:<br> s3.head_object(Bucket=bucket, Key=key)<br> print(f”Object verification successful: {bucket}/{key}”)<br> except Exception as e:<br> print(f”Object verification failed: {str(e)}”)<br> raise Exception(f”Unable to access object {key} in bucket {bucket}: {str(e)}”)</p><p># Step 1: Process receipt with Textract<br> receipt_data = process_receipt_with_textract(bucket, key)</p><p># Step 2: Store results in DynamoDB<br> store_receipt_in_dynamodb(receipt_data, bucket, key)</p><p># Step 3: Send email notification<br> send_email_notification(receipt_data)</p><p>return {<br> ‘statusCode’: 200,<br> ‘body’: json.dumps(‘Receipt processed successfully!’)<br> }<br> except Exception as e:<br> print(f”Error processing receipt: {str(e)}”)<br> return {<br> ‘statusCode’: 500,<br> ‘body’: json.dumps(f’Error: {str(e)}’)<br> }</p><p>def process_receipt_with_textract(bucket, key):<br> “””Process receipt using Textract’s AnalyzeExpense operation”””<br> try:<br> print(f”Calling Textract analyze_expense for {bucket}/{key}”)<br> response = textract.analyze_expense(<br> Document={<br> ‘S3Object’: {<br> ‘Bucket’: bucket,<br> ‘Name’: key<br> }<br> }<br> )<br> print(“Textract analyze_expense call successful”)<br> except Exception as e:<br> print(f”Textract analyze_expense call failed: {str(e)}”)<br> raise</p><p># Generate a unique ID for this receipt<br> receipt_id = str(uuid.uuid4())</p><p># Initialize receipt data dictionary<br> receipt_data = {<br> ‘receipt_id’: receipt_id,<br> ‘date’: datetime.now().strftime(‘%Y-%m-%d’), # Default date<br> ‘vendor’: ‘Unknown’,<br> ‘total’: ‘0.00’,<br> ‘items’: [],<br> ‘s3_path’: f”s3://{bucket}/{key}”<br> }</p><p># Extract data from Textract response<br> if ‘ExpenseDocuments’ in response and response[‘ExpenseDocuments’]:<br> expense_doc = response[‘ExpenseDocuments’][0]</p><p># Process summary fields (TOTAL, DATE, VENDOR)<br> if ‘SummaryFields’ in expense_doc:<br> for field in expense_doc[‘SummaryFields’]:<br> field_type = field.get(‘Type’, {}).get(‘Text’, ‘’)<br> value = field.get(‘ValueDetection’, {}).get(‘Text’, ‘’)</p><p>if field_type == ‘TOTAL’:<br> receipt_data[‘total’] = value<br> elif field_type == ‘INVOICE_RECEIPT_DATE’:<br> # Try to parse and format the date<br> try:<br> receipt_data[‘date’] = value<br> except:<br> # Keep the default date if parsing fails<br> pass<br> elif field_type == ‘VENDOR_NAME’:<br> receipt_data[‘vendor’] = value</p><p># Process line items<br> if ‘LineItemGroups’ in expense_doc:<br> for group in expense_doc[‘LineItemGroups’]:<br> if ‘LineItems’ in group:<br> for line_item in group[‘LineItems’]:<br> item = {}<br> for field in line_item.get(‘LineItemExpenseFields’, []):<br> field_type = field.get(‘Type’, {}).get(‘Text’, ‘’)<br> value = field.get(‘ValueDetection’, {}).get(‘Text’, ‘’)</p><p>if field_type == ‘ITEM’:<br> item[‘name’] = value<br> elif field_type == ‘PRICE’:<br> item[‘price’] = value<br> elif field_type == ‘QUANTITY’:<br> item[‘quantity’] = value</p><p># Add to items list if we have a name<br> if ‘name’ in item:<br> receipt_data[‘items’].append(item)</p><p>print(f”Extracted receipt data: {json.dumps(receipt_data)}”)<br> return receipt_data</p><p>def store_receipt_in_dynamodb(receipt_data, bucket, key):<br> “””Store the extracted receipt data in DynamoDB”””<br> try:<br> table = dynamodb.Table(DYNAMODB_TABLE)</p><p># Convert items to a format DynamoDB can store<br> items_for_db = []<br> for item in receipt_data[‘items’]:<br> items_for_db.append({<br> ‘name’: item.get(‘name’, ‘Unknown Item’),<br> ‘price’: item.get(‘price’, ‘0.00’),<br> ‘quantity’: item.get(‘quantity’, ‘1’)<br> })</p><p># Create item to insert<br> db_item = {<br> ‘receipt_id’: receipt_data[‘receipt_id’],<br> ‘date’: receipt_data[‘date’],<br> ‘vendor’: receipt_data[‘vendor’],<br> ‘total’: receipt_data[‘total’],<br> ‘items’: items_for_db,<br> ‘s3_path’: receipt_data[‘s3_path’],<br> ‘processed_timestamp’: datetime.now().isoformat()<br> }</p><p># Insert into DynamoDB<br> table.put_item(Item=db_item)<br> print(f”Receipt data stored in DynamoDB: {receipt_data[‘receipt_id’]}”)<br> except Exception as e:<br> print(f”Error storing data in DynamoDB: {str(e)}”)<br> raise</p><p>def send_email_notification(receipt_data):<br> “””Send an email notification with receipt details”””<br> try:<br> # Format items for email<br> items_html = “”<br> for item in receipt_data[‘items’]:<br> name = item.get(‘name’, ‘Unknown Item’)<br> price = item.get(‘price’, ‘N/A’)<br> quantity = item.get(‘quantity’, ‘1’)<br> items_html += f”&lt;li&gt;{name} — ${price} x {quantity}&lt;/li&gt;”</p><p>if not items_html:<br> items_html = “&lt;li&gt;No items detected&lt;/li&gt;”</p><p># Create email body<br> html_body = f”””<br> &lt;html&gt;<br> &lt;body&gt;<br> &lt;h2&gt;Receipt Processing Notification&lt;/h2&gt;<br> &lt;p&gt;&lt;strong&gt;Receipt ID:&lt;/strong&gt; {receipt_data[‘receipt_id’]}&lt;/p&gt;<br> &lt;p&gt;&lt;strong&gt;Vendor:&lt;/strong&gt; {receipt_data[‘vendor’]}&lt;/p&gt;<br> &lt;p&gt;&lt;strong&gt;Date:&lt;/strong&gt; {receipt_data[‘date’]}&lt;/p&gt;<br> &lt;p&gt;&lt;strong&gt;Total Amount:&lt;/strong&gt; ${receipt_data[‘total’]}&lt;/p&gt;<br> &lt;p&gt;&lt;strong&gt;S3 Location:&lt;/strong&gt; {receipt_data[‘s3_path’]}&lt;/p&gt;</p><p>&lt;h3&gt;Items:&lt;/h3&gt;<br> &lt;ul&gt;<br> {items_html}<br> &lt;/ul&gt;</p><p>&lt;p&gt;The receipt has been processed and stored in DynamoDB.&lt;/p&gt;<br> &lt;/body&gt;<br> &lt;/html&gt;<br> “””</p><p># Send email using SES<br> ses.send_email(<br> Source=SES_SENDER_EMAIL,<br> Destination={<br> ‘ToAddresses’: [SES_RECIPIENT_EMAIL]<br> },<br> Message={<br> ‘Subject’: {<br> ‘Data’: f”Receipt Processed: {receipt_data[‘vendor’]} — ${receipt_data[‘total’]}”<br> },<br> ‘Body’: {<br> ‘Html’: {<br> ‘Data’: html_body<br> }<br> }<br> }<br> )</p><p>print(f”Email notification sent to {SES_RECIPIENT_EMAIL}”)<br> except Exception as e:<br> print(f”Error sending email notification: {str(e)}”)<br> # Continue execution even if email fails<br> print(“Continuing execution despite email error”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EO_tlfhqLttIxeCkR2CFlQ.png" /></figure><ul><li>Click Deploy on the left , which will save code and get ready for execution</li></ul><p><strong>Step 6 (Final step before testing)</strong></p><p>Navigate back to S3</p><ul><li>Select bucket for this project</li><li>Click on properties tab so we can create event notifications</li><li>Scroll down to Event Notifications and click create</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wzXCvLxXHYcVz-jK5BLt1A.png" /></figure><ul><li>Enter event name and a prefix (optional)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aewMB1zQGlDPGCchCmVgxw.png" /></figure><ul><li>Click Lambda function (from pic above)</li><li>andChoose from your lambda functions</li><li>Choose from drop down menu</li></ul><p>This connects the S3 event to your event processing function, then click save</p><p>Now the whole system is built, now the fun part….</p><p><strong>Test</strong></p><ul><li>Navigate back to your S3 bucket and click on your folder (incoming/)</li><li>Click add files and upload receipts</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Val2-5rVwxV4XdpwMdvyfQ.png" /></figure><ul><li>Navigate to Lambda then functions</li><li>Click on function name</li><li>Select monitor tab where you will be able to see invocations, you should see how many receipts you uploaded</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izcAtBqsI05Yxe5Of3RwNw.png" /></figure><p>You can also check under DynamoDB or your email address you provided to see if its working correctly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a2d4e0033e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching A Website]]></title>
            <link>https://medium.com/@johnasrochon/launching-a-website-5b5859e5235c?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b5859e5235c</guid>
            <category><![CDATA[aws-route53]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-s3]]></category>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 16:15:21 GMT</pubDate>
            <atom:updated>2026-03-25T16:15:21.468Z</atom:updated>
            <content:encoded><![CDATA[<p>Using AWS S3 &amp; Route 53</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inp_8VIblsRu-SgNZ2IcvQ.jpeg" /></figure><p>Problem: John Rochon wants to launch a website with a custom domain.</p><p>Solution:</p><p><strong>1. Store Website in S3</strong></p><p>Create an S3 bucket (e.g., johnrochon.com)</p><p>Upload static files: HTML, CSS, JavaScript, Images</p><p>Enable Static Website Hosting in S3</p><p>Set:</p><p>index.html → homepage</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tmyoz4o97B7Kvc0A_mWRYA.png" /></figure><p>(make sure you allow public access)</p><p><strong>2. Configure Domain with Route 53</strong></p><p>Register or use existing domain (like your johnrochon.com)</p><p>In Route 53:</p><p>Create a hosted zone</p><p>Add an A record (Alias)</p><p>This connects your domain → website</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYWlI6raLm_HXPRUPBz5SA.png" /></figure><p>If you see the following message below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtwjHDqvCZbuYAZqPZUbiA.png" /></figure><p>Make sure you have the correct region selected (same as your S3) or it will not populate and not let you continue.</p><h3><strong>Final Result</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Swao_KlJQ5As22IitnyarA.png" /></figure><p><strong>Why This Solution Works</strong></p><p>- Serverless → no EC2 needed</p><p>- Highly scalable → handles traffic spikes automatically</p><p>- Cost-efficient → pay only for usage</p><p>- Secure → HTTPS + private S3 access</p><p>- Fast → CDN caching worldwide</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b5859e5235c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Network Infrastructure]]></title>
            <link>https://medium.com/@johnasrochon/aws-network-infrastructure-a625440ac8f1?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/a625440ac8f1</guid>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 20:46:13 GMT</pubDate>
            <atom:updated>2025-03-13T20:46:13.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*FhE3zxlcS9yogG71IO-oPg.png" /></figure><p>Problem:</p><p>After testing and moving a server over to EC2, Level Up Bank is looking to move its network to the cloud to improve<strong> </strong>scalability, reliability and security. Level UP Bank has decided to create a VPC along with public subnets, a<strong> </strong>load balancer and a auto scaling group of EC2 instances with Apache installed on them.</p><p>Solution:</p><ol><li>Create a VPC with CIDR 10.10.0.0/16(A Virtual Private Cloud (VPC) is a means to launching AWS resources in a virtual network. This virtual network is similar to a traditional network that is connected to a data center)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Fm9fU6KBaM7badfypIA2w.png" /></figure><p>2. Create three public subnets with 10.10.1.0/24 &amp; 10.10.2.0/24 &amp; 10.10.3.0/24</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8l3WStBOhHA76Nt7Jjwx3Q.png" /></figure><p>*Make sure you auto-assign public IPV4 address and create a route table to allow them to connect to an Internet gateway*</p><p>3. Create an autoscaling group using t2.micro instances. All instances should have apache installed on each instance with a custom web page. Ensure the autoscaling group is using the public subnets from step 2. The min and max capacity autoscaling group is 2/5</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XruCmwg5Qq4TAKh70m6kw.png" /></figure><p>4. Create an Application Load Balancer to distribute traffic to the autoscaling group. *Don’t forget to create a target group*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36sQQ47FXM7rndDNlt45SA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcdo-WFlJ_fdT39po2zGXg.png" /></figure><p>5. Create web server security group that allows inbound traffic from HTTP from your Application Load Balancer. As a security precaution, no one should be able to use the public ip of your webserver to reach your website. All users should be using the Application Load Balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Udhplc-xZQd6Y9o5Tj1eSw.png" /></figure><p>6. Create a load balancer security group that allows inbound traffic from HTTP from 0.0.0.0/0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*95gcA57ShnBoGs3YTbju0g.png" /></figure><p>7. Create a load balancer security group that allows inbound traffic from HTTP from 0.0.0.0/0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GUnAebSdOy0CW-FJdulEQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a625440ac8f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MOVING YOUR WEBSITE FROM AN ON-PREM LINUX SERVER TO EC2?]]></title>
            <link>https://medium.com/@johnasrochon/moving-your-website-from-an-on-prem-linux-server-to-ec2-9eee23551ca0?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eee23551ca0</guid>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Sun, 02 Mar 2025 18:38:06 GMT</pubDate>
            <atom:updated>2025-03-02T19:22:41.784Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i_2O61P2_K-aVNbavSCGIw.jpeg" /></figure><p><strong>THE PROBLEM</strong>: Level Up Bank wants to move its online banking platform to the cloud to improve scalability, reliability, and security.</p><p>First, create an AWS account and navigates to the EC2 dashboard. From there, select the desired instance type/ AMI operating system/ enter a user-data script that updates all packages/ installs the Apache web server and starts the Apache service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*YhIvPetnbzPng0vWcl8mkQ.png" /></figure><p>Once the EC2 instance is created, I verify that the Apache webserver is downloaded and Ican SSH into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eh7W45mg940FIrUW84UigA.png" /></figure><p>Next, I open a web browser and navigates to the public IP of the EC2 instance. If everything is configured correctly, I will see the default page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KWp4UOkcusU8Q8tFwF5X7A.png" /></figure><p>Key takeaways: MAKE SURE YOUR SCRIPT IS CORRECT WHEN INPUTING, DOUBLE CHECK IT!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eee23551ca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UNDERSTANDING THE WHY BEHIND USING AN APACHE WEB SERVER ON LINUX]]></title>
            <link>https://medium.com/@johnasrochon/understanding-the-why-behind-using-an-apache-web-server-on-linux-65575596d617?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/65575596d617</guid>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Sat, 01 Feb 2025 16:53:29 GMT</pubDate>
            <atom:updated>2025-02-01T16:59:18.995Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*dmzvHL8Q1hJ02w0Zt6ZEtA.jpeg" /></figure><h3>As a junior cloud engineer at Level Up Bank, your team has been tasked with creating a new web server using Amazon Linux 2, an open-source Linux distribution widely used for web servers.</h3><p><strong>The web server will host the bank’s website, providing information about its services and allowing customers to access their accounts online.</strong></p><ol><li>Update all packages on the server. (sudo apt upgrade). This is crucial to maintain security, stability and optimal performance.</li></ol><p>2. Install an Apache HTTP Web Server. (sudo apt install apache2). A great choice for hosting websites on Linux platform due to it being a open souce web server that’s easy to configure.</p><p>3. Enable the Apache Web Server. (sudo systemctl start apache2)</p><p>4. Find the public IP of your server, post it in your browser to verify your webserver is working. Then post it to the Peer Review channel to verify if we can access that test webpage over the internet by members of your cohort!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*PJN0kYPfbyR50VS0KZQGYA.png" /></figure><p>5. Remember to modify your AWS Security group to allow HTTP traffic.<br>Hint: Make sure to look up the correct username to use when SSHing into the instance.</p><h3>WHY WOULD THE LEVEL-UP BANK USE APACHE ON LINUX FOR THE NEW SERVER?</h3><p>A bank may use an Apache web server on Linux for various reasons. Some of the most common reasons include the following:</p><ol><li><strong>Stability and reliability:</strong> Apache web server is known for its stability and reliability, making it a popular choice for critical applications, such as those used by banks.</li></ol><p><strong>2. Performance:</strong> Apache web server is highly scalable and can handle large am ounts of traffic, making it an ideal choice for banks that need to support a high volume of online transactions.</p><p><strong>3. Security:</strong> Apache web server is considered very secure, with a strong focus on security features and a large community of users who work to identify and address security vulnerabilities.</p><p><strong>4. Flexibility:</strong> Apache web server is highly customizable, with a wide range of plug-ins and modules available that can be used to add functionality and tailor the server to meet the bank’s specific needs.</p><p><strong>5. Cost:</strong> Apache web server is open-source software, meaning it is free and can be used without licensing fees. This can help banks to reduce their overall IT costs.</p><p><strong>Using an Apache web server on Linux allows a bank to take advantage of these benefits and provide a secure, high-performance platform for its online applications and services.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65575596d617" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementation of SSH for Linux & Remote Desktop Protocol for Windows EC2 instances]]></title>
            <link>https://medium.com/@johnasrochon/implementation-of-ssh-for-linux-remote-desktop-protocol-for-windows-ec2-instances-3c36a222e809?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c36a222e809</guid>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Sat, 25 Jan 2025 20:47:00 GMT</pubDate>
            <atom:updated>2025-02-01T15:52:56.253Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DK4ZfoieWzgnQjbff3J9PA.jpeg" /></figure><p>1. <strong>Business Problem</strong></p><p>Level Up Corporation, a mid-sized tech company, leverages the power of Amazon Web Services (AWS) Elastic Compute Cloud (EC2) to host both its Linux and Windows applications. The company currently has a number of EC2 instances running simultaneously. Level Up has a dedicated IT team located globally to handle the administration and maintenance of these instances. However, due to the absence of a reliable, secure, and direct remote administration tool, the IT team faces significant challenges in efficiently managing, troubleshooting, and maintaining these servers, leading to prolonged downtime, decreased productivity, and potential security risks.</p><p>2. <strong>Proposed Solution</strong></p><p>Implement SSH (Secure Shell) for Linux EC2 instances and RDP (Remote Desktop Protocol) for Windows EC2 instances. Both SSH and RDP provide secure, encrypted channels for remote administration, allowing the IT team to effectively manage and troubleshoot servers, regardless of their geographical location.</p><p>3. <strong>Benefits of the Solution</strong></p><p>- <strong>Improved Productivity and Efficiency</strong>: SSH and RDP provide direct access to EC2 instances. This enables the IT team to promptly respond to server issues, reducing downtime and improving overall operational efficiency.</p><p>- <strong>Enhanced Security</strong>: Both SSH and RDP provide secure, encrypted channels for communication. This helps to prevent unauthorized access and data breaches, maintaining the integrity and confidentiality of the company’s data.</p><h3><strong>Deploy EC2 Instanace with Keypair:</strong></h3><p>Launch an EC2 Instance:<br>Click “Launch Instance”. <br>Choose your desired AMI (Amazon Machine Image). <br>Configure your instance details like instance type, network, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*5DftgfDZpNPzoZthbAW9fw.png" /></figure><p><strong>Create a Security Group to allow SSH:</strong></p><p>Choose Security Groups in navigation<br>Choose Create Security Group.<br>Type a name and optionally, a description for your security group.<br>Configure the security group to allow SSH traffic (Linux)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*j9n5UTdeZ5-rm1-pN7oKwQ.png" /></figure><p><strong>Connecting to a EC2 instance using SSH allows you to securely manage and access your instance from a local computer</strong></p><p><strong>Prerequisites:</strong></p><ul><li>Instance Status: Make sure your instance has passed its status checks. <br>-Security Group: Verify that the security group in your instance allows incoming SSH traffic from your IP address<br>-Private Key: Find the private key file (.pem) that you specified when you launched the instance and set the permissions<br>-SSH Client: Install an SSH client on your local computer if it is not already installed.</li></ul><h4>Connecting Using SSH:</h4><p><strong>Open a Terminal:</strong> Open CMD on your local computer.</p><p><strong>Use the SSH Command</strong>: Use the ssh command to connect to the instance. You will need the private key file, the username, and the public DNS name. Using Public DNS: ssh -i /path/to/key-pair-name.pem instance-user-name@instance-public-dns-name (make sure you put SSH at begining or it won’t recognize -i as a command)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*zSk3FeEn91vZTeUL30kf3Q.png" /><figcaption>error message</figcaption></figure><p><strong>Verify Host Authenticity:</strong> When prompted, verify the authenticity of the host by checking the ECDSA key fingerprint. If it matches, type yes to continue</p><p><strong>Access the Instance: </strong>Once connected, you will see a response indicating that the host has been added to the list of known hosts, and you will have access to the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*UnOaijX7l3t0wFtWdhJ-yQ.png" /></figure><p>I TOOK A BREAK AND REDID ALL THE STEPS LISTED ABOVE BUT THIS ERROR SHOWED UP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*rHGb4Q2XFPlPX41hSkULKQ.png" /></figure><p>And for the life of me I cannot figure out what to do, I have did the following troubleshooting steps:</p><p>In my command promp (run as admin)</p><p>ssh -vvv user@host to discover there is no “host” port 22</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*iVMarL_G5nmtWlygax_qxQ.png" /></figure><p>Then tried to create a SSH key by typing ssh-keygen in cmd, which it did but still got the first error…</p><p>Make sure you are using the right command from SSH on connect in AWS because that&#39;s where I was having a problem, seem below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*n7D_5Rwuop3tJBnAO698pg.png" /><figcaption>Make sure you copy the right link</figcaption></figure><p>Now you will get the correct results!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c36a222e809" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating S3 Buckets 4 You!]]></title>
            <link>https://medium.com/@johnasrochon/creating-s3-buckets-4-you-1e4c1f0ddfce?source=rss-3fa9699cc135------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e4c1f0ddfce</guid>
            <category><![CDATA[creating-s3-bucket]]></category>
            <dc:creator><![CDATA[John Rochon]]></dc:creator>
            <pubDate>Sat, 18 Jan 2025 15:35:24 GMT</pubDate>
            <atom:updated>2025-01-18T15:35:24.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*BJb3oAZnUSeWGcwLXwRcUA.png" /></figure><p><strong>What is a S3 Bucket?</strong></p><p>Amazon Simple Storage Service (Amazon S3) is an object storage service that provides industry leading scalability, data availabilty, security and performance. It allows users to store and protect any amount of data for a variety of use cases, in this case, a website.</p><p><strong>Requirements</strong></p><ol><li>Create an S3 bucket using the AWS Console and upload the index.html file.</li><li>Modify the S3 bucket so that it can host a static website and can be reachable through the internet.</li><li>You should verify internet access using the Bucket website endpoint and not by the Object URL. You can use a private or incognito browser to test.</li></ol><p><strong>Prerequisites</strong></p><ul><li>Create an Amazon account*</li></ul><p>In this scenario, a bank has decided to move its website to AWS S3. It will benefit by cost savings, improved scalability, high availability and reduced management overhead.</p><p>First, we are going to either search for S3 or click on it on your console homepage if you have visited the page before. Click create a bucket!</p><p>Decide your bucket type, for this demo I will be using general purpose. Then we need to name our bucket. This name has to be one of a kind and cannot be duplicated (just like email usernames or ig names). If someone has your bucket name just change it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*sVTkw_XWLW26GL9-0MeDEg.png" /></figure><p>(I had to change my bucket name because it had capital letters which are not allowed)</p><p>All the rest of the settings after I am leaving as default, which are already chosen for me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*brVI9VAcDLyqokuvIl5f5A.jpeg" /></figure><p>Bucket created!</p><p>Once bucket was created, I uploaded all files related to the website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*hpDIIulRhsMR4q2WBx50pg.png" /></figure><p>Once objects were loaded a url was created. Now I should be able to access my website. I clicked on the url but got an error message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*JCyGLABIzmQWMb0KPqRo2w.png" /></figure><p>Turns out I need to enable static website hosting. To do this, I go to properties on my bucket, scroll down to static website hosting, click edit and hit the enable button.</p><p>Next click host static website and give a name to your index document and click save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*4jtLXv3Vc3Owa4mJyNgvmA.png" /></figure><p>I went back to the url and clicked refresh and still got the same error message. I forgot to make the webpage public.</p><p>To make the webpage public I go back to my bucket, click on permissions, edit block public access and unclick block all public access then confirm and save changes.</p><p>Guess what? Still no public access!!!!</p><p>All the objects in the bucket needs to be made public!</p><p>I went to the bucket, clicked on permissions, then went down to object ownership and clicked edit. Click on ACLs enabled</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*YSufjX6hkmpAoJaBm2CnqA.png" /></figure><p>Now I go back to my objects and select them and click actions and make public using ACL.</p><p>FINALLY!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*Z4S6B2q_minlcgmf3D8aQg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e4c1f0ddfce" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>