<?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 Cajetan Kelechi on Medium]]></title>
        <description><![CDATA[Stories by Cajetan Kelechi on Medium]]></description>
        <link>https://medium.com/@kcajetan?source=rss-b2f615fb4451------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KIcsLx36jWKT30qk5F9Lpw.jpeg</url>
            <title>Stories by Cajetan Kelechi on Medium</title>
            <link>https://medium.com/@kcajetan?source=rss-b2f615fb4451------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:40:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kcajetan/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[I Built a Mini Bitly on AWS: A Serverless URL Shortener, Step by Step
I’m a student documenting my…]]></title>
            <link>https://medium.com/@kcajetan/i-built-a-mini-bitly-on-aws-a-serverless-url-shortener-step-by-step-im-a-student-documenting-my-ebe10286d21f?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebe10286d21f</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Fri, 20 Nov 2026 21:07:46 GMT</pubDate>
            <atom:updated>2026-11-20T21:07:46.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Mini Bitly on AWS: A Serverless URL Shortener, Step by Step<br>I’m a student documenting my journey into cloud engineering, and this week I built something that felt like a real product: a URL shortener, basically a mini Bitly, running entirely on AWS with no servers to manage. In this article I’ll walk through every step I took, including the part that actually gave me trouble.<br>What I Built<br>The idea is simple. You paste a long link into a web page, click a button, and get back a short link. When anyone opens the short link, they get redirected to the original address.<br>The architecture uses five AWS pieces:<br>• Amazon S3 hosts the frontend, a single index.html page.<br>• Amazon API Gateway exposes an HTTP API to the outside world.<br>• AWS Lambda runs the backend logic, with one function to create links and one to redirect.<br>• Amazon DynamoDB stores the mapping between short codes and long URLs.<br>• IAM ties permissions together so each service can talk to the others.<br>Everything runs in the us-east-1 region.<br>Step 1: Creating the S3 Bucket for the Frontend<br>I started with the part I could see: the website. In the S3 console I created a bucket named link-shortner-app in us-east-1. This bucket holds my frontend, so it needed to serve a web page to the public.<br>To do that I turned on static website hosting in the bucket’s properties and set index.html as the index document. I also had to adjust the Block Public Access settings and add a bucket policy that allows public read access to the objects, otherwise visitors would just see an access denied error.<br>At this point the bucket was ready, but empty. I asked Claude to generate the frontend and backend code, and I uploaded the first version of index.html to the bucket on November 18th.<br>Step 2: Creating the DynamoDB Table<br>Next came the database. In DynamoDB I created a table called short-links in us-east-1 with a single partition key named code, a string. Each item in the table maps a short code, like abc123, to the original long URL.<br>I chose on-demand capacity so I wouldn’t have to think about provisioning. For a project this size, it costs almost nothing.<br>Step 3: Writing the Lambda Functions<br>The backend is two small Lambda functions.<br>create-link receives a long URL, generates a random short code, saves the pair into the short-links table, and returns the short code. It responds with a 201 status, meaning created.<br>redirect-link receives a short code from the URL path, looks it up in DynamoDB, and returns a 302 redirect to the original URL.<br>Both functions need permission to use DynamoDB. In IAM I attached a policy to each function’s execution role that allows only the actions it needs on the short-links table: putting items for create-link, and getting items for redirect-link. This is the principle of least privilege, giving each function only the access it requires.<br>I tested each function from the Lambda console with a test event. create-link returned 201 and redirect-link returned 302. Both worked on the first real test, which felt great.<br>Step 4: Connecting Everything with API Gateway<br>With the Lambda functions working, I needed a public door into them. In API Gateway I created an HTTP API called link-shortener-api in us-east-1. HTTP APIs are simpler and cheaper than REST APIs, and they were all I needed here.<br>I added two routes:<br>• POST /shorten is connected to the create-link function. The frontend sends a long URL here.<br>• GET /{code} is connected to the redirect-link function. The curly braces make the code a path parameter, so any short code in the URL gets passed to the Lambda.<br>API Gateway also needs permission to invoke each Lambda function. When you attach a Lambda integration through the console, AWS adds that permission for you, which saved me a manual IAM step.<br>Step 5: Configuring CORS<br>Here’s something that trips up a lot of beginners. My frontend lives on an S3 website address, while my API lives on an execute-api address. Browsers treat these as different origins, and they block requests between them unless the API explicitly allows it. That rule is called CORS, cross-origin resource sharing.<br>In the API Gateway CORS settings I allowed the origin of my S3 site, allowed the POST and GET methods, and allowed the Content-Type header. Once saved, API Gateway gave me my Invoke URL, the base address for the whole API. It looks like https://4q4510zlti.execute-api.us-east-1.amazonaws.com.<br>Step 6: Wiring the Frontend to the API<br>The last piece of plumbing was telling the frontend where the API lives. I opened index.html, pasted the Invoke URL into the JavaScript where the fetch call to the /shorten route is made, and re-uploaded the file to the link-shortner-app bucket, overwriting the old version.<br>Then I opened the S3 website, pasted in a long link, and clicked the button. A short URL came back. The whole chain worked end to end: S3 to API Gateway to Lambda to DynamoDB and back.<br>The Part That Actually Gave Me Trouble: The Frontend UI<br>Here’s the honest part. The backend was the easy part for me. DynamoDB, Lambda, and API Gateway behaved the way the documentation said they would, and when something needed fixing, the fix was clear.<br>The frontend was different. My first version of index.html worked, but it didn’t look or feel right. I went through several rounds of refining the interface: adjusting the layout and spacing, improving how the result is displayed after you shorten a link, and making the page feel like a finished product instead of a test form. Every change meant editing the file, re-uploading it to S3, and refreshing the browser to see the result.<br>That loop taught me a few things:<br>• Frontend iteration is slow on S3. There’s no live reload, so every tweak is edit, upload, refresh. Testing changes locally in the browser before uploading would have saved me a lot of time.<br>• Browser caching can fool you. Sometimes I re-uploaded a file and still saw the old page. A hard refresh fixes it.<br>• Decide the design before you build. Sketching the layout first, even roughly, would have cut down the number of revisions.<br>If you’re a backend-leaning beginner like me, budget more time for the UI than you expect.<br>Packaging It for GitHub<br>Once it worked, I wanted the project to be shareable. I organized everything into one GitHub-ready folder: the frontend index.html, the code for both Lambda functions, the IAM policies, and a README that explains the architecture and how to deploy it. A project that lives only in my AWS console isn’t much of a portfolio piece, but a clean repository is.<br>What I Learned<br>• Serverless really is simple once the pieces click. Five services, almost no code, and no servers to patch.<br>• Least-privilege IAM is worth the extra minutes. Each Lambda can only do the one thing it needs to do on the table.<br>• CORS is the first thing to check when the browser can’t reach your API but the API works fine in testing.<br>• Test each layer on its own. Testing the Lambdas, then the API, then the frontend meant I always knew where a problem lived.<br>• Budget real time for the UI. The backend took less effort than making the page feel right.<br>What’s Next<br>There’s plenty of room to grow this project. I’d like to add custom short codes, click counts stored in DynamoDB, link expiry, a custom domain with CloudFront and HTTPS, and input validation so only real URLs get shortened.<br>Wrapping Up<br>Building this URL shortener showed me how far a handful of managed AWS services can take you. If you’re moving into cloud engineering like I am, I’d encourage you to build something end to end like this. You’ll learn more from one working project than from a dozen tutorials.<br>If you try it yourself, I’d love to hear how it goes. Follow along as I keep documenting my cloud journey.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebe10286d21f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Self-Backing-Up Server That Has No Internet Access (And It Actually Works)]]></title>
            <link>https://medium.com/@kcajetan/i-built-a-self-backing-up-server-that-has-no-internet-access-and-it-actually-works-16e02ce45c38?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/16e02ce45c38</guid>
            <category><![CDATA[devops-training]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[amazon-s3]]></category>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 08:27:03 GMT</pubDate>
            <atom:updated>2026-11-20T20:56:01.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HO39RE0eBkSKl_1LsifLFA.jpeg" /></figure><p>A plain-English walkthrough of my AWS pipeline: private server, S3 backups, and a Lambda that keeps a receipt for every backup.</p><p>One of my class projects at AltSchool was to build a small but realistic setup on AWS. At first, the task looked like a wall of jargon: VPC, bastion, NAT, endpoints, IAM, Lambda, DynamoDB. So here’s how I make sense of it. It’s a pipeline. Something goes in one end, passes through a few stages, and comes out the other end. Once I saw it like that, it all clicked.</p><p>This is the whole project, explained the way I wish someone had explained it to me.</p><p>The big picture.</p><p>Here’s what I built:</p><ol><li>A <strong>private server</strong> that has no public IP address. Nobody on the internet can touch it.</li><li>A <strong>bastion server</strong> (a “front door”) that I use to reach the private server.</li><li>A script that <strong>backs up the private server’s data to S3 every 10 minutes</strong>.</li><li>A <strong>Lambda function</strong> that automatically writes a record into <strong>DynamoDB</strong> every time a backup lands in S3.</li><li>Proof that all of this keeps working <strong>even after I remove the server’s internet access</strong>.</li></ol><p>The pipeline looks like this:</p><pre>Me -&gt; Bastion -&gt; Private server -&gt; (every 10 min) -&gt; S3 bucket -&gt; Lambda -&gt; DynamoDB</pre><p>Let me walk through each stage.</p><h3>Stage 1: The network (where everything lives)</h3><p>Think of a <strong>VPC</strong> as your own private neighborhood inside AWS. I made one called myvpc and split it into two streets:</p><ul><li><strong>public-subnet</strong> (10.0.1.0/24): the street that connects to the internet. The bastion lives here.</li><li><strong>private-subnet</strong> (10.0.2.0/24): a gated street with no road to the internet. The app server lives here.</li></ul><p>Each street has a <strong>route table</strong>, which is just a set of road signs telling traffic where to go.</p><ul><li>public-rt points internet traffic to an <strong>Internet Gateway</strong> (the main road out).</li><li>private-rt starts with nothing pointing to the internet at all.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*l_A3ThH5j_AiYRkQ3gomcA.png" /></figure><h3>Stage 2: The front door (bastion) and the locked room (private server)</h3><p>A server with no public IP is very safe, but how do I log in to it? Through the <strong>bastion host</strong>.</p><p>I SSH into the bastion first, and from the bastion I SSH into the private server. The private server only accepts SSH connections from the bastion’s security group, not from the whole internet.</p><p>Here’s what I typed:</p><p>bash</p><pre>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add my-key.pem<br>ssh -A ubuntu@&lt;BASTION_PUBLIC_IP&gt;</pre><pre># now I&#39;m on the bastion, hop to the private server:<br>ssh ubuntu@10.0.2.115</pre><p>The -A means &quot;forward my key&quot;, so I never copy my private key onto the bastion. That&#39;s a big security win.</p><p>To prove the server really has no public IP, I ran hostname -I. It showed only10.0.2.115, a private address.</p><p>There’s also a one-liner version using -J (jump):</p><p>bash</p><pre>ssh -J ubuntu@&lt;BASTION_PUBLIC_IP&gt; ubuntu@10.0.2.115</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*rstBUHS__QJL3UwjHNG3zw.png" /></figure><h3>Stage 3: The temporary NAT gateway (the part that confused me most)</h3><p>Here’s a problem. My private server has no internet, but I needed to install software on it (updates, the AWS CLI, cron). How?</p><p>Answer: a <strong>NAT Gateway</strong>. It lets a private server reach <em>out</em> to the internet without letting the internet reach <em>in</em>. It’s like a one-way mail slot.</p><p>My steps were:</p><ol><li>Create the NAT gateway <strong>in the public subnet</strong> (this tripped me up; it goes in the <em>public</em> one).</li><li>In private-rtadd a route: 0.0.0.0/0 -&gt; the NAT gateway.</li></ol><p>Then my private server could download packages. I ran:</p><p>bash</p><pre>sudo apt update<br>sudo apt install -y unzip curl cron</pre><p>and I installed AWS CLI v2.</p><p><strong>Important:</strong> a NAT gateway costs money every hour, plus its Elastic IP. I only wanted it <strong>temporarily</strong>. Keep that in mind, because we’ll delete it later.</p><h3>Stage 4: Something worth backing up</h3><p>The server needs some data. I made a tiny script that writes a “heartbeat” line to a log file every 5 seconds, and I ran it as a <strong>systemd service</strong> so it starts on boot and restarts if it crashes.</p><p>bash</p><pre>#!/bin/bash<br>while true; do<br>  echo &quot;$(date &#39;+%Y-%m-%d %H:%M:%S&#39;) event=heartbeat value=$RANDOM&quot; &gt;&gt; /var/app/data/app.log<br>  sleep 5<br>done</pre><p>Then I checked it was alive:</p><p>bash</p><pre>systemctl status data-generator<br>tail -n 10 /var/app/data/app.log</pre><p>I saw active (running) and fresh log lines. Now I had data to protect.</p><h3>Stage 5: Permission to talk to S3 (IAM role)</h3><p>The server needs to upload to S3, but I did <strong>not</strong> want to paste access keys onto it. That’s a classic beginner mistake and a real security risk.</p><p>Instead, I used an <strong>IAM role</strong>. A role is like a visitor badge that the server wears. AWS gives the server temporary credentials automatically.</p><p>I created EC2-S3-Backup-Role and attached it to the server. And here&#39;s the key idea: <strong>least privilege</strong>- the role can only <strong>upload</strong> files and <strong>list</strong> the bucket. It <strong>cannot delete</strong> anything.</p><p>To prove it, I tried to delete a backup:</p><p>bash</p><pre>aws s3 rm s3://altschool-backup-bucket-kelechi/backups/&lt;some-file&gt;</pre><p>and got <strong>AccessDenied</strong>. That’s exactly what I wanted. If the server ever got hacked, the attacker couldn’t wipe my backups</p><h3>Stage 6: The backup script and cron</h3><p>Now the heart of the pipeline. backup.sh Does two things:</p><ol><li>Zips up /var/app/data into a file like backup-2026-11-16-0742.tar.gz.</li><li>Uploads it to my S3 bucket and writes SUCCESS or FAILURE into /var/log/backup.log.</li></ol><p>Then <strong>cron</strong> (the server’s alarm clock) runs it every 10 minutes:</p><pre>*/10 * * * * /usr/local/bin/backup.sh</pre><h3>The three mistakes I made (so you don’t have to)</h3><p>This is where most of my time went:</p><ol><li><strong>A tiny typo in cron.</strong> I had backup.sh. with a period at the end. Cron looked for a file literally calledbackup.sh., found nothing, and silently did nothing.</li><li><strong>A missing line in the script.</strong> I pasted the script and lost the tar line, which left an else ... fi with nothing above it, a syntax error. bash -n backup.sh Checks syntax without running it. Use it.</li><li><strong>The wrong permissions.</strong> I ranchmod 644, which removes the &quot;execute&quot; permission. Cron can&#39;t run a script it can&#39;t execute. chmod 755 Fixed it.</li></ol><p>After fixing those, the log finally said:</p><pre>SUCCESS: Archive backup-2026-11-10-1806.tar.gz uploaded to S3 successfully.</pre><p>Best feeling of the whole project.</p><h3>Stage 7: Receipts for every backup (DynamoDB + Lambda)</h3><p>The last stage is a mini audit trail. Every time a backup lands in S3, I want a record: which file, how big, when.</p><ul><li><strong>DynamoDB</strong> is AWS’s database. I made a table called backup-log with backup_id as the key.</li><li><strong>Lambda</strong> is a small function that runs only when something happens; no server needed.</li><li>The <strong>S3 trigger</strong> says: “When a new file is PUT intobackups/, run the Lambda.&quot;</li></ul><p>The Lambda reads the event and saves a row:</p><p>python</p><pre>import boto3, urllib.parse</pre><pre>table = boto3.resource(&quot;dynamodb&quot;).Table(&quot;backup-log&quot;)</pre><pre>def lambda_handler(event, context):<br>    for rec in event[&quot;Records&quot;]:<br>        key = urllib.parse.unquote_plus(rec[&quot;s3&quot;][&quot;object&quot;][&quot;key&quot;])<br>        print(key)<br>        table.put_item(Item={<br>            &quot;backup_id&quot;: key,<br>            &quot;size_bytes&quot;: rec[&quot;s3&quot;][&quot;object&quot;][&quot;size&quot;],<br>            &quot;uploaded_at&quot;: rec[&quot;eventTime&quot;],<br>            &quot;bucket&quot;: rec[&quot;s3&quot;][&quot;bucket&quot;][&quot;name&quot;],<br>        })<br>    return {&quot;statusCode&quot;: 200}</pre><p>I gave the Lambda its own role, and again kept it tight: it can write to <strong>one table</strong> (dynamodb:PutItem on backup-log) plus write its own logs to CloudWatch. Nothing else.</p><h3>Things that bit me here</h3><ul><li>I attached the logging permission <em>after</em> the first runs, so my first two backups created DynamoDB rows but no CloudWatch logs.</li><li>My backup filenames only have minute precision. Two backups in the same minute overwrite each other. So when testing manually, wait a full minute between runs.</li></ul><p>After a few backups, the DynamoDB table had a new row for each one, filled in automatically.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*JEgZ39gP_MCy6Titpb2_fQ.png" /></figure><h3>Stage 8: The big test, removing the internet</h3><p>This was my favorite part. I had been using the NAT gateway only to install software. Now, could my server back up <strong>without any internet</strong>?</p><p>The trick is an <strong>S3 Gateway Endpoint</strong>. It’s a private tunnel from my VPC straight to S3, staying inside the AWS network. It adds a special route to private-rt (a pl-... prefix list pointing to a vpce-... endpoint), and it has <strong>no hourly cost</strong>.</p><p>So I did this, in order:</p><ol><li>Removed the 0.0.0.0/0 -&gt; NAT route from private-rt.</li><li>Deleted the NAT gateway and waited for the state to say <strong>Deleted</strong>.</li><li>Released the NAT’s Elastic IP so it stops costing money.</li></ol><p>Then on the private server:</p><p>bash</p><pre>curl -I --max-time 10 https://aws.amazon.com</pre><p>It <strong>failed</strong> (Could not resolve host, exit code 6). The internet was gone. Then immediately:</p><p>bash</p><pre>sudo /usr/local/bin/backup.sh<br>tail -n 4 /var/log/backup.log</pre><p>It printed <strong>SUCCESS</strong>, and a new file showed up in S3. The server had no internet but could still back up through the private S3 tunnel. And because Lambda runs outside my VPC, it kept logging into DynamoDB too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*xkKoEkTmALuHGuedunRpLA.png" /></figure><h3>Stage 9: Cleanup and the budget alert</h3><p>Cloud bills don’t care that you were “just learning”. Two things protect you:</p><ol><li><strong>A Budget alert.</strong> In AWS Budgets, I made a small monthly budget (a few dollars) with an email alert, so I’d know if costs creep up.</li><li><strong>Deleting everything</strong> when done: the instances, Elastic IPs, endpoint, Lambda, bucket (empty it first), DynamoDB table, and the roles. I did it <strong>last</strong>, after taking every screenshot, because once it’s deleted, you can’t take the screenshot again.</li></ol><h3>What I learned</h3><ul><li><strong>Think in pipelines.</strong> Each piece does one small job. Network -&gt; access -&gt; data -&gt; backup -&gt; audit.</li><li><strong>Private by default.</strong> The safest server is one the internet can’t see.</li><li><strong>Least privilege matters.</strong> The backup role can upload but not delete. The Lambda role can write to one table.</li><li><strong>Tiny typos break silently.</strong> A single period in a crontab line cost me a long time.</li><li><strong>Test the failure case.</strong> Proving the backup works <em>without</em> the internet was more convincing than just saying it does.</li><li><strong>Watch the costs.</strong> NAT gateways and Elastic IPs bill by the hour.</li></ul><h3>Try it yourself</h3><p>Everything I used (scripts, IAM policies, the Lambda code, setup steps, and a troubleshooting table) is in my GitHub repo:</p><p><strong>https://github.com/primemi/private-subnet-backup-pipeline</strong></p><p>If you’re learning cloud too, I’d love to hear what tripped <em>you</em> up. I’m documenting my cloud journey publicly, so follow along for more.</p><p><em>Tags: AWS, Cloud Engineering, DevOps, S3, Lambda, Beginners</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16e02ce45c38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Serverless Cloud Quiz on AWS (S3, Lambda, DynamoDB, and API Gateway): A Step-by-Step…]]></title>
            <link>https://medium.com/@kcajetan/i-built-a-serverless-cloud-quiz-on-aws-s3-lambda-dynamodb-and-api-gateway-a-step-by-step-002d1817f5d6?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/002d1817f5d6</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 17:23:59 GMT</pubDate>
            <atom:updated>2026-11-06T17:23:59.613Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Serverless Cloud Quiz on AWS (S3, Lambda, DynamoDB, and API Gateway): A Step-by-Step Guide</h3><p><em>By Kelechi Cajetan. Cloud engineering student documenting my journey publicly.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/0*eknoHJjAJWL0Aa5g" /></figure><p>This week I was preparing for my cloud engineering exam, and I ended up building something better than a study sheet: a quiz web app that my whole class can use, with a shared scoreboard stored in a database. I built it in one day, using AI as a pair programmer and only AWS services that cost pennies.</p><p>In this post, I walk through every step, including the mistakes I made and the adjustments I made along the way, because the mistakes taught me more than the clean parts. If you are learning AWS, you can follow this guide and build the same thing.</p><h3>What we are building</h3><p>A Cloud Engineering Quiz where:</p><ul><li>Each attempt is a 50-question exam drawn at random from a much bigger question bank.</li><li>Students can choose random order or easy-to-hard order.</li><li>Every answer shows an instant explanation.</li><li>At the end, each student gets a personal cheat sheet of the topics they missed, which they can print or save as a PDF.</li><li>Every result is saved to a database, and a shared class scoreboard shows the best scores.</li></ul><h3>The architecture</h3><p>Here is how the pieces connect:</p><pre>Student&#39;s browser<br>   |  loads the page<br>   v<br>Amazon S3 (static website: index.html)<br>   |  fetch() calls<br>   v<br>Amazon API Gateway (HTTP API: quiz-api)<br>   |-- POST /results --&gt; Lambda: quiz-save-result --&gt; DynamoDB table: quiz-results<br>   |-- GET  /scores  --&gt; Lambda: quiz-get-scores  --&gt; DynamoDB table: quiz-results</pre><p>A simple way to remember it is a restaurant. S3 is the dining room where the customer sits. DynamoDB is the kitchen notebook where results are written down. The two Lambda functions are the waiters, one carrying a score to the notebook and one reading the scoreboard back. API Gateway is the front door that gives the waiters a web address.</p><p><strong>Why DynamoDB and not RDS?</strong> My first instinct was RDS, because I had just finished an RDS lab. But RDS runs an instance that bills by the hour, and my free trial credits were almost gone. DynamoDB on-demand has no server running and charges per request, so a class-sized quiz costs pennies. It also makes the whole design serverless, which is a better story.</p><h3>Step 1: Build the quiz page</h3><p>The front end is a single index.html file with the HTML, CSS, and JavaScript all inside it. That makes hosting trivial, because S3 only has to serve one file.</p><p>The page has a name field, two question-order modes, a one-question-at-a-time flow with explanations, a results screen, and a cheat sheet that groups the questions you missed by topic (ports, cron, permissions, and so on). A print button lets students save the cheat sheet as a PDF.</p><p>I started by practising with a voice quiz covering my semester topics: Linux basics, file operations, users and permissions, installing Ubuntu, IaaS, PaaS and SaaS, EC2 and Compute Engine, apt, bash scripting, cron and AWS hands-on labs. I scored 42 out of 50, and my weak spots became the first cheat sheet. That gave me the idea to turn the quiz into a page everyone could use.</p><h3>Adjustments I made to the page</h3><p>The first version was not the final one. These changes came from using it:</p><ol><li><strong>From rounds of 10 to a full 50-question exam.</strong> The first version ran rounds of ten questions. When I reviewed the code, I asked for the whole fifty in one sitting, because I wanted to share it with my class as a real exam. Rather than hard-coding 10 everywhere, the page now uses one variable for the exam length, so the counter, progress bar, score, and result messages all follow it.</li><li><strong>A much bigger question bank.</strong> With only 50 questions, every student would see the same exam. I asked for a larger bank with 50 drawn at random per attempt. Writing hundreds of questions by hand would have been slow and error-prone, so I wrote a list of verified facts (a command and what it does, a port and its service, a cron entry and its meaning) and let the page turn each fact into two questions: one asking for the term, one asking for the meaning. The wrong options come from the same category, so a port question only gets other ports as distractors. I also removed facts whose wording could make two options correct at once. Each attempt then draws 50 questions with a fixed mix of about 20 easy, 18 medium, and 12 hard, with a cap per topic, so students get a similar difficulty. I tested 200 random draws to confirm that every exam had 50 distinct questions with valid options.</li><li><strong>Keeping the bank size private.</strong> I decided students should see “50 questions per attempt” and nothing about how large the bank is. That was a two-line change.</li><li><strong>Removing the dollar sign.</strong> The question box had a decorative terminal-style dollar sign in front of each question. It looked odd on questions that were not commands, so I removed it with one CSS line.</li></ol><h3>Step 2: Host the page on S3</h3><ol><li>Open <strong>S3</strong> and create a bucket. Mine is calledpractical-questions, in us-east-1.</li><li>Upload your file. <strong>Name it exactly </strong><strong>index.html.</strong> My browser had renamed my downloads to things likeindex (3).html, which works at a direct link but does not load at the website address.</li><li>Open the bucket, click the <strong>Properties</strong> tab, and scroll to the very bottom to <strong>Static website hosting</strong>. Click <strong>Edit</strong>, choose <strong>Enable</strong>, set the index document to index.html and save. The website endpoint appears in the same section.</li><li>Make the file readable. Go to the <strong>Permissions</strong> tab, edit <strong>Block public access,</strong> and untick <strong>Block all public access</strong>, then save and confirm.</li><li>Still in Permissions, edit the <strong>Bucket policy</strong> and paste the following, replacing the bucket name with yours:</li></ol><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;PublicReadForWebsite&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: &quot;*&quot;,<br>      &quot;Action&quot;: &quot;s3:GetObject&quot;,<br>      &quot;Resource&quot;: &quot;arn:aws:s3:::YOUR-BUCKET-NAME/*&quot;<br>    }<br>  ]<br>}</pre><p><strong>Mistake I made:</strong> I pasted the policy with the placeholder YOUR-BUCKET-NAME still in line 9. The bucket name has to be the real one, and the /* at the end is required, because it means every object inside the bucket.</p><p><strong>Troubleshooting:</strong> a 403 error means the bucket is still private. A 404 means the file is not named index.html or is inside a folder. If you still see an old version, do a hard refresh with Ctrl+Shift+R. S3 website endpoints use HTTP, not HTTPS. Adding HTTPS needs CloudFront.</p><h3>Step 3: Create the DynamoDB table</h3><ol><li>Open <strong>DynamoDB</strong> in the same region and click <strong>Create table</strong>.</li><li>Table name: quiz-results.</li><li>Partition key: quizId (String). Every item stores the same value, cloud-quizso one query returns the whole scoreboard.</li><li>Sort key: submittedAt (String), a timestamp that keeps results in order.</li><li>Under <strong>Customize settings</strong>, set the capacity mode to <strong>On-demand</strong>. This is the setting that keeps the cost near zero.</li><li>Create the table and wait for the status to become <strong>Active</strong>.</li></ol><p>Each saved result also carries name, score, total and mode. These do not need to be declared up front, because DynamoDB only requires the key attributes.</p><h3>Step 4: The Lambda function that saves a result</h3><ol><li>In <strong>Lambda</strong>, click <strong>Create function</strong>, choose <strong>Author from scratch</strong>, name it, quiz-save-result and pick a Python 3 runtime.</li><li>Open the function’s execution role (Configuration, then Permissions, then click the role name).</li><li>In IAM, choose <strong>Add permissions</strong>, then <strong>Create inline policy</strong>, and paste the policy below on the JSON tab. Name it quiz-table-access.</li></ol><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [&quot;dynamodb:PutItem&quot;, &quot;dynamodb:Query&quot;],<br>      &quot;Resource&quot;: &quot;arn:aws:dynamodb:us-east-1:YOUR-ACCOUNT-ID:table/quiz-results&quot;<br>    }<br>  ]<br>}</pre><p>This is least privilege in practice: the function can only write to and read from this one table.</p><ol><li>Back in the function, paste this code in the Code tab and click <strong>Deploy</strong>:</li></ol><pre>import json, datetime, boto3</pre><pre>table = boto3.resource(&quot;dynamodb&quot;).Table(&quot;quiz-results&quot;)</pre><pre>def lambda_handler(event, context):<br>    try:<br>        body = json.loads(event.get(&quot;body&quot;) or &quot;{}&quot;)<br>        name = str(body.get(&quot;name&quot;, &quot;&quot;)).strip()[:24]<br>        score = int(body.get(&quot;score&quot;))<br>        total = int(body.get(&quot;total&quot;))<br>        mode = str(body.get(&quot;mode&quot;, &quot;random&quot;))[:10]<br>        if not name or total != 50 or not 0 &lt;= score &lt;= total:<br>            return {&quot;statusCode&quot;: 400, &quot;body&quot;: json.dumps({&quot;error&quot;: &quot;invalid result&quot;})}<br>        table.put_item(Item={<br>            &quot;quizId&quot;: &quot;cloud-quiz&quot;,<br>            &quot;submittedAt&quot;: datetime.datetime.utcnow().isoformat(),<br>            &quot;name&quot;: name,<br>            &quot;score&quot;: score,<br>            &quot;total&quot;: total,<br>            &quot;mode&quot;: mode,<br>        })<br>        return {&quot;statusCode&quot;: 200, &quot;body&quot;: json.dumps({&quot;saved&quot;: True})}<br>    except Exception:<br>        return {&quot;statusCode&quot;: 400, &quot;body&quot;: json.dumps({&quot;error&quot;: &quot;bad request&quot;})}</pre><p>The function trims the name to 24 characters, checks that the score is a whole number between 0 and 50, and rejects anything else. Never trust input that comes from a browser.</p><ol><li>Test it with this event:</li></ol><pre>{&quot;body&quot;: &quot;{\&quot;name\&quot;:\&quot;Prime\&quot;,\&quot;score\&quot;:42,\&quot;total\&quot;:50,\&quot;mode\&quot;:\&quot;random\&quot;}&quot;}</pre><p>You want a status code of 200 and {&quot;saved&quot;: true}. Then open the table, choose <strong>Explore table items,</strong> and check that the row is there.</p><p><strong>Mistake I made:</strong> I pasted the read function’s code into this function by accident. The test still returned 200, but with an empty list, which is how I spotted it. The lesson is that a 200 does not mean the right code is running. Always check the response body and the table.</p><h3>Step 5: The Lambda function that reads the scoreboard</h3><p>Create a second function called quiz-get-scores, and give its role the same inline policy (name it quiz-table-read). Then deploy this code:</p><pre>import json, boto3<br>from boto3.dynamodb.conditions import Key</pre><pre>table = boto3.resource(&quot;dynamodb&quot;).Table(&quot;quiz-results&quot;)</pre><pre>def lambda_handler(event, context):<br>    items = []<br>    resp = table.query(KeyConditionExpression=Key(&quot;quizId&quot;).eq(&quot;cloud-quiz&quot;))<br>    items += resp[&quot;Items&quot;]<br>    while &quot;LastEvaluatedKey&quot; in resp:<br>        resp = table.query(<br>            KeyConditionExpression=Key(&quot;quizId&quot;).eq(&quot;cloud-quiz&quot;),<br>            ExclusiveStartKey=resp[&quot;LastEvaluatedKey&quot;],<br>        )<br>        items += resp[&quot;Items&quot;]</pre><pre>    best = {}<br>    for it in items:<br>        name = it[&quot;name&quot;]<br>        score = int(it[&quot;score&quot;])<br>        if name not in best or score &gt; best[name][&quot;score&quot;]:<br>            best[name] = {&quot;name&quot;: name, &quot;score&quot;: score, &quot;total&quot;: int(it[&quot;total&quot;]), &quot;attempts&quot;: 0}<br>    for it in items:<br>        best[it[&quot;name&quot;]][&quot;attempts&quot;] += 1</pre><pre>    top = sorted(best.values(), key=lambda r: -r[&quot;score&quot;])[:10]<br>    return {&quot;statusCode&quot;: 200, &quot;body&quot;: json.dumps(top)}</pre><p>The loop with LastEvaluatedKey handles DynamoDB&#39;s pagination, so the function keeps working when the table grows beyond one page of results. It keeps each player&#39;s best score, counts their attempts, and returns the top ten.</p><p>Test it with an empty event, {}. You should get a 200 and a list with your test player in it.</p><h3>Step 6: Create the HTTP API in API Gateway</h3><p>The Lambda functions have no web address yet, so API Gateway provides the front door.</p><ol><li>Open <strong>API Gateway</strong>, click <strong>Create API</strong>, and under <strong>HTTP API</strong> click <strong>Build</strong>. Pick HTTP API, not REST API. It is cheaper and simpler.</li><li>Name it quiz-api. Add two Lambda integrations: quiz-save-result and quiz-get-scores.</li><li>On <strong>Configure routes</strong>, add POST /results pointing toquiz-save-result, and GET /scores pointing to quiz-get-scores. Check the leading slashes.</li><li>Keep the $default stage with <strong>Auto-deploy</strong> on, so changes go live without a manual deploy.</li><li>Review and create.</li></ol><p>To test, copy the <strong>Invoke URL</strong> from the stage, add /scores and open it in a browser tab. My tab showed the test player with a score of 42 out of 50, which proved the whole chain worked: browser, API Gateway, Lambda, DynamoDB, and back.</p><h3>Step 7: Turn on CORS (the step that almost beat me)</h3><p>My first real exam did not save. The page loaded and the quiz worked, but nothing reached the database. The cause was <strong>CORS</strong>. Browsers block a web page from calling an API on a different domain unless the API explicitly allows that page’s origin. My CORS settings were empty, so the browser silently refused every call.</p><p>The fix, in quiz-api under <strong>CORS</strong>, then <strong>Configure</strong>:</p><ul><li><strong>Access-Control-Allow-Origin:</strong> add the exact origin your page loads from, with no trailing slash. I added two: https://practical-questions.s3.us-east-1.amazonaws.com (the direct bucket address, which is where I had actually opened the page) and http://practical-questions.s3-website-us-east-1.amazonaws.com (the website endpoint).</li><li><strong>Access-Control-Allow-Methods:</strong> GET, POST and OPTIONS.</li><li><strong>Access-Control-Allow-Headers:</strong> content-type.</li><li>Click <strong>Save</strong>.</li></ul><p><strong>Two mistakes worth remembering:</strong></p><ol><li>I first listed only one origin, but I was opening the page from the other one. The two addresses are different origins, and each must be allowed.</li><li>I typed content-type into <strong>Expose-Headers</strong> instead of <strong>Allow-Headers</strong>. The two boxes sit next to each other. The quiz sends JSON with a Content-Type header, so the browser checks Access-Control-Allow-Headers first. With that box empty, saving would still have been blocked.</li></ol><p>If something still fails, press F12, open the Console tab, and read the red CORS message. It usually says exactly which part is missing.</p><h3>Step 8: Connect the page to the API</h3><p>The page needs the API address in one constant, and two small additions.</p><p>When an exam finishes, the page posts the result and shows the outcome:</p><pre>fetch(API + &quot;/results&quot;, {<br>  method: &quot;POST&quot;,<br>  headers: { &quot;Content-Type&quot;: &quot;application/json&quot; },<br>  body: JSON.stringify({ name, score, total: 50, mode })<br>})</pre><p>On the home screen, it loads the class scoreboard:</p><pre>fetch(API + &quot;/scores&quot;).then(r =&gt; r.json()).then(rows =&gt; { /* build the table */ });</pre><p>I added a small status line on the results screen: “Saving to the class scoreboard…” followed by either a success message or a clear error message. Names coming back from the API are escaped before being shown, because player names are user input and should never be inserted into a page as raw HTML.</p><p>I also kept a local scoreboard in the browser as a fallback, so a student still sees their own history if the API is unreachable. After the CORS fix, I reloaded the page and the class scoreboard showed my test player straight from DynamoDB.</p><h3>Everything I changed along the way</h3><p>Here is the full list in one place:</p><ul><li>Rounds of 10 questions became a 50-question exam, driven by one variable.</li><li>A small question set became a large bank, generated from verified facts, with 50 drawn per attempt.</li><li>Each attempt gets a controlled difficulty mix and a cap per topic, and never repeats the same fact twice.</li><li>The bank size is hidden from students.</li><li>A decorative dollar sign was removed from the question box.</li><li>The first idea of RDS became DynamoDB, to cut costs and keep the design serverless.</li><li>Local-only scores became a shared class scoreboard.</li><li>Fake or broken scores are rejected by validation in the Lambda function.</li><li>CORS was fixed twice: a missing origin, and a header in the wrong box.</li><li>The file was renamed to index.html so the website address loads it directly.</li></ul><h3>What went wrong, and what it taught me</h3><p>Problem</p><p>Cause</p><p>Lesson</p><p>403 on the website</p><p>Bucket still private</p><p>Open Block public access and add the bucket policy</p><p>Policy would not work</p><p>Placeholder bucket name left in</p><p>Replace every placeholder before saving</p><p>Save function returned an empty list</p><p>Read code pasted into the wrong function</p><p>Check the response body and the table, not just the status code</p><p>Exam score never reached the database</p><p>CORS was empty</p><p>Browsers block cross-origin calls by default</p><p>Saving still blocked</p><p>content-type in Expose-Headers</p><p>Allow-Headers and Expose-Headers are different boxes</p><p>Website address showed nothing</p><p>File named index (3).html</p><p>Name the file exactly index.html</p><h3>What it costs</h3><p>S3 static hosting for one small file costs a few cents a month at most. DynamoDB on-demand charges per read and write. Lambda and API Gateway charge per request, and a class-sized quiz sits comfortably inside the free tiers. There is no always-on server. I still set a billing alert, because that is a habit worth building. If you practise with a NAT gateway or an RDS instance in the same account, delete them when you finish, since they bill hourly.</p><h3>Honest limitations</h3><ul><li><strong>No login.</strong> Anyone who finds the API address could post a fake score. For an acceptable class project, the Lambda validation limits the damage, but a real product would need authentication and rate limiting.</li><li><strong>HTTP only.</strong> S3 website endpoints do not support HTTPS. CloudFront in front of the bucket would fix that.</li><li><strong>Questions are static.</strong> The bank is generated from fact lists, so it does not produce brand-new questions on its own. A future version could pull questions from DynamoDB or generate them with an AI model.</li></ul><h3>What I would build next</h3><ol><li>Put CloudFront in front of S3 for HTTPS and a cleaner address.</li><li>Add Cognito login so each score belongs to a verified student.</li><li>Move the question bank into DynamoDB, so I can add questions without redeploying the page.</li><li>Add a per-topic progress chart, so students can see their weak areas improve over time.</li><li>Describe the whole stack in CloudFormation or Terraform, so it can be rebuilt with one command.</li></ol><h3>Final thoughts</h3><p>A quiz page sounds like a small project, but it touched seven services and forced me to deal with permissions, networking rules, and real debugging. The failures taught me more than the successes: every error message pointed at exactly one thing I did not understand yet.</p><p>If you are learning cloud engineering, build something your classmates can actually use. It makes every concept stick, and you end up with a portfolio piece instead of just lab screenshots.</p><p>If this helped you, follow my journey and tell me in the comments what you would add to the quiz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=002d1817f5d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Three AWS Labs: RDS, DynamoDB, and Lambda, and What Broke Along the Way]]></title>
            <link>https://medium.com/@kcajetan/my-first-three-aws-labs-rds-dynamodb-and-lambda-and-what-broke-along-the-way-d3a651633fe5?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a651633fe5</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 12:00:05 GMT</pubDate>
            <atom:updated>2026-10-24T12:00:05.866Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*zhmNP4uDctmGav_4ZY2tIg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*Uxga1oinshSrfsVT" /></figure><h3>Lab 1: Amazon RDS (MySQL) with least-privilege access</h3><h3>The goal</h3><p>Create a managed MySQL database, lock it down so that <strong>only one virtual machine can reach it</strong>, then connect from that VM and run SQL.</p><h3>The architecture</h3><pre>My computer --SSH (port 22, key pair)--&gt; db-client EC2 VM --MySQL (port 3306)--&gt; RDS database</pre><p>The database is never exposed to the internet. I SSH into a small EC2 instance calleddb-client, and from there I connect to the database. The only thing allowed to talk to the database on port 3306 is that VM&#39;s security group.</p><h3>Part 1: Lock down access (least privilege)</h3><p>The lab had me edit the inbound rules of a security group called rds-lab-sg:</p><ol><li>Go to <strong>EC2 → Security Groups → rds-lab-sg → Edit inbound rules</strong>.</li><li>Delete any wide-open rule (anything with 0.0.0.0/0).</li><li>Add one rule: <strong>Type:</strong> MySQL/Aurora (port 3306), <strong>Source:</strong> the security group of the db-client VM. I selected the security group instead of typing an IP address.</li></ol><p>The point of using a security group as the source is that the rule follows the VM, not an IP address. If the VM’s IP changes, access still works. If another machine appears, it’s blocked by default. That’s least privilege in practice.</p><p>[Screenshot: rds-lab-sg inbound rule showing MySQL/Aurora, 3306, source = VM security group]</p><h3>Part 2: Connect from the VM</h3><p>I SSHed into the VM with my key pair:</p><pre>chmod 400 lilly.pem<br>ssh -i lilly.pem ubuntu@&lt;db-client-public-ip&gt;</pre><p>Then installed the MySQL client on the VM:</p><pre>sudo apt update &amp;&amp; sudo apt install mysql-client -y</pre><p>And tried to connect using the database endpoint from the RDS console (<strong>RDS → Databases → your database → Connectivity &amp; security</strong>):</p><pre>mysql -h &lt;your-rds-endpoint&gt; -u admin -p</pre><h3>Where it broke: the connection timed out</h3><p>My first attempt failed with:</p><pre>ERROR 2003 (HY000): Can&#39;t connect to MySQL server on &#39;&lt;endpoint&gt;:3306&#39; (110)</pre><p>Error code 110 is a <strong>timeout</strong>, not a refusal. That distinction matters. A refusal means the server is reachable but says no. A timeout means packets are being silently dropped somewhere on the way, which usually points to a security group.</p><p>To confirm it was a network problem and not a MySQL problem, I tested the port directly from the VM:</p><pre>nc -zv &lt;your-rds-endpoint&gt; 3306</pre><p>It also timed out. That test is useful because it removes MySQL, usernames and passwords from the picture and checks only whether the port is reachable.</p><p>I noticed that the endpoint resolved to a private 172.31.x.x address, which is the same default VPC as my VM, so it wasn&#39;t a VPC mismatch. I then scrolled down on the database&#39;s <strong>Connectivity &amp; security</strong> page, to the <strong>Security group rules</strong> panel, and found the real cause:</p><blockquote><em>The database was attached to the </em><strong><em>default</em></strong><em> security group, not </em><em>rds-lab-sg.</em></blockquote><p>All my careful edits to rds-lab-sg had been applied to a group that the database wasn&#39;t even using. The lab assumes the database is created withrds-lab-sg, and I had missed that option when creating it.</p><p>[Screenshot: Security group rules panel showing the default security group]</p><h3>The fix</h3><ol><li><strong>RDS → database → Modify</strong>.</li><li>Under <strong>Connectivity → Security group</strong>, add rds-lab-sg and remove default.</li><li>Choose <strong>Apply immediately</strong> and confirm.</li></ol><p>After that, nc -zv reported succeeded!. The network was fixed.</p><h3>Second problem: access denied</h3><p>I then got:</p><pre>ERROR 1045 (28000): Access denied for user &#39;admin&#39;@&#39;&lt;vm-private-ip&gt;&#39;</pre><p>This error is actually good news. It proves the network path works and that MySQL answered. The problem was only my password. The master password is never shown again after creation, so I reset it from <strong>RDS → Modify → New master password</strong> and waited for the status to return to <strong>Available</strong>. I also learned that pressing Enter at the password prompt without typing produces a second “using password: NO” error, which can look like a new problem when it isn’t.</p><h3>Third detail: the database name was empty</h3><p>On the <strong>Configuration</strong> tab, <strong>DB name</strong> showed-, meaning no initial database was created. So it USE labdb; would fail. I created it myself.</p><h3>Running the SQL</h3><pre>SHOW DATABASES;<br>CREATE DATABASE labdb;<br>USE labdb;</pre><pre>CREATE TABLE students (<br>  id INT AUTO_INCREMENT PRIMARY KEY,<br>  name VARCHAR(50),<br>  course VARCHAR(50)<br>);</pre><pre>INSERT INTO students (name, course)<br>VALUES (&#39;Kelechi Gospel&#39;, &#39;Engineering&#39;);</pre><pre>SELECT * FROM students;</pre><p>Result:</p><pre>+----+----------------+-------------+<br>| id | name           | course      |<br>+----+----------------+-------------+<br>|  1 | Kelechi Gospel | Engineering |<br>+----+----------------+-------------+</pre><p>[Screenshot: the SELECT output in the terminal]</p><h3>What I took away from Lab 1</h3><ul><li><strong>A timeout and an access error are different problems.</strong> Timeout means the network. Access denied means the network works and the credentials don’t.</li><li><strong>Test the port before testing the application.</strong> nc -zv host 3306 Isolates the network layer in one command.</li><li><strong>Check what is actually attached, not what you edited.</strong> I edited the right rule on the wrong group.</li><li><strong>Use security groups as sources, not IP addresses.</strong> It’s cleaner and safer.</li><li><strong>Managed doesn’t mean pre-configured.</strong> RDS gave me a database engine, but I still had to create the database, the table, and the access rules.</li></ul><h3>Lab 2: NoSQL with Amazon DynamoDB</h3><h3>The goal</h3><p>Create a DynamoDB table, add items with different shapes to see the <strong>flexible schema</strong>, read the data three ways (Scan, Query, Filter), update and delete items, and then do the same from the command line.</p><p>After Lab 1, this one was a nice contrast. The same idea, a table of students, but a completely different way of thinking about it.</p><h3>Part 1: Create the table</h3><ol><li><strong>DynamoDB → Tables → Create table</strong>.</li><li><strong>Table name:</strong> students.</li><li><strong>Partition key:</strong> id (type <strong>String</strong>), with no sort key.</li><li><strong>Table settings:</strong> Customize settings, <strong>capacity mode: On-demand</strong>.</li><li>Leave encryption at the default and click <strong>Create table</strong>. It became <strong>Active</strong> in under a minute.</li></ol><p>On-demand capacity means I pay per request and don’t provision any capacity upfront, which suits a small lab table well.</p><p>[Screenshot: Create table screen with name, partition key and On-demand selected]</p><h3>Part 2: Add items and see the flexible schema</h3><p>I used <strong>Explore table items → Create item</strong> and switched to <strong>JSON view</strong>. My first item:</p><pre>{<br>  &quot;id&quot;: &quot;1&quot;,<br>  &quot;name&quot;: &quot;Ada&quot;,<br>  &quot;course&quot;: &quot;Cloud Engineering&quot;,<br>  &quot;score&quot;: 85<br>}</pre><p><strong>Where it broke:</strong> the editor showed a red error on line 2 and said: “There are syntax errors.” The cause was a toggle called <strong>View DynamoDB JSON</strong>, which I had left on. In that mode, DynamoDB expects every value to carry a type label:</p><pre>{<br>  &quot;id&quot;: {&quot;S&quot;: &quot;1&quot;},<br>  &quot;name&quot;: {&quot;S&quot;: &quot;Ada&quot;},<br>  &quot;course&quot;: {&quot;S&quot;: &quot;Cloud Engineering&quot;},<br>  &quot;score&quot;: {&quot;N&quot;: &quot;85&quot;}<br>}</pre><p>S means String and N means Number. Turning the toggle off let me use plain JSON. It was a handy way to see how DynamoDB stores types internally, and I&#39;d see that format again in the CLI.</p><p>The second item had completely different attributes:</p><pre>{<br>  &quot;id&quot;: &quot;2&quot;,<br>  &quot;name&quot;: &quot;Tunde&quot;,<br>  &quot;course&quot;: &quot;DevOps&quot;,<br>  &quot;city&quot;: &quot;Lagos&quot;,<br>  &quot;skills&quot;: [&quot;Linux&quot;, &quot;Git&quot;, &quot;Bash&quot;]<br>}</pre><p>The third had only id and name. In MySQL, every row has the same columns, and I had to define them first. Here, only the key is required. One item has ascore, another has a list ofskills, and another has neither. That&#39;s the flexible schema.</p><p>[Screenshot: the items list showing uneven columns]</p><h3>Part 3: Read data three ways</h3><ul><li><strong>Scan</strong> reads the entire table. With three items, it’s instant, but it checks every item, so it gets slower and more expensive as the table grows.</li><li><strong>Query</strong> with partition key id = 2 goes straight to the item by its key and returns only Tunde. This is the efficient way to read.</li><li><strong>Filter</strong> on course = DevOps (added to a Scan) also returned only Tunde. The important subtlety is that a filter is applied <strong>after</strong> DynamoDB has read the items, so you still pay to read the whole table. Only Query uses the key to avoid that.</li></ul><p>[Screenshot: Query result returning only Tunde]</p><h3>Part 4: Update and delete</h3><ul><li>I edited item 1 to change score to 90 and add passed as a Boolean true. Writing true without quotes stores a Boolean. Writing &quot;true&quot; would store a String.</li><li>I then deleted item 3.</li></ul><p>Adding a brand-new attribute to a single item without touching any other item is something a MySQL table can’t do without altering the whole table.</p><h3>Part 5: The CLI with CloudShell</h3><p>I opened <strong>CloudShell</strong> (the terminal icon in the console’s top bar), which is already authenticated, and added a fourth item:</p><pre>aws dynamodb put-item \<br>  --table-name students \<br>  --item &#39;{&quot;id&quot;:{&quot;S&quot;:&quot;4&quot;},&quot;name&quot;:{&quot;S&quot;:&quot;Chidi&quot;},&quot;course&quot;:{&quot;S&quot;:&quot;Security&quot;}}&#39;</pre><p>The command prints nothing when it succeeds, which was unsettling the first time. I verified with:</p><pre>aws dynamodb scan --table-name students</pre><p>and the new item appeared in the console as well. This is the typed JSON format from the earlier toggle, so that earlier error actually prepared me for the CLI step.</p><p>[Screenshot: CloudShell with the put-item command and scan output]</p><h3>What I took away from Lab 2</h3><ul><li><strong>DynamoDB is built around how you read the data.</strong> The partition key is the fast path. Everything else costs more.</li><li><strong>Query and Scan are not interchangeable</strong>, and a filter doesn’t make a Scan cheaper.</li><li><strong>Flexible schema is a trade-off.</strong> I gained freedom, but I also lost the guarantee that every item looks the same, so that responsibility moves to my application.</li><li><strong>Data types matter.</strong> &quot;1&quot; and 1 are different things, and so are true and &quot;true&quot;.</li></ul><h3>Lab 3: Your first AWS Lambda function</h3><h3>The goal</h3><p>Create a Lambda function in the console, test it, read its CloudWatch logs, break it on purpose, then clean everything up.</p><h3>Part 1: Create the function</h3><ol><li><strong>Lambda → Create function → Author from scratch</strong>.</li><li><strong>Name:</strong> hello-lambda, <strong>Runtime:</strong> Python 3.x.</li><li>I left the default execution role, which is created automatically with basic logging permissions. That role is why my print output later ended up in CloudWatch without any extra setup.</li></ol><p>[Screenshot: the success banner for hello-lambda]</p><h3>Part 2: The code</h3><pre>import json</pre><pre>def lambda_handler(event, context):<br>    name = event.get(&quot;name&quot;, &quot;World&quot;)<br>    print(f&quot;Function invoked with name: {name}&quot;)<br>    return {<br>        &quot;statusCode&quot;: 200,<br>        &quot;body&quot;: json.dumps(f&quot;Hello, {name}!&quot;)<br>    }</pre><p>I pasted it in and clicked <strong>Deploy</strong>. The lab specifically warns that skipping Deploy is the most common mistake: without it, the test runs the old code.</p><h3>Part 3: Test it</h3><p>I created a test event called test1 with this JSON:</p><pre>{ &quot;name&quot;: &quot;Ada&quot; }</pre><p><strong>Where it broke (a small one):</strong> my first run of test1 returned Hello, World! instead of Hello, Ada!. The function was fine. The saved event JSON still contained the default template, so no name key reached the code, and event.get(&quot;name&quot;, &quot;World&quot;) quietly used its default. After I replaced the JSON and saved again, the response was Hello, Ada! with status 200.</p><p>That was a good lesson in reading the logs: the print line said name: World, which told me immediately that the input was wrong, not the code.</p><p>I also created test2 with {}, which correctly returned Hello, World!.</p><p>[Screenshot: Hello, Ada! result with status 200]</p><h3>Part 4: The CloudWatch logs</h3><p>From <strong>Monitor → View CloudWatch logs</strong>, I opened the log stream for /aws/lambda/hello-lambda. Each invocation produced four lines:</p><pre>START RequestId: ...<br>Function invoked with name: Ada<br>END RequestId: ...<br>REPORT RequestId: ... Duration: 29.97 ms  Billed Duration: 30 ms  Memory Size: 128 MB  Max Memory Used: 32 MB</pre><p>The REPORT line taught me three things:</p><ol><li><strong>Billed Duration is the actual cost basis.</strong> It’s the duration rounded up to the next millisecond. When the function isn’t running, I pay nothing.</li><li><strong>Cold starts are visible.</strong> The very first invocation in the stream showed Duration: 1.86 ms but Billed Duration: 91 ms and an Init Duration: 88.39 ms. Lambda had to create a fresh execution environment, and that setup time was included in the billed time. Later invocations reused the environment and had no Init Duration.</li><li><strong>Memory is configurable.</strong> The function used about 32 MB of its 128 MB.</li></ol><p>[Screenshot: CloudWatch log stream with the REPORT line]</p><h3>Part 5: Break it on purpose</h3><p>I changed this line:</p><pre>name = event.get(&quot;name&quot;, &quot;World&quot;)</pre><p>to this:</p><pre>name = event[&quot;name&quot;]</pre><p>Then deployed and ran test2 (the {} event). The result was <strong>Status: Failed</strong> with:</p><pre>errorType: KeyError<br>errorMessage: &#39;name&#39;</pre><p>and a stack trace pointing to the exact file and line. CloudWatch showed the same error with the full traceback, and Lambda still billed for the failed run.</p><p>Reading a traceback from the bottom up became natural: the last line says <strong>what</strong> went wrong, and the lines above say <strong>where</strong>. .get() With a default is forgiving, while [] raises an error when the key is missing. Running test1 again still worked, because the key was present.</p><p>[Screenshot: KeyError in the results and in CloudWatch]</p><h3>Part 6: Clean up</h3><p>I deleted three things, in order: the <strong>function</strong>, its <strong>CloudWatch log group</strong>, and the <strong>IAM role</strong> that Lambda auto-created. People often delete the function and forget the other two, which keep existing and cluttering the account.</p><h3>What I took away from Lab 3</h3><ul><li><strong>Serverless pricing is about what you use.</strong> Billed Duration is the number to watch.</li><li><strong>Logs are the first place to look.</strong> My print line told me about the wrong event before I had touched the code.</li><li><strong>Always deploy before you test.</strong></li><li><strong>Defensive code prevents errors.</strong> A default value turned a crash into a graceful response.</li><li><strong>Clean up the supporting resources</strong>, not just the main one.</li></ul><h3>Cleanup across all three labs</h3><p>Cloud resources keep billing while they exist, so I closed out each lab:</p><p>Lab</p><p>Resources removed</p><p>RDS</p><p>The database and the db-client EC2 instance (these bill hourly), plus the lab security group</p><p>DynamoDB</p><p>The students table</p><p>Lambda</p><p>The function, its log group, and its IAM role</p><h3>What the three labs have in common</h3><p>These labs covered three very different services, but the same habits solved every problem:</p><ol><li><strong>Read the error carefully.</strong> The exact code and wording of an error (110 vs 1045, KeyError vs a syntax error) narrows the cause immediately.</li><li><strong>Isolate the layer.</strong> nc -zv Separated the network from the database. Logs separated the input from the code.</li><li><strong>Verify what is really configured.</strong> The database was using a different security group than the one I was editing.</li><li><strong>Understand the pricing model.</strong> Hourly for RDS and EC2, per request for DynamoDB on-demand, per millisecond for Lambda.</li><li><strong>Clean up after yourself.</strong></li></ol><p>This is also where my support background helped: asking “what exactly does the error say, and what did we assume that might not be true?” is the same discipline, applied to systems instead of customers.</p><h3>What’s next</h3><p>I’m continuing to build hands-on projects and documenting each one. If you’re learning AWS too, I’d love to hear which labs gave you the most trouble. Follow along, and let’s learn this in public.</p><p><em>Tags: AWS, Cloud Computing, Amazon RDS, DynamoDB, AWS Lambda, Cloud Engineering, Learning in Public</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a651633fe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built an AWS Bastion Host (and Fixed 7 Things That Went Wrong)]]></title>
            <link>https://medium.com/@kcajetan/how-i-built-an-aws-bastion-host-and-fixed-7-things-that-went-wrong-456df1acd9aa?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/456df1acd9aa</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Sun, 18 Oct 2026 10:45:05 GMT</pubDate>
            <atom:updated>2026-10-25T22:04:12.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCqCsjQucSrv_YzwhUN9-Q.jpeg" /></figure><h3>How I Built an AWS Bastion Host (and Fixed 7 Things That Went Wrong)</h3><p><em>A hands-on walkthrough of a VPC, a public and a private subnet, and the SSH debugging that taught me how AWS networking really works.</em></p><p>A bastion host, or jump server, is a hardened server in a public subnet that acts as the only way into servers in a private subnet. The private server has no public IP and can’t be reached from the internet directly.</p><p>I built one in us-east-1 as part of my cloud engineering training. Nothing worked on the first try, and the debugging taught me more than the setup did. This post covers the build and every problem I hit.</p><h3>What We’re Building</h3><p>The traffic flow looks like this:</p><pre>Your machine --SSH--&gt; Bastion (public subnet, Elastic IP) --SSH--&gt; Private server (private subnet)</pre><p>Here’s the layout:</p><ul><li><strong>VPC:</strong> myvpc, CIDR 10.0.0.0/16</li><li><strong>Public subnet:</strong> public-subnet, 10.0.1.0/24, us-east-1a</li><li><strong>Private subnet:</strong> private-subnet, 10.0.2.0/24, us-east-1a</li><li><strong>Internet gateway:</strong> attached to myvpc</li><li><strong>Bastion instance:</strong> myserver, t3.micro, Ubuntu, with an Elastic IP</li><li><strong>Private instance:</strong> Ubuntu, with a private IP only</li><li><strong>Client:</strong> a Vagrant Ubuntu focal VM on a Windows PC</li></ul><h3>Step 1: Create the VPC</h3><ol><li>Open the AWS Console, search for <strong>VPC</strong>, and confirm you’re in <strong>us-east-1</strong>.</li><li>Click <strong>Your VPCs</strong>, then <strong>Create VPC</strong>.</li><li>Choose <strong>VPC only</strong>.</li><li>Name it myvpc and set the IPv4 CIDR to10.0.0.0/16, which gives you 65,536 addresses to split into subnets.</li><li>Leave IPv6 off and Tenancy on Default, then click <strong>Create VPC</strong>.</li></ol><h3>Step 2: Create the Subnets</h3><p>Create two subnets inside myvpc:</p><ul><li>public-subnet in us-east-1a with CIDR 10.0.1.0/24</li><li>private-subnet in us-east-1a with CIDR 10.0.2.0/24</li></ul><p>Right now the two subnets are identical. <strong>A subnet only becomes public when its route table has a route to an internet gateway.</strong> That detail comes back later.</p><h3>Step 3: Create and Attach an Internet Gateway</h3><ol><li>Go to <strong>Internet gateways</strong>, then <strong>Create internet gateway</strong>.</li><li>Name it and click <strong>Create</strong>.</li><li>Select it, choose <strong>Actions</strong>, then <strong>Attach to VPC</strong>, pick myvpc, and confirm the state shows <strong>Attached</strong>.</li></ol><p>If your account has more than one gateway, make sure you pick the one attached to myvpc. I had a second gateway attached to a different VPC, and it’s an easy mistake to make.</p><h3>Step 4: Configure the Route Tables</h3><p><strong>Public route table:</strong></p><ol><li>Open <strong>Route tables</strong>, select your table, and go to <strong>Routes</strong>, then <strong>Edit routes</strong>.</li><li>Add a destination 0.0.0.0/0 with the target set to your internet gateway.</li><li>Under <strong>Subnet associations</strong>, associate public-subnet.</li></ol><p>The result should look like this:</p><pre>10.0.0.0/16  -&gt;  local<br>0.0.0.0/0    -&gt;  igw-xxxxxxxx</pre><p><strong>Private route table:</strong> keep only the local route. It must never point to the internet gateway. If the private server later needs outbound internet access, add a NAT gateway in the public subnet and route to that.</p><h3>Step 5: Create the Security Groups</h3><p><strong>Bastion security group:</strong></p><ul><li>Allow SSH (TCP 22) from &lt;YOUR_PUBLIC_IP&gt;/32 only.</li></ul><p><strong>Private instance security group:</strong></p><ul><li>Allow SSH (TCP 22) with the <strong>bastion’s security group</strong> as the source.</li></ul><p>Using a security group as the source, instead of an IP range, means only the bastion can SSH into the private server, whatever IP the bastion has.</p><h3>Step 6: Launch the EC2 Instances</h3><p><strong>Bastion:</strong></p><ul><li>Name: myserver</li><li>AMI: Ubuntu Server (I used a brand-new Ubuntu 26.04 AMI, but Ubuntu 24.04 LTS is the safer, better-documented choice)</li><li>Instance type: t3.micro</li><li>Key pair: your own key pair</li><li>Network: myvpc, public-subnet, and the bastion security group</li></ul><p><strong>Private server:</strong></p><ul><li>Same AMI and key pair</li><li>Network: myvpc, private-subnet</li><li><strong>Auto-assign public IP: Disable</strong></li><li>Security group: the private instance group from Step 5</li></ul><h3>Step 7: Give the Bastion a Public Address</h3><p>My public subnet had <em>auto-assign public IPv4</em> set to <strong>No</strong>, so the bastion launched with no public address. Here’s how I fixed it with an Elastic IP:</p><ol><li>In the EC2 console, open <strong>Elastic IPs</strong>, then allocate an<strong> Elastic IP address</strong>.</li><li>Choose <strong>Amazon’s pool of IPv4 addresses</strong>.</li><li>For the network border group, pick the plain <strong>us-east-1</strong> entry. Entries like us-east-1-atl-2 are Local Zones and won’t work.</li><li>Click <strong>Allocate</strong>.</li><li>Choose <strong>Actions</strong>, then <strong>Associate Elastic IP address</strong>, set the resource type to <strong>Instance</strong>, and select the bastion, not the private server.</li></ol><p>AWS bills hourly for every public IPv4 address, including Elastic IPs on running instances, so remember to release it when you’re done.</p><h3>Step 8: Connect Through the Bastion</h3><p>Run this on your client machine:</p><p>bash</p><pre>chmod 400 my-key-pair.pem<br>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add my-key-pair.pem<br>ssh -A ubuntu@&lt;BASTION_ELASTIC_IP&gt;</pre><p>Then, from inside the bastion:</p><p>bash</p><pre>ssh ubuntu@&lt;PRIVATE_SERVER_IP&gt;</pre><p>The -A flag forwards your key through the agent, so the private key file never has to be copied onto the bastion.</p><p><strong>One-command alternative using a jump host:</strong></p><p>bash</p><pre>ssh -i my-key-pair.pem -J ubuntu@&lt;BASTION_ELASTIC_IP&gt; ubuntu@&lt;PRIVATE_SERVER_IP&gt;</pre><p><strong>Or save it in </strong><strong>~/.ssh/config:</strong></p><pre>Host bastion<br>    HostName &lt;BASTION_ELASTIC_IP&gt;<br>    User ubuntu<br>    IdentityFile ~/my-key-pair.pem</pre><pre>Host private-server<br>    HostName &lt;PRIVATE_SERVER_IP&gt;<br>    User ubuntu<br>    IdentityFile ~/my-key-pair.pem<br>    ProxyJump bastion</pre><p>Run chmod 600 ~/.ssh/config, and from then on ssh private-server is all you need.</p><h3>What Went Wrong (The Best Part)</h3><h4>Problem 1: “No route to host” on the private IP</h4><p>I ran SSH straight from my VM to the private server’s IP. That address only exists inside the VPC, so it’s unreachable from outside. To make it worse, VirtualBox and Vagrant NAT also use the 10.0.2.0/24 range, so my VM went looking for that address locally.</p><p><strong>Fix:</strong> connect to the bastion’s public address first, then hop to the private IP.</p><h4>Problem 2: The bastion had no public address</h4><p>The subnet’s auto-assign setting was off. Turning it on only affects instances launched afterwards.</p><p><strong>Fix:</strong> allocate and associate an Elastic IP (Step 7).</p><h4>Problem 3: Connection refused, then timed out</h4><p>I tested one layer at a time:</p><ul><li>nc -vz -w 5 github.com 22 <strong>succeeded</strong>, so my local network allows outbound SSH.</li><li>nc -vz -w 5 &lt;BASTION_IP&gt; 22 <strong>Timed out</strong>, so the block was on the AWS side.</li></ul><p>A <strong>timeout</strong> means packets are silently dropped (security group, route table, or network ACL). A <strong>refusal</strong> means something actively rejected the connection, such as nothing listening on the port.</p><h4>Problem 4: No SSH rule on the bastion security group</h4><p>The inbound rules were empty.</p><p><strong>Fix:</strong> add SSH on port 22 with your public IP as the source. Find that IP from the client with curl -4 ifconfig.me. The console’s <strong>My IP</strong> option uses your <em>browser’s</em> address, which can differ from the one your SSH client goes out through.</p><p>Select the source from the dropdown, so it shows as a chip, <em>before</em> you click <strong>Save rules</strong>.</p><h4>Problem 5: The missing internet route (the real culprit)</h4><p>My route table contained only 10.0.0.0/16 -&gt; local. With no 0.0.0.0/0 route to an internet gateway, the subnet wasn’t actually public, and no security group rule can fix that.</p><p><strong>Fix:</strong> add 0.0.0.0/0 pointing to the gateway attached to my VPC. After that, nc reported success, and SSH to the bastion worked.</p><h4>Problem 6: I couldn’t point the private security group at the bastion group</h4><p>AWS returned: <em>“You may not specify a referenced group id for an existing IPv4 CIDR rule.”</em></p><p><strong>Fix:</strong> delete the old rule and add a new SSH rule with the bastion’s security group as the source. This also removed an overly open rule, so only the bastion can reach the private server.</p><h4>Problem 7: “No authentication agent” inside the bastion</h4><p>I had opened my first session with ssh -i and no -A, so the key was never forwarded.</p><p><strong>Fix:</strong> exit, run ssh-agent and ssh-add on the client, reconnect with ssh -A, then hop to the private server.</p><h3>Quick Troubleshooting Cheat Sheet</h3><ul><li><strong>No route to host:</strong> you’re using a private IP from outside the VPC. Go through the bastion.</li><li><strong>Timed out to the bastion:</strong> check the 0.0.0.0/0 route, the SSH rule for your IP, and the network ACL.</li><li><strong>Connection refused:</strong> SSH isn’t running yet. Check status checks and the system log.</li><li><strong>Permission denied (publickey):</strong> wrong key or username. The user is ubuntu on Ubuntu AMIs.</li><li><strong>Timed out only on the second hop:</strong> the private security group doesn’t allow SSH from the bastion group.</li><li><strong>Could not open a connection to your authentication agent:</strong> run ssh-agent and ssh-add, then connect with -A.</li><li><strong>UNPROTECTED PRIVATE KEY FILE:</strong> copy the key into your VM’s home directory and run chmod 400. This is common in Vagrant’s /vagrant shared folder.</li></ul><p>Useful diagnostics:</p><p>bash</p><pre>nc -vz -w 5 &lt;ip&gt; 22               # is port 22 reachable?<br>curl -4 ifconfig.me               # what public IP am I coming from?<br>ssh -v -i my-key-pair.pem ubuntu@&lt;ip&gt;   # verbose SSH output<br>ssh-add -l                        # which keys are loaded?</pre><p>VPC <strong>Reachability Analyzer</strong> in the console can also trace the path to your instance and name the component that’s blocking it.</p><h3>What I Learned</h3><ol><li><strong>A subnet is only public if its route table points to an internet gateway.</strong> A bastion also needs a public IP.</li><li><strong>“Timed out” and “refused” mean different things.</strong> Timeouts point to AWS networking, and refusals point to the host.</li><li><strong>Test one layer at a time:</strong> client network, security group, route table, internet gateway, network ACL, then the instance.</li><li><strong>Reference security groups instead of IP ranges</strong> for internal access.</li><li><strong>Use agent forwarding or a jump host</strong> instead of copying private keys onto servers.</li><li><strong>Your ISP address can change.</strong> If SSH starts timing out, update the bastion’s rule first.</li></ol><h3>Clean Up So You Don’t Get Billed</h3><ul><li>Terminate both EC2 instances.</li><li>Release the Elastic IP.</li><li>Delete the custom security groups, subnets, and route tables, then detach and delete the internet gateway.</li><li>Delete the VPC.</li><li>Delete any NAT gateway you added, since it bills hourly too.</li></ul><h3>What’s Next</h3><ul><li>Add a <strong>NAT gateway</strong> so the private server can download updates without being exposed.</li><li>Try <strong>AWS Systems Manager Session Manager</strong> as a bastion-free alternative.</li><li>Practise <strong>SSH tunnelling</strong> with ssh -L.</li><li>Harden the bastion with a fixed source IP range, key-only login, and fail2ban or logging.</li></ul><p><em>If this helped, give it a clap and follow for more cloud engineering notes from my learning journey.</em></p><p># AWS, # CloudComputing, # DevOps, Networking, # Cloud Engineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=456df1acd9aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Solved My First AltSchool Cloud Engineering Assessment
A quick walkthrough of my first…]]></title>
            <link>https://medium.com/@kcajetan/how-i-solved-my-first-altschool-cloud-engineering-assessment-a-quick-walkthrough-of-my-first-35704a42aabd?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/35704a42aabd</guid>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 08:13:44 GMT</pubDate>
            <atom:updated>2026-09-20T08:13:44.243Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Solved My First AltSchool Cloud Engineering Assessment<br>A quick walkthrough of my first hands-on assessment covering cloud concepts, Linux permissions, user setup, and installing Nginx.</h3><p>1. Cloud Concepts &amp; Security Basics<br>Cloud Deployment Models<br>Question: A fintech company needs full control over customer data and can’t use shared servers. What cloud model works best?</p><p>Answer: Hybrid Cloud. Sensitive customer data stays on a secure Private Cloud, while general computing tasks can run on a Public Cloud.</p><p>File Permissions Explained<br>Question: What does -rwxr — r — mean?</p><p>Answer:</p><p>Owner: Read, Write, Execute (rwx)</p><p>Group: Read-only (r — )</p><p>Others: Read-only (r — )</p><p>Fixing Permission Risks<br>Question: What if everyone gets write access to /etc/passwd?</p><p>Answer: It exposes the system to serious security risks because anyone could create root accounts or break logins.</p><p>Fix: Restrict access back to root using:</p><p>Bash<br>sudo chmod 644 /etc/passwd<br>2. Hands-On Server Management<br>Useful Linux Navigation Commands<br>pwd — Check where you are in the system.</p><p>ls -al — View all files, including hidden ones.</p><p>cat /etc/os-release — Check the Linux OS version.</p><p>df -h — See available disk space.</p><p>htop — Check live RAM usage and active processes.</p><p>Setting Up Users &amp; Access Control<br>I created three users and set up their access levels for /var/app:</p><p>Created users:</p><p>Bash<br>sudo useradd -m admin2<br>sudo useradd -m developer<br>sudo useradd -m intern<br>Gave admin2 sudo privileges:</p><p>Bash<br>sudo usermod -aG sudo admin2<br>Configured /var/app permissions:</p><p>Developer: Read &amp; Write access</p><p>Intern: Read-only access</p><p>Web Server Installation<br>Finally, I installed and verified the Nginx web server:</p><p>Bash<br>sudo apt update<br>sudo apt install nginx -y<br>sudo systemctl status nginx<br>Key Takeaway<br>Always practice the Principle of Least Privilege — only give users and processes the exact permissions they need to keep systems secure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35704a42aabd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My journey as a Data Analyst at Onecampus.]]></title>
            <link>https://medium.com/@kcajetan/my-journey-as-a-data-analyst-at-onecampus-b4dc3b53cc5d?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4dc3b53cc5d</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Thu, 05 Jan 2023 07:41:58 GMT</pubDate>
            <atom:updated>2023-01-05T07:41:58.852Z</atom:updated>
            <content:encoded><![CDATA[<p>My journey as a Data Analyst at Onecampus.</p><p>Python has always been my favorite programming language due to its simple syntaxes and its easy to easy code.</p><p>And at onecampus learning is self paced along with boot camps where I meet individuals who have the same enthusiasm like me to learn and share amazing ideas how to solve problems in the world using python.</p><p>Currently, I am a Data Analyst Trainee at One Campus Academy, a Data Science Science Academy based in Akron, Ohio, US.</p><p>I have just built programs which solve problems like grading students to determine if they pass or fail. Also an age checker to prevent kids from viewing adult contents.</p><p>Enroll for tech classes!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4dc3b53cc5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Digital product are efficient end user .]]></title>
            <link>https://medium.com/@kcajetan/digital-product-are-efficient-end-user-724590a2a6cb?source=rss-b2f615fb4451------2</link>
            <guid isPermaLink="false">https://medium.com/p/724590a2a6cb</guid>
            <dc:creator><![CDATA[Cajetan Kelechi]]></dc:creator>
            <pubDate>Sun, 14 Nov 2021 13:19:44 GMT</pubDate>
            <atom:updated>2021-11-14T13:19:44.141Z</atom:updated>
            <content:encoded><![CDATA[<p>Digital product are efficient end user .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=724590a2a6cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>