<?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 Alan Le on Medium]]></title>
        <description><![CDATA[Stories by Alan Le on Medium]]></description>
        <link>https://medium.com/@elnala24?source=rss-ccb0ee0da29d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dAliU3PVLxg5pcDmsahVrA.jpeg</url>
            <title>Stories by Alan Le on Medium</title>
            <link>https://medium.com/@elnala24?source=rss-ccb0ee0da29d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 11:28:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elnala24/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[How I Generate Freelance Web Design Leads Using AI]]></title>
            <link>https://medium.com/@elnala24/how-i-generate-freelance-web-design-leads-using-ai-ddd9d4da4807?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddd9d4da4807</guid>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[freelancing]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 09:38:47 GMT</pubDate>
            <atom:updated>2026-03-11T09:40:35.796Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a system that finds local businesses, analyzes competitors, and generates tailored website demos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*cxJRoPu9wFnUDcFD.jpg" /></figure><p>In my freelance journey, I’ve been experimenting with generating my own leads instead of relying on platforms like Upwork.</p><p>My goal is to build a system that finds local businesses, analyzes their competitors, and generates custom website demos tailored specifically for them.</p><p>My IDE setup: <strong>Antigravity with Claude Opus 4.6</strong>.</p><h3>Apify</h3><p>To gather businesses that might need a better website, I used Apify, a scraping platform that allows agents to collect structured data from research results.</p><p>I connected Antigravity to Apify via MCP servers. When you create a free account on Apify, you get $5 in monthly platform credits. After I prompted the agent inside Antigravity to start scraping, it gave me a total of 183 leads in my area for the service that I’m researching. It’s important to note that when I asked the agent to do this, I also mentioned to only spend a maximum of $1 at any point.</p><h3>AnyMailFinder</h3><p>To improve the quality of the leads, I used AnyMailFinder to enrich the contact data collected earlier.</p><p>Inside Antigravity, I ask the agent to run the lead list through AnyMailFinder in order to identify verified email addresses for each business. This step increases the chances of successfully reaching decision makers instead of sending messages to generic inboxes.</p><p>When you create an account with them, the free trial provides 100 credits that was enough to test the workflow. When running the enrichment process, I also set a strict budget limit to ensure the agent never exceeded those 100 credits.</p><h3>Creating a Reusable Skill</h3><p>This process involved multiple steps from scraping leads to enriching them with email data. In order to replicate this process, I created a custom skill inside Antigravity to automate the workflow.</p><p>This skill essentially packages the entire process into a reusable action:</p><ol><li>Collect leads for a specific industry and location</li><li>Enrich those leads with verified email addresses</li><li>Return a structured list ready for outreach</li></ol><p>With this skill saved, I can now generate new lead lists for any niche or geographic area simply by asking the agent to run the workflow again.</p><p>Instead of rebuilding the pipeline each time, the system becomes reusable and scalable.</p><h3>UI/UX Skill</h3><p>To further improve the quality of the website I was generating, I added a UI/UX scale that I found on <a href="https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git">Github</a>.</p><p>This skill integrates a collection of tools and design references that help ensure the generated website follows established UI and UX best practices. Once installed, the agent can automatically evaluate layouts, accessibility, tags, typography, and structural design patterns.</p><p>All I had to do was ask the agent inside Antigravity to install the skill and attach it to the current project.</p><p>Instead of guessing at design choices when building a website, this skill gives me access to a curated database.</p><p>For example, when I ask the agent to build me a landing page, it would query the database for:</p><ul><li>best color schemes for a service business</li><li>ideal font pairing for a premium/elegant feel</li><li>most effective landing page structure for driving bookings</li><li>specific UX guidelines to avoid common mistakes</li></ul><p>It’s like having a professional UI/UX designer’s playbook baked into my workflow. The websites I build look polished and intentional from the start, not generic or thrown together.</p><h3>Website Design Prompt for Google AI Studio</h3><p>Before generating a demo website, I wanted to understand what was already working well in the market.</p><p>Once my lead list was enriched, I asked the agent to analyze Google reviews for each company. The goal was to ideally find and identify patterns between the highest performing businesses and the lowest rated ones.</p><p>Specifically, I asked the system to produce:</p><ul><li>10 actionable insights</li><li>comparing what the top 5 businesses do well</li><li>versus what the lowest performers fail to do</li></ul><p>These insights became the foundation for the website design.</p><p>Using the results, I then asked the agent to describe what an ideal website for that type of business should look like. I took that structured feedback and used Google AI Studio to generate a layout for the demo website.</p><p>After the design was finalized, I synced the project to GitHub and created a new repo for the code. With the repo ready, I returned to Antigravity to deploy the demo locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erdiUsdhh1ae4APhMmw51Q.png" /></figure><h3>Antigravity</h3><p>Using the GitHub repo link, I asked the Antigravity agent to install the demo website and launch it locally in my development environment.</p><p>To keep the workspace organized, I also instructed the agent to create a unique project folder before installing the site.</p><p>Once the website was running locally, I ran the UI/UX skill audit on the codebase. The goal was to evaluate the site against established design and usability standards without altering the visual design itself.</p><p>After the analysis was completed, the system generated a checklist showing all the improvements made:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*iZsaT5JAlwX2sgMf6bALTA.png" /></figure><p>To further refine the site, I then asked the agent to rebuild parts of the website based on the analysis it did from the top 10 performing websites:</p><ul><li>update functionality where it would improve user engagement</li><li>align the structure and messaging with proven industry patterns</li><li>add additional sections if they were commonly used by high-performing competitors</li></ul><p>Once the process finished, the system provided a detailed before and after comparison of the changes it made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*0UOnV9HmliQ-xjPfApd1IQ.png" /></figure><h3>Mobile Review</h3><p>After I was satisfied with the desktop layout, I moved on to testing the mobile experience.</p><p>The mobile version initially had several layout issues.</p><p>I provided the agent with screenshots highlighting the areas that needed adjustments. The system was able to identify the design problems and correct them quickly.</p><p>Within a few iterations, the mobile layout matched the quality of the desktop version.</p><h3>Scaling Out</h3><p>Once the first demo website was completed, I started thinking about how the process could scale across multiple businesses and industries.</p><p>To make this possible, I asked the agent to break the website into reusable components. The goal was to build a template that could easily be cloned and customized for dozens of companies:</p><ol><li>Business Identity: name, logo, founding year</li><li>Location &amp; Contact Info: phone, address, hours of operation</li><li>Reviews: testimonials, rating, count</li><li>Color Scheme: CTA colors, backgrounds, accents</li><li>Pricing &amp; Services: tier names, prices, feature</li><li>Certifications: brand partners, badges</li><li>About Story: origin, stats badge, value prop</li><li>Gallery Images: photos, alt text, labels</li><li>Service Area: city list</li><li>Social Links: instagram, facebook, google review link</li></ol><p>By doing this, it took the current design and refined it to an even more personalized demo.</p><p>This component-based approach makes it possible to reuse the same high-quality design while quickly adapting it to different companies.</p><h3>Cloning Skill</h3><p>To scale the process, I created a second Antigravity skill called Antigravity Cloning.</p><p>Instead of repeating the workflow manually, this skill takes a company’s website URL and automatically:</p><ol><li>Analyzes the existing websites</li><li>Extracts key brand elements</li><li>Rebuilds the demo using my template system</li><li>Applies UI/UX best practices</li></ol><p>This allowed me to generate multiple tailored demos from the 183 leads I originally collected.</p><h3>Conclusion</h3><p>This is the workflow I use to build a freelance web design system with AI: from generating leads to creating tailored demo websites. Each demo avoided generic placeholders and AI-generated filler, focusing instead on modern design, refined content, and real business data.</p><p>The entire process took about 1–2 months to develop. Most of that time was spent experimenting with different tools, refining the workflow, and researching which resources work best together.</p><p>Moving forward, I plan to continue refining the system and testing how well it performs for real client outreach. If the workflow evolves further, I hope to share an update on the results of this experiment and how it impacts my freelance journey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CIx1wOdmQ2dUDbHRTHnYJw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddd9d4da4807" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — Contact Form Site w/ AWS Lambda and more!]]></title>
            <link>https://awstip.com/project-contact-form-site-w-aws-lambda-and-more-3c7759f9c423?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c7759f9c423</guid>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 21:33:43 GMT</pubDate>
            <atom:updated>2026-02-24T11:25:24.138Z</atom:updated>
            <content:encoded><![CDATA[<p>TravelEase is a travel agency that relies on a basic mailto link for customer inquiries. The problem? Emails get <strong>lost in spam</strong>, customers get <strong>no confirmation</strong>, and there’s no way to <strong>track inquiries</strong>. One missed inquiry on a $5,000 vacation package means lost revenue.</p><p>The solution: a <strong>serverless contact form</strong> that captures every inquiry in a database, sends instant confirmation emails to customers, and notifies the business — all without managing a single server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNe8tJqN0Ca1Se3mdn7Qdg.png" /><figcaption>Architectural Design</figcaption></figure><p>Here’s how every piece connects: a customer submits the form on our <strong>S3-hosted</strong> website. <strong>API Gateway</strong> receives the request and triggers <strong>Lambda</strong>, which saves the inquiry to <strong>DynamoDB</strong> and sends emails through <strong>SES</strong>. <strong>CloudWatch</strong> monitors everything, and <strong>SNS</strong> sends alerts if something breaks.</p><h3>Project Setup</h3><p>First, create the project structure. Each folder has a purpose:</p><ul><li>Architecture</li><li>Diagrams and design docs</li><li>Frontend: the contact form website (HTML, CSS, JS)</li><li>Infrastructure: all Terraform files</li><li>Lambda: the function code that processes submissions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*c3tmTgC9nQFerQCMCexN0A.png" /></figure><h3>Terraform Setup</h3><p>Before building any resources, we need four foundational files in our infrastructure directory.</p><h4>providers.tf</h4><p>Tells Terraform we’re using AWS and which region. After creating this, run terraform init to download the AWS provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*GtpOoB0ucKsu5ZUapZcY2w.png" /></figure><h4>variables.tf</h4><p>Declares the inputs our project needs — region, project name, environment, and email addresses. These are placeholders that keep our code flexible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*HlpTPzwqoQlzf3yE33fheA.png" /></figure><h4>terraform.tfvars</h4><p>Sets the actual values for those variables. This file contains real email addresses, so we add it to our <strong>.gitignore</strong> to keep sensitive data out of GitHub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*WcNdX4wB1Ri21_1O9phMXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*UqvR0DQZ1b_IHsQzsENVig.png" /></figure><p>Run <strong>terraform init</strong> and <strong>terraform validate</strong> to confirm everything is configured correctly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*BDo_a7SBAgrDFbYYRFiLuA.png" /></figure><h3>S3 Static Website</h3><p>Our <strong>main.tf</strong> file starts with S3: the service that hosts our contact form website.</p><p>4 resources work together to make a public website:</p><ol><li>S3 Bucket</li><li>Website Configuration</li><li>Public Access Block</li><li>Bucket Policy</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*sFzhY6fILXkyJBmdCdJ6Og.png" /></figure><p>line 8: this turns the bucket into a static website host.</p><p>lines 11–13: when someone visits the website they land on <strong>index.html</strong> by default. We will create this file later in the <strong>frontend</strong> folder and upload it to S3 after the infrastructure is deployed.. the order of operations follow:</p><ol><li>Terraform creates bucket + website config(says “<strong>serve index.html</strong>”)</li><li>We run <strong>terraform apply</strong></li><li>We upload <strong>index.html</strong>, <strong>styles.css</strong>, and <strong>script.js</strong> to S3</li><li>Now the website works! If someone visits before we upload these files, they would get an error 404 message which is expected</li></ol><p>line 16–22: controls whether bucket can be public. Since all set to false, this allows public access. By default, AWS blocks all public access for security. If any of these are true, our bucket policy would fail.</p><p>line 31: the <strong>depends_on</strong> will tell Terraform to create our bucket policy only after the other ones are finished (creating bucket and public access block). AWS would reject the policy with an error if it was created before.</p><p>line 33: this converts policy from Terraform format to JSON.</p><p>line 40: s3:GetObject =&gt; read/download files.</p><p>line 41: the <strong>arn/* </strong>means all objects inside the bucket.</p><p>This policy says “alow anyone(<strong>*</strong>) to read (GetObject) and file (<strong>/*</strong>) in this bucket.”</p><h3>DynamoDB</h3><p>DynamoDB is a <strong>NoSQL database</strong> that stores our customer inquiries. Every time someone submits the form, a new record is created here.</p><p>Continuing our main.tf file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*QWpyTDRB-B6_te0kjPw8dw.png" /></figure><p>line 52: pay per request: pay only when you read/write =&gt; good for low traffic and no cost when idle).</p><p>line 53: unique identifier for each item. Every item in the table must have this field (like you see in attribute).</p><p>lines 55–58: defines data from the hash key (unique identifier). Type “S” is for string.</p><h3>IAM Role for Lambda</h3><ul><li>IAM Role is who can use it → Lambda service.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*-izi75QgrMLwPuLG3KfTkQ.png" /></figure><p>line 67: defines who can use this role.. this is called a “trust policy”.</p><p>line 71: <strong>sts </strong>=&gt; Security Token Service which is temporary credentials. When Lambda “assumes” a role, STS generates short-lived credentials so Lambda can act with that role’s permission. <strong>sts:AssumeRole</strong> =&gt; this means take on this role’s identity.</p><p>Lines 73–75: this means only <strong>lambda</strong> can use this role.. so not EC2, not users, just lambda!</p><p>Now that Lambda has a role (identity), it needs a policy <br>(permissions) that defines exactly what it’s allowed to do..</p><h3>IAM Policy for Lambda</h3><ul><li>IAM Policy is what they can do → logs, DynamoDB, SES.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*u-3mHHq2My8oVVUU5FBxbg.png" /></figure><ul><li>CloudWatch writes logs for debugging</li><li>DynamoDB inserts items to store inquiries</li><li>SES sends emails for confirmations and notifications</li></ul><p>line 86: attaches this policy to our lambda role that we just created before this.</p><p>line 95: create a new log folder.</p><p>line 96: create a new log file within the folder</p><p>line 97: write log messages.</p><p>line 105: <strong>dynamodb:PutItem </strong>=&gt; inserts new records. Lambda can only PutItem, not DeleteItem, Scan, etc.</p><p>line 107: this will refer only to this table, not all tables which follows least privilege.</p><p>line 113: <strong>ses:SendEmail </strong>=&gt; send emails. Lambda will send confirmation email to customer + notification to business.</p><h3>Lambda Function</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*ttVgQ_p5kzZEHLRvNIBaag.png" /></figure><p>line 125: referencing the <strong>lambda.zip</strong> file we will create later that will contain its code.. we create this inside the lambda folder.</p><p>line 126: This tells Terraform to check if the contents changed, not just the filename. In the case we re-zip our <strong>lamba.zip</strong> file.. for example if we made changes in our <strong>index.js</strong>, this would help terraform understand that the hash has changed so please update the lambda.</p><ul><li><strong>filebase64sha256</strong> is actually 3 parts combined:</li></ul><ol><li><strong>file</strong>: read a file</li><li><strong>base 64</strong>: encode it in base64 format aka a way to turn binary data into text</li><li><strong>sha256</strong>: create a SHA-256 hash. It acts as a digital fingerprint to ensure data integrity, meaning a tiny change in input results in a completely different output</li></ol><p>line 128: this gives Lambda the IAM role that allows permission to use DynamoDB, SES, and CloudWatch.</p><p>line 129: this tells AWS when you run this Lambda function, look for a file called <strong>index.js </strong>and run the <strong>handler</strong> function inside it.</p><ul><li>Later when we create the <strong>index.js </strong>file, we will write the <strong>exports.handler </strong>function which contains the code that processes the form</li></ul><p>line 130: tells AWS what language our code is written in. <strong>nodejs18.x =&gt; JavaScript (Node.js 18)</strong>.</p><ul><li>We use <strong>Node.js 18</strong> because it includes <strong>AWS SDK v3</strong> built-in. <br>Older runtimes use SDK v2, which has different syntax.. if <br>you mismatch them, Lambda crashes. I learned this the hard <br>way on my first attempt (more on that later).</li></ul><p>In my 1st attempt at this project, I ran into this bug and it took a while to figure out. In my original code, this is what i wrote that was for <strong>AWS SDK v2</strong>:</p><p><strong>const AWS = require(‘aws-sdk’);</strong></p><p>When Lambda crashed and gave me an error <strong>Cannot find module ‘aws-sdk’</strong>.. I changed it my code and wrote this for <strong>AWS SDK v3</strong>:</p><p><strong>const { SESClient } = require(‘@aws-sdk/client-ses’);</strong></p><p>line 132–137: variables passed to Lambda at runtime..</p><ul><li>Lambda code reads them with <strong>process.env.TABLE_NAME</strong></li><li><strong>TABLE_NAME</strong> =&gt; DynamoDB table to write up</li><li><strong>SENDER_EMAIL </strong>=&gt; “From” address for emails</li><li><strong>BUSINESS_EMAIL </strong>=&gt; Where to send notifications</li></ul><h3>API Gateway: Setting Up the Endpoint</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*wyBG9qjXe-BcWkpIHxhghw.png" /><figcaption>Visual flowchart for the API Gateway</figcaption></figure><p>Steps to cover when building the API:</p><ol><li><strong>REST API</strong></li><li><strong>Resource (/submit)</strong></li><li><strong>POST Method</strong></li><li><strong>Lambda Integration</strong></li><li><strong>Lambda Permission</strong></li><li><strong>CORS (OPTIONS Method)</strong></li><li><strong>Deployment</strong></li><li><strong>Stage (prod)</strong></li></ol><h4>REST API</h4><p>The container that holds your entire API. You can think of this like creating a new project folder. Inside this folder holds everything via resources, methods, integrations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*yO4PpxsGX2govX_syBL90w.png" /></figure><h4>Resource (/submit)</h4><p>The URL path endpoint. Without this, you’d only have the base URL with nowhere to send requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*9jRblU-QRhnYhbyYhb3iyA.png" /></figure><p>line 153: creates URL path segment (like a folder in your API).</p><p>line 154: links this resource to our REST API we created above.</p><p>line 155: attaches to the root (`/`) of the API</p><p>line 156: creates the `/submit` endpoint</p><ul><li>this will make your url look something like this: <a href="https://abc123.execute-api.us-west-1.amazonaws.com/prod/submit"><strong>https://abc123.execute-api.us-west-1.amazonaws.com/prod/submit</strong></a></li></ul><h4>POST Method</h4><p>Defines that this endpoint accepts POST requests. The resource <strong>(`/submit`)</strong> is just a path.. it doesn’t do anything yet. The method defines *what action* is allowed. `POST` means “accept incoming data” (perfect for form submissions).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*VPnS9Zq4cMhW7MjXmq3lvw.png" /></figure><p>line 162: this links our POST method to our REST API we created above.</p><p>line 163: this links our POST method to you Resource (/submit) path.</p><p>line 164: this specifies this endpoint accepts POST requests which is used for sending data, like form submissions (perfect for our client form requests).</p><p>line 165: no authentication required. Anyone can call this endpoint. Since this is a contact form, we want it to be public where anyone can submit their info.</p><h4>Lambda Integration</h4><p>This will connect the method to your Lambda function. So far, a resource is just a URL path. A method defines what you can do at that path.</p><p>Right now we’ve said “POST requests are allowed at /submit” — but it doesn’t do anything yet because we haven’t connected it to Lambda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*fxsX4DkKclD9_b5ZKImLJQ.png" /></figure><p>line 174: this integration handles POST requests (must match the method we defined).</p><p>line 175: this is how API Gateway calls Lambda. Lambda always requires POST, even if your API method were GET.</p><p>line 176: this means proxy integration which passes the entire request (headers, body, path) directly to Lambda and returns Lambda’s response directly to the client.</p><ul><li>AWS_PROXY: this is the easiest integration type.. Lambda receives everything (headers, body, query parameters) as an `<strong>event</strong>` object, and whatever Lambda returns goes straight back to the client.</li><li>No transformation needed =&gt; you don’t have to configure how data moves back and forth. It just works!</li></ul><p>Line 177: the Lambda function’s ARN =&gt; tells API Gateway which Lambda to call.</p><ul><li>You can have many Lambda functions in your AWS account</li><li>The URI line specifies exactly which one to invoke</li></ul><h4>Lambda Permission</h4><ul><li>Lambda Integration =&gt; “API Gateway, call this Lambda”</li><li>Lambda Permission =&gt; “Lambda, accept calls from this API Gateway.”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*g_270Zjk7MukdtEQOi8lIA.png" /></figure><p>line 183: this resource creates a permission policy on the lambda function.</p><p>line 185: the specific action allowed =&gt; permission to invoke (call/trigger) the Lambda function.</p><p>186: which Lambda function this permission applies to.</p><p>187: who gets permission =&gt; the API Gateway service.</p><p>188: which API Gateway can invoke it =&gt; our specific Rest API. the <strong>/*/* </strong>means any stage and method.</p><h3>API Gateway: CORS(Cross-Origin Resource Sharing)</h3><p>Browsers have a security feature called the <strong>Same-Origin Policy</strong>. It blocks web pages from making requests to a different domain than the one they came from.</p><p>Without CORS, the browser would block our contact form from calling our API. CORS is the mechanism that tells the browser “It’s okay, this API allows requests from that website.”</p><p>When your frontend makes a POST request, the browser first sends an OPTIONS request to ask “Am I allowed to do this?”</p><p><strong>How CORS works (the preflight check):</strong></p><ul><li><strong>Step 1:</strong> Browser sends OPTIONS request to /submit asking “Can I POST here?”</li><li><strong>Step 2:</strong> API Gateway returns CORS headers saying “Yes, POST is allowed” (Lambda is not called)</li><li><strong>Step 3:</strong> Browser checks the headers — looks good!</li><li><strong>Step 4:</strong> Browser sends the actual POST request with form data (name, email, message)</li><li><strong>Step 5:</strong> API Gateway forwards to Lambda, Lambda processes the form, and returns a success response</li></ul><p><strong>The 4 Pieces of CORS (How They Connect):</strong></p><ul><li><strong>Step 1 — OPTIONS Method:</strong> Browser sends OPTIONS request to /submit. The method says “Yes, I accept OPTIONS requests.”</li><li><strong>Step 2 — MOCK Integration:</strong> API Gateway handles this directly without calling Lambda. It says “I’ll respond myself, no backend needed.”</li><li><strong>Step 3 — Method Response:</strong> Declares which headers are allowed in the response. It says “I’m permitted to include these CORS headers.”</li><li><strong>Step 4 — Integration Response:</strong> Sets the actual header values. It says “Here are the real values: POST is allowed, any origin is allowed.”</li></ul><p><strong>Result:</strong> Browser receives the response and knows “POST is allowed from any origin.” Browser then sends the actual POST request.</p><h4>CORS — Options Method</h4><p>Allows browsers to call your API from a different domain (S3 website).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*4pF5cJU5LsRiOChGgCb_VQ.png" /></figure><p>line 197: this method handles OPTIONS requests (the browser’s preflight check).</p><p>line 198: no authorization require =&gt; the preflight check must be publicly accessible.</p><ul><li>http_method =&gt; “POST” vs “OPTIONS”: they both live on the same /submit resource</li><li>POST handles the actual form submissions</li><li>OPTIONS handles the browser’s “Am I allowed?” check</li></ul><h4>CORS — MOCK Integration</h4><p>Creates an integration for the OPTIONS method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*eO05X9T1NY9stgKUNJGf6g.png" /></figure><p>line 207: this integration handles OPTIONS requests.</p><p>line 208: API Gateway responds directly =&gt; no backend (Lambda) is called.</p><ul><li>Remember our POST integration? It uses <strong>type = “AWS_PROXY” </strong>which sends requests through the full chain: Browser to API Gateway to Lambda to DynamoDB/SES.</li><li>But MOCK integration (<strong>type = “MOCK”</strong>) stops at API Gateway. The request comes in, API Gateway responds directly, and nothing else is called.</li><li><strong>Why?</strong> The OPTIONS request is just the browser asking “Am I allowed to call this API?” It doesn’t need to process data, save to a database, or send emails. API Gateway can answer that question by itself — “Yes, you’re allowed.” No need to bother Lambda.</li></ul><p>line 210: ensures the OPTIONS method is created before this integration. Terraform needs this hint for proper ordering.</p><p>line 212–213: tells MOCK integration to return a 200 status. This is the “canned response” that MOCK provides. A “canned response” means a pre-written, hardcoded response and not generated.</p><ul><li>The <strong>request_templates </strong>block tells MOCK: “When you receive a request, just respond with status code 200 (OK).” It’s hardcoded — no logic, no processing, just “200 OK” every time.</li></ul><h4>CORS — MOCK Response</h4><p>Defines what the response from the OPTIONS method looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*raX9UEWrBQBkz9oU5fHJjA.png" /></figure><p>line 223: links to our OPTIONS method. References it dynamically instead of hardcoding “OPTIONS”.</p><p>line 224: this response definition is for HHTP 200 (OK) responses.</p><p>lines 226–230: declares which headers are allowed to be included in the response.</p><ul><li>the “<strong>= true” </strong>doesn’t set the header value. It just says “this header is permitted to exist in the response”</li><li>We will declare the actual values in the next step (integration response)</li><li><strong>Method Response</strong> =&gt; permission: “these headers can be included”</li><li><strong>Integration Response</strong> (our next step) =&gt; content: “Here are the actual values”</li></ul><h4>CORS — OPTIONS Integration Response</h4><p>Defines the actual response content from the MOCK integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*ymUulRbwPoNd1UxF45goOg.png" /></figure><p>line 240: links to our method response — uses its status code (“200”).</p><p>line 242: ensures the MOCK integration is created first.</p><p>lines 244–248: sets the actual values of the CORS headers.</p><ul><li><strong>Access-Control-Allow-Headers =&gt; </strong>Requests can include these headers</li><li><strong>Access-Control-Allow-Methods =&gt; T</strong>hese HTTP methods are allowed</li><li><strong>Access-Control-Allow-Origin =&gt; </strong>Requests from any domain are allowed</li></ul><h3>API Gateway: Deployment</h3><p>This is when we push our API configuration live. It creates a deployment =&gt; a snapshot of your API configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*KpE2VwmP95WCIxoCqf6eyg.png" /></figure><p>line 257–259: forces a new deployment every time you run <strong>terraform apply</strong>. Without this, Terraform might not detect API changes.</p><p>lines 261–263: creates the new deployment before destroying the old one. Prevents downtime during updates.</p><h4>Stage (prod)</h4><p>This creates the actual URL you can call. A live environment where the deployment runs =&gt; publishing to production.</p><p>Ensures both integrations (POST and OPTIONS) are created before deploying. You can’t deploy an incomplete API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*TZ2EGKzX0MN1qODLjUaR7g.png" /></figure><p>line 277: names the stage “<strong>prod</strong>” =&gt; this becomes part of your URL.</p><h3>Error in Function Call: lambda.zip</h3><p>After writing all this code, if we run <strong>terraform validate </strong>we get a bunch of errors regarding the <strong>lambda.zip.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*uJvKjVbPGUmKqkS1bQNIZQ.png" /></figure><p>We wrote the infrastructure first to understand how the pieces connect. In a real project, you might write Lambda code and Terraform side-by-side.. just remember that <strong>lambda.zip </strong>must exist before running <strong>terraform apply</strong>.</p><h3>Why we did Infrastructure First:</h3><ol><li><strong>See the full picture: u</strong>nderstand how all the pieces connect (API Gateway → Lambda → DynamoDB → SES) before writing the code that runs inside Lambda.</li><li><strong>Lambda code depends on infrastructure decisions:</strong> the Lambda code uses environment variables (TABLE_NAME, SENDER_EMAIL, BUSINESS_EMAIL) that we defined in <strong>main.tf</strong>. Seeing the Terraform first shows you why those variables exist.</li><li><strong>Logical flow for learning</strong> — You built the “container” (infrastructure) before the “contents” (code).</li></ol><h3>Lambda Function Code</h3><p><strong>What happens when someone submits the contact form?</strong></p><ol><li>Form data arrives → Parse the input</li><li>Need to track this inquiry → Generate a unique ID</li><li>Save it for later → Store in DynamoDB</li><li>Customer needs confirmation → Send confirmation email</li><li>Business needs to know → Send notification email</li><li>Tell the browser it worked → Return success response</li><li>If anything breaks → Handle errors</li></ol><p>Let’s build each step!</p><h3>Step 1: Imports &amp; Initialization</h3><p>In our lambda directory, we create a file called <strong>index.js </strong>to write our function code. Every Lambda function starts with imports and initialization.<strong> </strong>This is where we tell our code which tools it needs.</p><p>Before writing any code, look at your Terraform file <strong>main.tf</strong> to see what permissions you gave Lambda. The IAM policy tells you exactly what actions your function will perform. In our case it is 2 things: save data via DynamoDB &amp; send emails via SES.</p><ul><li>Look at our IAM policy for DynamoDB</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*XyvedxSBgom0UxEQvC0X7Q.png" /><figcaption>“dynamodb:PutItem” =&gt; This means our function will <strong>save data</strong> to DynamoDB.</figcaption></figure><ul><li>Look at our IAM policy for SES</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/1*Rx9RD9IkQIju35ihiKANyw.png" /><figcaption>“ses:SendEmail” =&gt; This means our function will <strong>send emails</strong>.</figcaption></figure><h4>Find the tools you need (imports)</h4><p>Now we need to find the JavaScript code that performs these actions. The <strong>IAM action</strong> maps directly to the <strong>SDK command</strong>:</p><ul><li><strong>dynamodb:PutItem</strong> → <strong>PutItemCommand</strong></li><li><strong>ses:SendEmail</strong> → <strong>SendEmailCommand</strong></li></ul><p>There’s a pattern to notice =&gt; Remove the service prefix (<strong>dynamodb:</strong> or <strong>ses:</strong>), and add Command to the end. That’s your import!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*kXcJ01uMdyzHCL1Sxb0wjA.png" /></figure><p>line 2: imports <strong>DynamoDBClient</strong> (the connection) and <strong>PutItemCommand </strong>(the action) from the <strong>DynamoDB package.</strong></p><p>line 3: creates client instances.. the <strong>{}</strong> means “use default settings” =&gt; Lambda automatically knows which AWS region to use.</p><ul><li>We use the “<strong>@aws-sdk/client/dynamodb” </strong>and <strong>“@aws-sdk/client-ses”</strong> packages because these packages are already built into Lambda. This means that we don’t need to install anything extra, which keeps our zip file small (just one file).</li></ul><h3>Step 2: Handler Function (entry point)</h3><p>This handler is the main function that Lambda runs when triggered. It receives an <strong>event</strong> object containing the request data form API Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*tI21IrWZvaXzN9ofxJkYgg.png" /></figure><p>line 9: <strong>exports.handler =&gt; </strong>this is the entry point Lambda calls when your function is triggered. <strong>async =&gt; </strong>allows us to use <strong>await </strong>later in the code for operations that take time (like saving to DynamoDB on line 17 and sending emails on lines 29 and 41).</p><p>line 10: <strong>try { =&gt; </strong>starts error handling. If anything inside fails, we catch the error and return a friendly message instead of crashing.</p><h3>Step 3: Parse From Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*WSUgKCBgxTVTWZSC9T9q_g.png" /></figure><p>line 11: <strong>JSON.parse(event.body) =&gt; </strong>the form data arrives as a JSON string. <strong>JSON.parse </strong>converts it into a JavaScript object we can work with.</p><p>line 12: <strong>const { name, email, message } = body =&gt; </strong>this is called destructuring. It pulls out the <strong>name, email, </strong>and <strong>message </strong>from the body object into separate variables.</p><ul><li>Example: when someone submits info into the contact form, the API Gateway sends Lambda an event that looks like this..</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jfk5Nh4PtY8c7SGCmJF3LA.png" /></figure><ul><li>After <strong>JSON.parse, </strong>we can access <strong>name, email, </strong>and <strong>message</strong> directly.</li></ul><h3>Step 4: Generate Unique ID</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*Pt7TTO0cpQdOR9i22OYDbw.png" /></figure><p>line 15: generates a unique inquiry ID like <strong>INQ-123456789</strong>.. <strong>Date.now() </strong>returns the current time in milliseconds which guarantees each submission gets a unique ID.</p><h3>Step 5: Save to DynamoDB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*VT5X7eipd83LoVT3S_-01w.png" /></figure><p>line 18: <strong>await dynamoDB.send(…) =&gt; </strong>sends the command to DynamoDB. <strong>await </strong>means “wait for this to finish before moving on.”</p><p>line 19: <strong>TableName: process.env.TABLE_NAME =&gt; </strong>which table to save to. Remember the environment variable? This is where we use it (refer to <strong>variables.tf file</strong>=&gt; lines 13–17). This is how our infrastructure and code connects.</p><p>lines 20–26: <strong>Item: {…} =&gt; </strong>the data we’re saving. Each field needs <strong>{ S: value } </strong>where <strong>S</strong> means “string type”. This is DynamoDB’s format for data.</p><p>line 21: <strong>Unique ID</strong> we created on line 15.</p><p>line 22: <strong>Customer’s Name</strong> from the form.</p><p>line 23: <strong>Customer’s Email</strong> from the form.</p><p>line 24: <strong>Customer’s Message</strong> from the form.</p><p>line 25: when the form was submitted (gives <strong>timestamp</strong>)</p><h3>Step 6: Send Confirmation Email (to customer)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThIyx3qcnpoDhOAcDSlOXw.png" /></figure><p>line 30: <strong>awai ses.send(new SendEmailCommand({…})) =&gt; </strong>sends an email via SES. <strong>await </strong>waits for it to complete before moving on.</p><p>line 31: <strong>Source: provess.env.SENDER_EMAIL =&gt; </strong>the “from” address which reads from the environment variable we set in Terraform. This email must be verified in SES.</p><p>line 32: <strong>Destination: { ToAdresses: [email] } =&gt; </strong>the “to” address- the customer’s email from the form submission.</p><p>line 34: <strong>Subject: { Data: “…” } =&gt; </strong>the email subject line.</p><p>lines 35–36: <strong>Body: { Text: { Data: …} } =&gt; </strong>the email body. Uses template literals to insert <strong>${name} </strong>and <strong>${inquiryId}</strong>. The <strong>\n\n </strong>creates line breaks.</p><p>What the email the customer will receive:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*0HmVHeHfAm_o9QcHKaGglQ.png" /></figure><h3>Step 7: Send Notification Email (to business)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*iVNnCVoXMlMKslv8xjE0bA.png" /></figure><p>line 42: <strong>await ses.send(new SendEmailCommand({…})) =&gt; </strong>sends an email via SES.</p><p>line 43: <strong>Source: process.env.SENDER_EMAIL =&gt; </strong>the “from” address- same as the customer email.</p><p>line 44: <strong>Destination: { ToAddresses: [process.env.BUSINESS_EMAIL] } =&gt; </strong>the “to” address- sends to te business email instead of the customer.</p><p>line 46: <strong>Subject: { Data: \`New Inquiry: ${inquiryId}\` } =&gt; </strong>subject includes the inquirt ID for easy tracking.</p><p>line 48: <strong>Text: { Data: … } =&gt; </strong>body includes all inquiry details so the business can follow up.</p><h3>Step 8: Return Success Response</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*pd1hDJ01Q7L3j_g5o4vWcQ.png" /></figure><p>line 54: <strong>return { =&gt; </strong>sends a response back to API Gateway and then to the browser.</p><p>line 55: <strong>StatusCode: 200 =&gt; </strong>HTTP 200 = success. Tells the browser everything worked.</p><p>line 56–59: <strong>headers: {…} =&gt; </strong>CORS headers- allows the browser to recerive this response from a different domain (our s3 website).</p><p>line 60: <strong>body: JSON.stringify({ message: “Success!”, inquiryId }) =&gt; </strong>the response body- converts the JavaScript object to a JSON string. Returns the inquiry ID so the frontend can show it to the user.</p><h3>Step 9: Error Handling</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*8AxGSVP0KoAn2xeLpBtBtg.png" /></figure><p>line 64: <strong>} catch (error) { =&gt; </strong>if anything in the <strong>try </strong>(line 10)<strong> </strong>block fails, execution jumps here.</p><p>line 65: <strong>console.error(“Error:”, error) =&gt; </strong>logs the error to CloudWatch for debugging. We can view these logs in the AWS Console.</p><p>line 66: <strong>return { =&gt; </strong>sends an error response back to API Gateway.</p><p>line 67: <strong>statusCode: 500 =&gt; </strong>HTTP 500 = server error. Tells the browser something went wrong.</p><p>lines 68–71: <strong>headers: {…} =&gt; </strong>CORS headers — still needed even for error responses.</p><p>line 72: <strong>body: JSON.stringify({ message: “Error submitting inquiry” }) =&gt; </strong>generic error message. We want to make sure not to expose any internal details to users for privacy and security.</p><ul><li>We want to give a generic error message because we don’t want to tell users “DynamoDB connection failed” or “SES quota exceeded”.. that reveals our infrastructure.</li><li>Keep error messages simple and check CloudWatch logs for the real details.</li></ul><p>Remember the <strong>try</strong> { on line 10.. Everything between <strong>try</strong> and <strong>catch</strong> is “protected.” If any line fails (DynamoDB down, SES quota exceeded, invalid data), execution immediately jumps to the <strong>catch</strong> block instead of crashing.</p><h3>Zip the Lambda Code</h3><p>Terraform needs our Lambda code packaged as a <strong>.zip </strong>file before it can deploy. Create the zip:</p><ol><li>make sure you <strong>cd </strong>into <strong>lambda </strong>directory so the zip contains <strong>index.js </strong>at the root level (not nested inside a folder)</li><li>run this command: <strong>zip -r ../infrastructure/lambda.zip index.js</strong>. This creates the lambda.zip file inside of your <strong>infrastructure </strong>directory</li><li>verify it exsists: <strong>ls ~/Desktop/cloud-projects/project4-travelease/infrastructure/lambda.zip</strong></li></ol><p><strong>Why zip from inside the lambda folder? </strong>If you zipped from outside, the zip would contain <strong>lambda/index.js</strong> instead of just <strong>index.js</strong>. Lambda expects <strong>index.js</strong> at the root of the zip.. otherwise it can’t find your handler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*HfmqqCTixpDwRzpB7XpgZg.png" /></figure><h3>Outputs Setup</h3><p>We need to create a new <strong>outputs.tf </strong>file under the <strong>infrastructure directory</strong>. Outputs print important info to your terminal after <strong>terraform apply</strong> completes, so you don’t have to dig through the AWS Console to find these values.</p><p><strong>Why do we need Outputs?</strong> After Terraform builds all your infrastructure, you need 2 pieces of info to actually use it:</p><ol><li>Website URL: where to view your contact form</li><li>API URL: where your frontend sends form submissions</li></ol><p>Without outputs, you’d have..</p><ol><li>Log into AWS Console</li><li>Navigate to S3</li><li>Find the bucket</li><li>Click through settings to find the website URL</li><li>Then do the same for API Gateway</li></ol><p>Outputs give you everything in one place, right in your terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*aQ8pPMWKGx2kURB6nQnmuw.png" /></figure><p>line 5: creates an output named “<strong>website_url</strong>”.</p><p>line 6: gets the <strong>website URL</strong> from your S3 bucket configuration.</p><p>line 9: creates an output named “<strong>api_url</strong>”.</p><p>line 10: gets the API Gateway URL and adds `<strong>/submit</strong>` to the end.</p><p>Now we can <strong>cd </strong>back into our <strong>infrastructure </strong>directory and run <strong>terraform apply. </strong>This will show us a plan of what it’s going to create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*pAyQdOCbMD2ULcBNg_wbwg.png" /></figure><p>Confirm this by entering <strong>yes</strong> and Terraform will deploy all 19 resources!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*lDDThSDSaNx-wGtUvWz0wg.png" /></figure><h3>Almost Done..</h3><p>A quick recap of what we completed:</p><h4>Terraform Infrastructure — (main.tf)</h4><ul><li>S3 Bucket (static website hosting)</li><li>S3 Bucket Policy (public access)</li><li>DynamoDB Table (store inquiries)</li><li>IAM Role &amp; Policy (Lambda permissions)</li><li>Lambda Function</li><li>API Gateway (REST API, Resource, Methods, Integrations, CORS, Deployment, Stage)</li></ul><h4>Lambda Function — (index.js)</h4><ul><li>Parse form data</li><li>Generate unique inquiry ID</li><li>Save to DynamoDB</li><li>Send confirmation email to customer</li><li>Send notification email to business</li><li>Error handling</li></ul><h4>Supporting Terraform Files</h4><ul><li>provider.tf</li><li>variables.tf</li><li>terraform.tfvars</li><li>outputs.tf</li></ul><h4>Deployed Infrastructure</h4><ul><li><strong>terraform apply </strong>successfuly created 19 resources</li></ul><p>With our infrastructure deployed, we’re in the home stretch. <br>3 steps left: verify our email, build the frontend, and test.</p><h3>Verify Your SES Email</h3><p>Before your contact form can send emails, AWS needs to verify your email address. SES (Simple Email Service) starts in sandbox mode, which means both the sender AND recipient email must be verified.</p><ol><li>Go to <strong>AWS Console → SES</strong> (Simple Email Service).</li><li>Make sure you’re in the correct region (mine was <strong>us-west-1</strong>).</li><li>Click “<strong>Verified Identities</strong>” in the left sidebar.</li><li>Click “<strong>Create Identity</strong>”.</li><li>Select “<strong>Email address</strong>”.</li><li>Enter your email and click “<strong>Create Identity</strong>”.</li><li>Check your inbox for a verification email from AWS.</li><li>Click the verification link.</li></ol><p>Once verified, you’ll see a green “<strong>Verified</strong>” status next to your email.</p><p>️Important: SES sandbox mode only lets you send to verified emails. For a portfolio project this is fine, but a production app would need to request production access from AWS.</p><h3>Build Frontend</h3><p>The frontend is three files: <strong>index.html</strong>, <strong>styles.css</strong>, and <strong>script.js</strong>. Since this article focuses on the backend infrastructure, I’m not going to walk through every line of HTML and CSS. The frontend is the fun part so I’d encourage you to build your own!</p><p>The only critical piece is <strong>script.js</strong>. It needs to send a POST request to your API Gateway URL with the form data (name, email, message) as JSON. That’s the bridge between your frontend and everything we just built.</p><p>Here are some resources to help you build it:</p><ul><li><strong>v0 by Vercel (</strong><a href="https://v0.app/"><strong>v0.dev</strong></a><strong>)</strong>: describe what you want and it generates a full UI for you. Try something like “travel agency landing page with a contact form” and customize from there.</li><li><strong>freeCodeCamp’s Responsive Web Design course</strong>: covers HTML and CSS fundamentals if you want to build from scratch.</li><li><strong>MDN Web Docs (</strong><a href="https://developer.mozilla.org/en-US/"><strong>developer.mozilla.org</strong></a><strong>): </strong>the go-to reference for HTML, CSS, and JavaScript. Search “fetch API” for help with the form submission logic.</li></ul><p>The full frontend code is available in my GitHub repo if you want to see how I built mine.</p><h3>Upload Frontend to S3</h3><p>Instead of looking the code we built, we can run <strong>cd </strong>to out infrastructure directory and run <strong>terraform output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*bdEv2z9oueId1qQi3atYsA.png" /></figure><p>Looking at your <strong>website_url </strong>output, we can derive our s3 bucket name to be <strong>travelease-contact-form-project4-travelease </strong>(everything before <strong>.s3-website </strong>is the bucket name). This pattern recognition is important and can be useful for anytime you pull out the bucket name from any s3 url.</p><h3>Test the Contact Form</h3><ul><li>Open <strong>website_url</strong> in browser</li><li>Submit a test inquiry</li><li>Verify email received</li><li>Verify data saved in DynamoDB</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*CHB6JeLoD1Wbyl0Gx6fduA.png" /></figure><p>Success! Everything went by smoothly.. However, this is my second time I’ve done this project and experienced many errors during my 1st attempt.</p><p>At the end of this article, I’ve provided a <strong>deeper analysis</strong> of where things went wrong and how I fixed it.. but lets move on!</p><h3>Spam Folder</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*6iyZ0qFhAqBIDaSkUEdOvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*h2UhUbXGVXRDcsNNCQ7IPg.png" /></figure><p>Both emails landed in my spam folder. This is expected with SES sandbox mode. Here’s why..</p><p>Email providers like Gmail check three things to trust an email:</p><ul><li><strong>SPF</strong> — is this server allowed to send for this domain?</li><li><strong>DKIM</strong> — was this email actually sent by who it claims?</li><li><strong>DMARC </strong>— what should I do if SPF/DKIM fail?</li></ul><p>SES sandbox emails fail all three checks because we’re sending from a shared AWS IP with no domain verification. Gmail sees an unverified sender on a shared IP and flags it as spam.</p><p><strong>The production fix</strong>: purchase a custom domain, verify it in SES, configure SPF and DKIM DNS records, and request SES production access. For a portfolio project, the spam folder behavior is expected and acceptable.</p><h3>Cleanup</h3><p>To <strong>avoid AWS charges</strong>, destroy all resources:</p><ul><li><strong>terraform destroy</strong></li><li>Type “yes” to confirm and Terraform removes all 19 resources.</li></ul><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*Ppp2FFFsDf5eYDPvpTnqWw.png" /></figure><p>We started with a simple problem: TravelEase was losing customer inquiries through a broken mailto link. We ended with a fully serverless solution that captures every inquiry in DynamoDB, sends instant confirmation emails to customers, and notifies the business — all deployed through Terraform with zero servers to manage.</p><h4>Here’s what this project taught me:</h4><p>Infrastructure and code are deeply connected. The environment variables in main.tf map directly to process.env in Lambda.</p><p><strong>The IAM policy actions</strong> (dynamodb:PutItem, ses:SendEmail) map directly to the SDK commands (PutItemCommand, SendEmailCommand). Once you see those connections, serverless architecture clicks.</p><p><strong>CORS isn’t just a checkbox</strong>. It’s a full request-response cycle between the browser and API Gateway that happens before your actual request even fires. Understanding the preflight check made debugging so much easier on my second attempt.</p><p><strong>Building the same project twice was worth it</strong>. The first time, I copied code and hit errors I couldn’t explain. The second time, I understood every line — and when something breaks in the future, I’ll know exactly where to look.</p><p>The full source code is available on my <strong>GitHub</strong>: <br><a href="https://github.com/elnala24/project4-travelease-contact-form">github.com/elnala24/project4-travelease-contact-form</a></p><p>Thanks for reading! If you ran into errors following along, keep scrolling — I’ve documented the bugs I hit on my first attempt and how I fixed them.</p><h3>Troubleshooting: Errors From My 1st Attempt</h3><p>This was my second time building this project. The first time, I ran into two major errors that took a while to figure out.</p><h4>Error 1: Runtime.ImportModuleError</h4><p>After deploying and submitting the contact form, nothing happened. I checked CloudWatch logs and saw this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jaylKzJIsATYzomJFX2YRg.png" /></figure><p>The error: Runtime.ImportModuleError. My Lambda function couldn’t find the module it was trying to import.. The problem was in my code. I had written:</p><pre>const AWS = require(&#39;aws-sdk&#39;);</pre><p>This is AWS SDK v2 syntax. But my Lambda was running Node.js 18, which only includes SDK v3. SDK v2 isn’t installed, so Lambda couldn’t find it.. The fix:</p><pre>const { DynamoDBClient } = require(&#39;@aws-sdk/client-dynamodb&#39;);<br>const { SESClient } = require(&#39;@aws-sdk/client-ses&#39;);</pre><p>Lesson learned: always match your import syntax to your runtime version. Node.js 16 uses SDK v2. Node.js 18+ uses SDK v3. They’re completely different syntax.</p><h4>Error 2: CORS Policy Blocked</h4><p>After fixing the import error, I submitted the form again and got this in the browser console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*6ghzo_MrS5DJBg5WFGOZ3A.png" /></figure><p>“No ‘<strong>Access-Control-Allow-Origin</strong>’ header is present on the requested resource.”</p><p>This meant the browser’s preflight check failed. The browser sent an OPTIONS request to my API asking “Am I allowed to POST here?” and got no CORS headers back.</p><p>The fix required CORS headers in two places:</p><ol><li>API Gateway — the OPTIONS method with MOCK integration needs to return the proper Access-Control-Allow headers.</li><li>Lambda response — every response (success AND error) must include CORS headers in the headers object Missing CORS headers in either place causes this error. This is the most common serverless bug I’ve seen — and now I understand exactly why both pieces are needed.</li></ol><p>Missing CORS headers in either place causes this error. This is the most common <strong>serverless bug</strong> I’ve seen.. and now I understand exactly why both pieces are needed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c7759f9c423" width="1" height="1" alt=""><hr><p><a href="https://awstip.com/project-contact-form-site-w-aws-lambda-and-more-3c7759f9c423">Project — Contact Form Site w/ AWS Lambda and more!</a> was originally published in <a href="https://awstip.com/">AWS Tip</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Configured AI to Actually Understand My AWS Projects]]></title>
            <link>https://medium.com/@elnala24/how-i-configured-ai-to-actually-understand-my-aws-projects-a6edd33f58ac?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6edd33f58ac</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[ai-tools]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 20:51:12 GMT</pubDate>
            <atom:updated>2026-02-10T21:20:15.994Z</atom:updated>
            <content:encoded><![CDATA[<p>Setting up CLAUDE.md, rules, and MCPs to reduce AI mistakes and speed up cloud engineering workflows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*nZmbrExsM9xPGVsC" /></figure><p>In the middle of rebuilding a project, I asked myself: is there a way to work with AI more effectively? Can I get it to actually understand my project instead of giving me generic, copy-paste answers?</p><p>The answer is yes! it starts with how you set things up (-:</p><h3>My Current Setup</h3><p>I had Claude Code installed in VS Code and had used it before, but I ran into a problem: every time I started a new session, the AI had no memory of what we’d worked on. It didn’t know my tech stack, my file structure, or the decisions I’d already made. Every conversation felt like starting from scratch.</p><p>So I stopped using it and went back to Claude.ai on the web instead. I created a Project folder there, and that solved the memory problem.. Claude.ai remembered everything across chats as long as I stayed inside the project.</p><p>But I knew I was leaving power on the table. Claude Code can actually read my files, run commands, and work inside my codebase. The web version can’t do any of that. I just needed to figure out how to give Claude Code the context it was missing.</p><p>That’s when a developer friend recommended three things that changed my workflow: <strong>CLAUDE.md files, technology-specific rules, and MCPs</strong>.</p><h3>What is CLAUDE.md?</h3><p>CLAUDE.md is a markdown file that sits in your project’s root directory. When you open Claude Code, it reads this file automatically before doing anything else. Think of it as a cheat sheet you hand to a new teammate on their first day.. it tells them what the project is, how it’s structured, what tools you’re using, and what rules to follow.</p><p>Without it, Claude Code has to scan your files and guess what’s going on. With it, Claude already knows.</p><h3>The “Before” — Without CLAUDE.md</h3><p>Here’s what Claude Code looked like when I opened it in my TravelEase project (a serverless contact form built with Terraform and AWS). I asked it a simple question: <strong>“What AWS services does this project use and where are they defined?”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*t1BKcH0g1CRbfmcJqt4z7A.png" /></figure><p>It gave me a generic greeting. It could see my files, but it didn’t really know my project. To answer any question, it would have to read through everything first.. and even then, it might miss context that isn’t obvious from the code alone.</p><h3>Creating CLAUDE.md</h3><p>Setting it up is simple. In your terminal use:</p><pre>touch CLAUDE.md</pre><p>Then I filled it in with everything Claude Code would need to know about my project:</p><ul><li><strong>Project overview:</strong> what TravelEase is and how it works</li><li><strong>Tech stack</strong>: Terraform, AWS (S3, API Gateway, Lambda, DynamoDB, SES)</li><li><strong>Project structure</strong>: every folder and file, and what it does</li><li><strong>Current status</strong>: where I am in the build (infrastructure deployed, frontend next)</li><li><strong>Key commands</strong>: terraform init, plan, apply, destroy, and how to zip Lambda</li><li><strong>Important rules</strong>: least-privilege IAM, CORS configuration, cost limits</li><li><strong>Known issues</strong>: problems I already solved so AI doesn’t repeat them</li></ul><p>Here’s what my project looked like after creating the file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fHUDem1qe13ad5Y4eftqNg.png" /></figure><p>The key thing is: this file doesn’t have to be perfect on day one. You add to it as you work:</p><ul><li>Found a weird bug =&gt; Add it to <strong>Known Issues</strong></li><li>Learned a new command =&gt; <strong>Add it to Key Commands</strong></li></ul><p>The file grows with your project.</p><h3>The “After” — With Claude.md</h3><p>I closed Claude Code, reopened it, and asked the exact same question: “<strong>What AWS services does this project use and where are they defined?</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*LEWJicTBHXawLYDoSUgCdg.png" /></figure><p>The difference is night and day. Instead of guessing, Claude Code said <strong>“Based on the CLAUDE.md and the open file, let me check the infrastructure definition for specifics.”</strong></p><p>It used my context file as a starting point, then verified against my actual code. It gave me a detailed table with every service, its purpose, and the exact line numbers where each one is defined.</p><p>No generic answers. No scanning around confused. It just knew my project.</p><h3>Adding Rules for My Tech Stack</h3><p>The CLAUDE.md file tells Claude <strong>what</strong> my project is. But I also wanted to tell it <strong>how</strong> to write code for my specific tools. This is where technology-specific rules come in. I added three sets of rules to the bottom of my CLAUDE.md:</p><ol><li><strong>Terraform Rules</strong>: things like always running <strong>terraform fmt</strong> before committing, using <strong>variables</strong> instead of <strong>hardcoding</strong>, and <strong>tagging</strong> all resources.</li><li><strong>AWS Lambda Rules</strong>: always set timeout and memory explicitly, include CORS headers in every response, and log meaningful info for CloudWatch debugging.</li><li><strong>Security Rules</strong>: never use wildcard (<strong>*</strong>) IAM actions, always use least-privilege, and never hardcode credentials.</li></ol><p>These aren’t random opinions. They come from real mistakes I made on my first attempt at this project, plus best practices from Terraform and AWS documentation.</p><p>To test if the rules actually worked, I asked Claude Code: “<strong>Write me an IAM policy for a Lambda function that needs to read from S3.</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*ew3B5TNR8JFLvumEXVsA3A.png" /></figure><p>Without the rules, AI typically writes lazy IAM policies with <strong>Action: “s3:*”</strong> or <strong>Resource: “*”</strong>. But look at the bottom of the response.. it literally says “<strong>No wildcard (*) actions, following your project’s least-privilege rule.</strong>” It read my rules and followed them. That’s not generic AI output. That’s AI working within the guardrails I set. You can find rule templates for almost any tech stack at <strong>cursor.directory. </strong>Just search for your tools and paste the relevant rules into your context file.</p><h3><strong>Setting Up an MCP (Model Context Protocol)</strong></h3><p>CLAUDE.md and rules give AI static context: info that’s written down ahead of time. But what if AI could go fetch info on its own when it needs it?</p><p>That’s what <strong>MCPs</strong> do. They’re like <strong>plugins</strong> that give <strong>AI tools extra abilities</strong>. The one I set up is called <strong>Context7</strong>, and it lets Claude Code pull up-to-date documentation for any library or framework automatically. This means when I ask about a Terraform resource, it doesn’t just answer from memory (which could be outdated). It fetches the latest official docs.</p><h3>The Setup (and the Hiccups)</h3><p>Setting up an MCP was the one part that didn’t go smoothly on the first try. I’m sharing my mistakes because I know other beginners will hit the same ones.</p><h4>Hiccup #1: Editing the config file manually doesn’t work</h4><p>I found the Claude Code settings file using:</p><pre>~/.claude/settings.json</pre><p>and manually added the Context7 configuration:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;context7&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [&quot;-y&quot;, &quot;@upstash/context7-mcp@latest&quot;]<br>    }<br>  }<br>}</pre><p>When I reopened Claude Code and tested it, I got this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*oWuOtsMGu8PP0XAJoPuHXA.png" /></figure><p>It didn’t work.. After some research, I learned that the VS Code extension requires you to configure MCP servers through the CLI command, not by editing the JSON file directly.</p><h4>Hiccup #2: The CLI wasn’t installed</h4><p>The Claude Code VS Code extension and the CLI are two separate things. I had the extension but not the CLI. When I ran the MCP command, I got: “<strong>zsh: command not found: claude”.</strong></p><p>The fix was simple:</p><pre>npm install -g @anthropic-ai/claude-code</pre><h4>The actual setup (one command):</h4><p>After installing the CLI, the MCP setup was just one command:</p><pre>claude mcp add context7 -- npx -y @upstash/context7-mcp@latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*yYId-UhnYdg-fOUxCmwxTw.png" /></figure><p>The key line in the output: <strong>“Added stdio MCP server context7”</strong> =&gt; that means it’s configured and ready to use.</p><h3>Testing Context7</h3><p>I reopened Claude Code and asked: <strong>“Using context7, look up the latest Terraform documentation for the aws_lambda_function resource.” </strong>This time, it worked!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*syeAerUmkbyVF5DmtccpNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*M7YYsykDDuQlw-4tKFN9PA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*BdeDUB_JXjq31sZKUFiVBA.png" /></figure><p>Look at what it did:</p><ol><li>It fetched the real, up-to-date Terraform documentation with a full table of every argument.</li><li>It pulled actual code examples from the official docs.</li><li>And the best part (at the bottom), it compared the docs against my actual project: <strong>“Your main.tf:124–139 uses filename, source_code_hash, function_name, role, handler, runtime, and an environment block — which covers the core required arguments.”</strong></li></ol><p>That last part is CLAUDE.md and Context7 working together. The MCP fetched the documentation, and the context file told Claude to relate it back to my project. Neither one alone would have produced that result.</p><h3>What I Learned</h3><p>Before this setup, I was copying and pasting code between Claude.ai and my project, re-explaining my tech stack every session, and fixing the same types of AI mistakes over and over. After spending about an hour configuring things properly, here’s what changed:</p><ul><li><strong>CLAUDE.md</strong> eliminated the “starting from scratch” problem. Claude Code knows my project, my file structure, and my current progress the second it starts up.</li><li><strong>Rules </strong>stopped the generic, lazy code. No more wildcard IAM policies or missing CORS headers. The AI follows the same standards I follow.</li><li><strong>Context7 MCP</strong> gave Claude access to real documentation. Instead of answering from potentially outdated training data, it fetches the latest docs and compares them against my actual code.</li></ul><p>The setup isn’t complicated, but it’s not obvious either especially experiencing those hiccups I ran into with MCP configuration. Hopefully this saves you some time.</p><h3>Quick Start Checklist</h3><p>If you want to set this up for your own project:</p><p>1. Create a <strong>CLAUDE.md</strong> in your project root with your project overview, tech stack, file structure, key commands, and rules.</p><p>2. Add technology-specific <strong>rules</strong>.. check <a href="https://cursor.directory/"><strong>cursor.directory</strong></a> for templates.</p><p>3. Install the Claude Code CLI:</p><pre>npm install -g @anthropic-ai/claude-code</pre><p>4. Add <strong>Context7 MCP</strong>:</p><pre>claude mcp add context7 - npx -y @upstash/context7-mcp@latest</pre><p>5. Search <a href="https://mcp.so/"><strong>mcp.so</strong></a> or <a href="https://smithery.ai/"><strong>smithery.ai</strong></a> for MCPs specific to your stack.</p><p>The whole process takes <strong>under an hour</strong>. The time you save after that is worth it.</p><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6edd33f58ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — YouTube Title Generator with AI & TS]]></title>
            <link>https://medium.com/@elnala24/project-youtube-title-generator-with-ai-ts-4e5837df6423?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e5837df6423</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Fri, 09 Jan 2026 01:01:48 GMT</pubDate>
            <atom:updated>2026-01-09T01:10:11.385Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project — YouTube Title Generator with AI &amp; TS</h3><p><em>How I built a modern web app that analyzes YouTube videos and generates creative title variations using free APIs</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cp1E6uCle4ZGN_xU1N4-8Q.png" /></figure><h3><strong>Introduction</strong></h3><p>As a developer interested in both content creation and AI, I wanted to build something practical that combines these interests. The result? A YouTube Video Metadata &amp; AI Title Generator that fetches video information and uses AI to generate creative title variations in different tones.</p><p><strong>What makes this project special</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*ebWIhNEtg0I4p-cT6sG0SA.png" /></figure><ul><li>100% free to build and run (no paid APIs!)</li><li>Clean TypeScript architecture</li><li>Real-world API integration (YouTube Data API + Groq AI)</li><li>Modern, responsive UI with smooth animations</li><li>Privacy-first approach (API keys stay local)</li></ul><h3><strong>The Problem: Content Creators Need Better Titles</strong></h3><p>YouTube creators know that titles make or break a video’s success. But coming up with engaging, varied titles is time-consuming. I wanted to solve this by:</p><p>1. Automatically fetching video metadata (title, thumbnail, duration, channel)</p><p>2. Using AI to generate 4 different title variations with distinct tones:</p><ul><li><strong>Casual:</strong> Friendly, conversational</li><li><strong>Professional:</strong> Formal, business-appropriate</li><li><strong>Clickbait: </strong>Engaging, curiosity-driven (but not misleading!)</li><li><strong>Academic:</strong> Scholarly, informative</li></ul><h3><strong>Tech Stack &amp; Architecture</strong></h3><p><strong>Frontend</strong></p><ul><li><strong>TypeScript:</strong> Type safety and better developer experience</li><li><strong>Vite: </strong>Lightning-fast build tool and dev server</li><li><strong>Vanilla CSS: </strong>Clean, maintainable styling with CSS Grid and Flexbox</li></ul><p><strong>APIs</strong></p><ul><li><strong>YouTube Data API v3:</strong> Fetch video metadata</li><li><strong>Groq API with Llama 3.3 70B: </strong>AI-powered title generation</li></ul><h3><strong>Key Design Decisions</strong></h3><p><strong>Why Groq instead of OpenAI/Anthropic?</strong></p><p>Groq offers a completely free tier with generous limits (14,400 requests/day) and no credit card required. Perfect for side projects!</p><p><strong>Why .env files instead of a backend?</strong></p><p>This is a pure frontend app. Users provide their own API keys via environment variables, keeping the project:</p><ul><li>Cost-free (no server hosting)</li><li>Privacy-focused (keys never leave the user’s machine)</li><li>Simple to deploy via static hosting on GitHub Pages</li></ul><h3><strong>Implementation Walkthrough</strong></h3><p><strong>Project Setup:</strong></p><p>First, I bootstrapped the project using Vite by entering these commands:</p><p><strong>npm create vite@latest ytapp-project — — template vanilla-ts</strong></p><p><strong>cd ytapp-project</strong></p><p><strong>npm install</strong></p><ul><li><strong>npm create vite@latest: </strong>Uses Vite’s project scaffolding tool</li><li><strong>template vanilla-ts:</strong> Creates a vanilla TypeScript project (no framework like React/Vue)</li><li><strong>npm install: </strong>Installs all dependencies</li></ul><h3><strong>Why Vite over Create-React-App or Webpack?</strong></h3><p>I asked Claude to set up a modern, fast development environment, and it chose Vite because it has:</p><ul><li><strong>Lightning-fast hot reload</strong> — Changes appear instantly in the browser</li><li><strong>Optimized builds</strong> — Uses native ES modules during development</li><li><strong>Minimal configuration</strong> — Works out of the box</li><li><strong>Better TypeScript support</strong> — Faster type checking</li></ul><h3><strong>Working with AI: The Reality</strong></h3><p>I didn’t manually configure all the TypeScript settings. I described what I wanted to build, and Claude set up the entire development environment with proper TypeScript configuration automatically.</p><p>The generated <strong>**tsconfig.json**</strong> includes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*sKYoNNxLs-9k2q58c6VyRA.png" /></figure><h3><strong>Why this matters:</strong></h3><p>When working with AI coding assistants, you don’t need to be an expert in every configuration detail. I benefitted from this because:</p><ul><li><strong>I focused on: </strong>What I wanted to build (features, functionality, user experience)</li><li><strong>AI handled:</strong> Setup, configuration, best practices, and boilerplate code</li></ul><p>The <strong>`strict: true`</strong> setting, for example, automatically:</p><ul><li>Catches <strong>`null`</strong> and <strong>`undefined`</strong> errors at compile time</li><li>Forces explicit typing (no implicit <strong>`any`</strong> types)</li><li>Prevents common JavaScript bugs before they reach production</li><li>Provides better IDE autocomplete and refactoring</li></ul><h3><strong>My workflow looked like this:</strong></h3><p>1. “I want to build a YouTube video metadata app with AI title generation”</p><p>2. Claude set up the project structure with Vite + TypeScript</p><p>3. I reviewed the setup and asked questions about what I didn’t understand</p><p>4. We iterated on features, with me driving the requirements and Claude implementing them</p><p>This approach let me build a production-quality app while learning TypeScript best practices along the way.</p><h3><strong>YouTube API Integration</strong></h3><p><strong>My Request:</strong></p><p>I need to fetch YouTube video metadata — title, thumbnail, duration, and channel name.</p><p><strong>What Claude Built:</strong></p><p>Claude created a clean `YouTubeAPIService` class that handles all the complexity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*IoRJqnSA3HmWP0xgjo2TDA.png" /></figure><h3><strong>What I Learned — </strong>Before this project, I didn’t know:</h3><h3><strong>ISO 8601 Duration Format (`PT15M33S`)</strong></h3><p>YouTube doesn’t return duration as <strong>“15:33”</strong> like we see on the website. Instead, it returns <strong>`PT15M33S`</strong>, which is an international standard format:</p><ul><li><strong>`P`</strong> = Period (indicates a duration)</li><li><strong>`T`</strong> = Time (separates date from time components)</li><li><strong>`15M`</strong> = 15 minutes</li><li><strong>`33S`</strong> = 33 seconds</li></ul><p><strong>Why this matters..</strong></p><p>APIs often use standardized formats to avoid timezone/locale issues. A video that’s <strong>“15:33”</strong> could mean 15 hours 33 minutes, or 15 minutes 33 seconds depending on context. ISO 8601 removes ambiguity.</p><p>Claude automatically wrote a parser that converts <strong>`PT2H15M33S`</strong> → <strong>`2:15:33`</strong> and <strong>`PT5M10S`</strong> → <strong>`5:10`</strong>. Without AI assistance, I would have spent hours trying to debug this.</p><h3><strong>API `part` Parameters</strong></h3><p>YouTube’s API is modular — you request only what you need:</p><ul><li><strong>`snippet`</strong> = basic info (title, channel, thumbnail)</li><li><strong>`contentDetails`</strong> = duration, definition, caption info</li><li><strong>`statistics` </strong>= views, likes, comments</li></ul><p>This saves bandwidth and improves performance. I learned this pattern is common in REST APIs.</p><h3><strong>HTTP Status Codes</strong></h3><ul><li><strong>`403`</strong> = Forbidden (invalid API key or quota exceeded)</li><li><strong>`404`</strong> = Not Found (video doesn’t exist or is private)</li><li><strong>`401`</strong> = Unauthorized (authentication failed)</li><li><strong>`429`</strong> = Too Many Requests (rate limited)</li></ul><p>Claude built specific error messages for each case, making debugging much easier.</p><h3><strong>TypeScript Static Methods</strong></h3><p>When I asked Claude to set up the API services, it automatically chose to use static methods. I didn’t even know what static methods were at the time.</p><p><strong>What Claude Built</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*rInt2kdpcTIO1zlnD4uVRA.png" /></figure><p>Claude explained that API services don’t hold any data between calls — they’re just organized collections of functions. Using static methods means:</p><ul><li><strong>Simpler usage</strong>: Just call <strong>`YouTubeAPIService.fetchVideoMetadata()`</strong> — no <strong>`new`</strong> keyword needed</li><li><strong>Clearer intent</strong>: Shows the class has no state (no instance variables)</li><li><strong>Better performance</strong>: No memory used creating unnecessary objects</li></ul><p>Think of it like a toolbox — you don’t need to make a copy of the toolbox to use a hammer. You just reach in and use the tool directly.</p><p>This is a common pattern for utility and service classes that I now understand thanks to Claude’s implementation.</p><h3><strong>The AI Advantage</strong></h3><p>Claude automatically included:</p><p>✅ ISO 8601 duration parsing (converts `PT15M33S` → `15:33`)</p><p>✅ Comprehensive error handling with user-friendly messages</p><p>✅ Proper TypeScript typing with `Promise&lt;VideoMetadata&gt;`</p><p>✅ High-quality thumbnail extraction (prioritizes HD thumbnails)</p><p>Instead of reading YouTube API docs for hours, I described what I needed, and Claude implemented it with best practices I learned about along the way.</p><h3><strong>AI Title Generation with Groq</strong></h3><p><strong>My Request:</strong> “I want to use AI to generate creative title variations in different tones — casual, professional, clickbait, and academic. Can you integrate an AI API?”</p><p><strong>What Claude Built:</strong></p><p>Claude chose Groq’s free API (instead of paid options like OpenAI) and set up the entire service:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*sV9W5WEC6SjTy0qjW0Z8NQ.png" /></figure><h3><strong>What I Learned</strong></h3><p><strong>Why Groq?</strong></p><p>I didn’t know about Groq before this. Claude recommended it because:</p><ul><li>Completely FREE (14,400 requests/day)</li><li>No credit card required</li><li>Fast response times</li><li>Uses powerful Llama 3.3 70B model</li></ul><p><strong>Prompt Engineering:</strong> Claude crafted the system prompt to get consistent results. The key parts:</p><ul><li>Clear role definition (“creative content strategist”)</li><li>Specific tone definitions (casual, professional, etc.)</li><li>Strict output format (<strong>`response_format: { type: ‘json_object’ }`</strong>)</li><li>Explicit instruction to return ONLY JSON (prevents extra text)</li></ul><p><strong>Temperature setting (0.8):</strong> Claude explained this controls creativity:</p><ul><li>0.0 = deterministic (same output every time)</li><li>1.0 = highly random</li><li>0.8 = balanced creativity while staying on topic</li></ul><p>I literally just said “I want AI title generation” and Claude handled the API selection, authentication setup, prompt engineering, and response parsing!</p><p><strong>Debugging with AI: Real Problems We Solved Together</strong></p><p>When I first tested the app, the title variations wouldn’t display. I saw an error: “Invalid response format from AI.”</p><h3><strong>What happened..?</strong></h3><p>I showed Claude the error message and said “The titles aren’t showing up.” Claude immediately identified the issue: Groq’s AI was returning JSON in inconsistent formats.</p><h3><strong>Challenge 1: Unpredictable JSON structures</strong></h3><p>Sometimes Groq returned:</p><ul><li><strong>`[{tone: “casual”, title: “…”}]`</strong> (array)</li><li><strong>`{“alternatives”: [{…}]}`</strong> (object with “alternatives” key)</li><li><strong>`{“variations”: [{…}]}`</strong> (object with “variations” key)</li></ul><p><strong>Claude’s Solution</strong></p><p>Without me having to understand the problem deeply, Claude wrote a flexible parser that tries multiple formats:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*SuQdaAVUof8bb8YsdDdvLg.png" /></figure><p>I learned that AI responses aren’t always consistent. Production code needs defensive parsing with fallback strategies.</p><h3><strong>Challenge 2: Getting the AI to return clean JSON</strong></h3><p>After fixing the first issue, we encountered another problem — sometimes Groq would return the JSON wrapped in markdown code blocks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*QnR6-wR4Ctfu2WckF19Y6Q.png" /></figure><p><strong>My Debugging Process</strong></p><p>1. Me: “It’s working sometimes but failing other times. The error says ‘Failed to parse AI response’”</p><p>2. Claude: “Let me add error logging to see the raw response”</p><p>3. Me: “Now I can see it — the response has markdown formatting around the JSON!”</p><p>4. Claude: “Ah! Let me fix that in two ways…”</p><p><strong>What Claude Did</strong></p><p><strong>Fix 1: Stricter API Request:</strong> Claude added `response_format: { type: ‘json_object’ }` to force Groq to return pure JSON:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*SgQo4WvGKCCuak6OSFt8kg.png" /></figure><p><strong>Fix 2: Better Prompt Instructions</strong></p><p>Claude updated the system prompt to explicitly say: “Return ONLY a valid JSON array… Do not include any other text, explanations, or markdown formatting.”</p><h3><strong>What I Learned</strong></h3><p><strong>Working with AI APIs is iterative:</strong> I didn’t need to understand the technical solution.. I just provided feedback (“it’s failing sometimes”) and Claude diagnosed and fixed it.</p><p><strong>Error logging is crucial:</strong> Claude added logging so I could see what was actually coming back from the API. This made debugging collaborative instead of mysterious.</p><p><strong>Defensive programming mindset:</strong> Always expect external APIs (even AI ones!) to behave unpredictably. Build in safeguards and fallbacks.</p><p>This debugging experience showed me the power of AI-assisted development — I described the symptom, Claude identified the root cause and implemented multiple layers of fixes!</p><h3><strong>UI/UX Design</strong></h3><p><strong>My Input:</strong> “I want a modern, clean interface with smooth animations and good user feedback.”</p><p><strong>What Claude Built</strong></p><p>Claude designed and implemented the entire UI/UX without me touching CSS. Here’s what it included automatically:</p><p><strong>Key Features Claude Added:</strong></p><ul><li><strong>Autoplay video embed:</strong> Video plays immediately when loaded (I just said “make the video load below the search bar”)</li><li><strong>Copy-to-clipboard: </strong>One-click copying for each title variation with toast confirmation</li><li><strong>Loading states: </strong>Spinners and status text during API calls</li><li><strong>Toast notifications: </strong>“Title copied to clipboard!” messages</li><li><strong>Responsive design: </strong>Works on desktop, tablet, and mobile (I never mentioned this — Claude just did it)</li><li><strong>Color-coded badges: </strong>Each tone has a distinct visual style (casual=blue, professional=green, etc.)</li></ul><p><strong>Claude’s CSS Magic</strong></p><p>I asked for “nice animations when hovering over titles” and Claude wrote this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*D_5VSuptSVQ3aOT845Kp_A.png" /></figure><p><strong>CSS Transitions:</strong> The <strong>`transition`</strong> property makes changes smooth over 0.2 seconds. Without it, the hover effect would be jarring.</p><p><strong>Transform vs Position:</strong> Claude used <strong>`transform: translateY(-2px)`</strong> instead of changing <strong>`top`</strong> or <strong>`margin`</strong>. Why? Transform is GPU-accelerated and performs better!</p><p><strong>Box Shadow for Depth:</strong> The shadow <strong>`0 5px 15px rgba(0, 0, 0, 0.1)`</strong> creates a subtle “floating” effect:</p><ul><li><strong>`0`</strong> = no horizontal offset</li><li><strong>`5px`</strong> = shadow below the card</li><li><strong>`15px`</strong> = blur radius (makes it soft)</li><li><strong>`rgba(0, 0, 0, 0.1)`</strong> = 10% opacity black</li></ul><p>I described what I wanted in plain English, and Claude turned it into polished, performant CSS with modern best practices I’d never heard of.</p><h3><strong>Environment Variable Management</strong></h3><p><strong>My Question:</strong> “How do I keep my API keys secure while still being able to use them in the app?”</p><p><strong>Claude’s Security Recommendation: </strong>Claude immediately said “Let’s use environment variables with a .env file” and set everything up automatically. I’d never worked with .env files before!</p><p><strong>What Claude Created</strong></p><p><strong>Step 1: Created `.env` file (stays on my computer, never pushed to GitHub)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/265/1*w0v7LVXbZDwQuSOGtzVV2g.png" /></figure><p><strong>Step 2: Built an ApiKeyManager to safely access them</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*KuPRMoQPy30HzvJd5w5aGg.png" /></figure><p><strong>Step 3: Protected the .env file in `.gitignore`</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/115/1*hUsqlQFYZxj0Scbhl-vB5w.png" /></figure><h3><strong>What I Learned</strong></h3><p><strong>Why .env files?</strong></p><ul><li>API keys stay on my local machine only</li><li>Never accidentally committed to GitHub (thanks to .gitignore)</li><li>Each developer can have their own keys</li><li>Easy to change without touching code</li></ul><p><strong>The VITE_ prefix:</strong> Claude explained that Vite only exposes environment variables that start with <strong>`VITE_`</strong> to the browser. This is a security feature — other secrets (like database passwords) won’t leak to frontend code.</p><p><strong>import.meta.env:</strong> This is how Vite provides access to environment variables. It’s different from Node.js’s <strong>`process.env`</strong>. Claude handled this complexity automatically.</p><p><strong>Security without a backend:</strong> Claude’s approach means:</p><ul><li>No server needed (saves money, easier deployment)</li><li>Each user provides their own API keys</li><li>No central database of keys to protect</li><li>Free tier APIs only = no billing concerns</li></ul><p>I literally just asked “how do I keep keys secure?” and Claude implemented a complete, production-ready security solution using industry best practices.</p><h3><strong>Results &amp; Performance</strong></h3><p>The final application delivers excellent performance:</p><p><strong>API Response Time:</strong></p><ul><li>YouTube metadata: ~200–500ms</li><li>AI title generation: ~1–2 seconds</li></ul><p><strong>Total Time to Results:</strong></p><ul><li>2–3 seconds from URL input to full display</li></ul><p><strong>Free Tier Limits:</strong></p><ul><li>YouTube: 10,000 quota units/day (~3,300 video fetches)</li><li>Groq: 14,400 requests/day</li><li>More than enough for personal use</li></ul><h3>Recap</h3><p><strong>Lessons Learned</strong></p><p><strong>1. Always Have Fallback Parsing Strategies</strong></p><p>AI responses can vary in format. Build flexible parsers that handle multiple response structures.</p><p><strong>2. User Experience Matters</strong></p><p>Small touches like loading spinners, toast notifications, and smooth animations make a huge difference in perceived quality.</p><p><strong>3. Environment Variables &gt; Backend for Simple Projects</strong></p><p>For projects where users provide their own API keys, a pure frontend approach is simpler, cheaper, and more privacy-friendly.</p><p><strong>4. Free Tiers Are Powerful</strong></p><p>You can build impressive projects without spending a dime. Groq’s free API is production-ready and fast.</p><p><strong>5. TypeScript Catches Bugs Early</strong></p><p>Strong typing caught numerous potential runtime errors during development. Worth the setup time!</p><p><strong>Future Enhancements</strong></p><p>Here are some features I’m considering:</p><p>1. <strong>A/B Testing Simulator:</strong> Predict which title might perform best based on historical data</p><p>2. <strong>Batch Processing: </strong>Analyze multiple videos at once</p><p>3. <strong>Export to CSV: </strong>Save title variations for later review</p><p>5. <strong>Chrome Extension: </strong>Generate titles directly from YouTube video pages</p><p>6. <strong>Transcript Analysis: </strong>Use video transcripts for more contextual title suggestions</p><h3><strong>Try It Yourself!</strong></h3><p>All you have to do is..</p><p>1. <strong>Clone the repository</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*ptGYThe0e-hNEDZWv7XDyQ.png" /></figure><p>2. <strong>Install dependencies</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/101/1*dIRCWe8oNVg22uW9nqCpwA.png" /></figure><p>3. <strong>Get your free API keys</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*y9F5BSZLU1UjnpCX9g7zhQ.png" /></figure><p>4. <strong>Get your free API keys (remember to add your own API keys)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/1*VrMF1yfIvK5BkqjQYijcsg.png" /></figure><p>5. <strong>Run the dev server</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/101/1*Ar4veYvAAlaJ8gsl_H7P4g.png" /></figure><p>6. <strong>Open your browser</strong> to the URL shown (usually <a href="http://localhost:5173)">http://localhost:5173)</a></p><h3><strong>Security Considerations</strong></h3><p><strong>API Key Safety</strong></p><p>✅ <strong>`.env`</strong> file is in <strong>`.gitignore`</strong> — never committed</p><p>✅ Keys stay local on user’s machine</p><p>✅ No backend = no server-side vulnerabilities</p><p>⚠️ Users should get their own API keys (don’t share yours!)</p><p><strong>Best Practices Followed</strong></p><p>1. Never hardcode API keys in source code</p><p>2. Use environment variables for all secrets</p><p>3. Implement proper error handling (avoid leaking key info in errors)</p><p>4. Clear user warnings in README about API key security</p><h3><strong>Key Takeaways</strong></h3><p>If you’re building a similar project, here’s what I recommend:</p><p>1. <strong>Start with a clear problem: </strong>Don’t build for the sake of building. Solve a real need.</p><p>2. <strong>Choose the right tools: </strong>TypeScript + Vite = fast development with great DX</p><p>3. <strong>Leverage free APIs: </strong>Groq, YouTube, and others offer generous free tiers</p><p>4. <strong>Focus on UX: </strong>Loading states, animations, and clear feedback matter</p><p>5. <strong>Document thoroughly: </strong>Good README and SETUP guides help others use your project</p><p>6. <strong>Make it deployable: </strong>Static sites are easiest to host for free</p><p>7. <strong>Build in public: </strong>Share your process and learnings (like this article!)</p><h3><strong>Conclusion</strong></h3><p>This project taught me a lot about API integration, TypeScript architecture, and building user-focused interfaces.</p><p>It’s completely free to build and run, yet powerful enough to be genuinely useful.</p><p>Whether you’re a content creator looking for better titles or a developer learning about API integration and AI, I hope this project and article provide value.</p><h3><strong>Resources</strong></h3><p><strong>GitHub Repository:</strong> [ytapp-project]</p><p><a href="https://github.com/elnala24/ytapp-project">https://github.com/elnala24/ytapp-project</a></p><p><strong>YouTube Data API Docs:</strong> [developers.google.com/youtube/v3]</p><p>https://developers.google.com/youtube/v3</p><p><strong>Groq API Docs: </strong>[console.groq.com/docs]</p><p>https://console.groq.com/docs</p><p><strong>Vite Documentation</strong> [vitejs.dev](https://vitejs.dev)</p><p><strong>TypeScript Handbook:</strong> [typescriptlang.org/docs]</p><p>https://www.typescriptlang.org/docs/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*Y-Loi4FjLFN5hwhQ" /></figure><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e5837df6423" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — Deploying Portfolio Site with AWS Amplify and CDK]]></title>
            <link>https://medium.com/@elnala24/project-deploying-portfolio-site-with-aws-amplify-and-cdk-5c56d9efbc6e?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c56d9efbc6e</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Thu, 08 Jan 2026 09:30:33 GMT</pubDate>
            <atom:updated>2026-01-08T09:34:08.205Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project — Deploying Portfolio Site with AWS Amplify and CDK</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*MVLCe1GqxRZBokaH" /></figure><p>Instead of using a traditional website builder, I decided to build and deploy my portfolio using AWS Amplify with a full CI/CD pipeline. I believe that having a portfolio website is an opportunity to demonstrate my cloud skills in action.</p><h3>The Goal</h3><p>I wanted to create a portfolio site that:</p><ul><li>Looks clean and professional</li><li>Automatically deploys when I push code to GitHub</li><li>Uses Infrastructure as Code (no manual clicking in the AWS console)</li><li>Demonstrates real cloud engineering skills</li></ul><h3>Tech Stack</h3><p><strong>Frontend:</strong></p><ul><li>Next.js (React framework)</li><li>TypeScript</li><li>Tailwind CSS</li></ul><p><strong>Infrastructure:</strong></p><ul><li>AWS Amplify (hosting + CI/CD)</li><li>AWS CDK (TypeScript)</li><li>AWS Secrets Manager (secure credential storage)</li></ul><h3>Step 1: Project Structure</h3><p>First, I created a main project folder to hold both the frontend and infrastructure code using this command:<br><strong>cd ~/cloud-projects<br>mkdir portfolio-project<br>cd portfolio-project</strong></p><p>This keeps everything organized:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*E3S2NiXRkUEI0J5KP8R0RA.png" /></figure><h3>Step 2: Building the Frontend</h3><p>Inside the project folder, I created the Next.js app with these commands:</p><p><strong>npx create-next-app@latest portfolio — typescript — tailwind<br>cd portfolio</strong></p><p>The site includes:</p><ul><li>A section with my photo and title</li><li>An About Me section</li><li>Project cards showcasing my work</li><li>Links to GitHub, LinkedIn, and email</li></ul><p>To speed up the frontend development, I used <strong>Vercel’s v0 (v0.dev)</strong> to generate the initial layout. I described what I wanted — a clean, modern portfolio with my photo, social links, and project cards — and v0 generated React code that I could customize. This saved hours of styling from scratch.</p><p>For the UI components, I used <strong>shadcn/ui</strong>: a collection of pre-built React components that work great with Tailwind CSS.</p><p>Instead of building buttons, cards, and avatars from scratch, shadcn/ui provides clean, professional-looking components that are easy to customize.</p><p>I installed it with:</p><p><strong>npx shadcn@latest init<br>npx shadcn@latest add avatar card button</strong></p><p>After building and testing the site locally with <strong>npm run dev</strong>, I pushed it to GitHub using:</p><p><strong>git init<br>git add .<br>git commit -m “Initial portfolio site with Next.js”<br>git remote add origin </strong><a href="https://github.com/elnala24/portfolio-site.git"><strong>https://github.com/elnala24/portfolio-site.git</strong></a><strong><br>git branch -M main<br>git push -u origin main</strong></p><h3>Step 3: Setting Up AWS Amplify with CDK</h3><p>Instead of manually configuring Amplify through the AWS Console, I defined everything in code using AWS CDK.</p><p>Back in the main project folder, I created a separate CDK project for the infrastructure with these commands:</p><p><strong>cd ~/cloud-projects/portfolio-project<br>mkdir portfolio-infrastructure<br>cd portfolio-infrastructure<br>cdk init app — language typescript</strong></p><p>Then I installed the Amplify construct using:</p><p><strong>npm install </strong><a href="http://twitter.com/aws"><strong>@aws</strong></a><strong>-cdk/aws-amplify-alpha aws-cdk-lib constructs</strong></p><h3>Step 4: Storing the GitHub Token Securely</h3><p>Amplify needs access to my GitHub repository to pull and build the code. Instead of hardcoding credentials (which you should never do!!), I stored my GitHub personal access token in AWS Secrets Manager using these commands:</p><p><strong>aws secretsmanager create-secret \<br> — name github-token-amplify \<br> — description “GitHub token for Amplify” \<br> — secret-string “[insert token here]”</strong></p><h3>Step 5: Defining the Infrastructure</h3><p>The CDK stack is located at <strong>infrastructure/lib/portfolio-infrastructure-stack.ts</strong>.</p><p>You can view the full code here: <a href="https://github.com/elnala24/portfolio-site/tree/main/infrastructure">github.com/elnala24/portfolio-site/tree/main/infrastructure</a></p><p>The stack does three things:</p><ol><li>Retrieves the GitHub token from Secrets Manager</li><li>Creates an Amplify app connected to my GitHub repo</li><li>Configures the main branch to auto-build on every push</li></ol><h3>Step 6: Deploying</h3><p>With the infrastructure defined, deploying was simple using the commands:</p><p><strong>cdk bootstrap <br>cdk deploy</strong></p><p>After a few minutes, my portfolio was live!</p><h3>The CI/CD Magic</h3><p>My favorite feeling is whenever I push changes to GitHub, Amplify automatically:</p><ol><li>Detects the new commit</li><li>Pulls the latest code</li><li>Runs <strong>npm install</strong> and <strong>npm run build</strong></li><li>Deploys the new version</li></ol><p>No manual intervention needed!! I can update my portfolio by simply pushing code, and it’s live within minutes.</p><h3>Architecture Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*QYpfaGzT9rpnHBfW2m2lAw.png" /></figure><h3>Lessons Learned</h3><p><strong>1. Infrastructure as Code is worth the effort: </strong>setting up CDK took more time than clicking through the console, but now I can recreate this entire setup with a single command. Plus, it’s documented and version-controlled.</p><p><strong>2. Secrets Manager is essential:</strong> never hardcode credentials. Secrets Manager makes it easy to store and retrieve sensitive data securely.</p><p><strong>3. CI/CD changes everything:</strong> not having to manually deploy makes updating my portfolio more time efficient and less room for errors.</p><h3>Cost</h3><p>AWS Amplify has a generous free tier:</p><ul><li>1,000 build minutes per month</li><li>5 GB storage</li><li>15 GB data transfer</li></ul><p>For a simple portfolio site, this means essentially zero cost.</p><h3>The Future</h3><p>Now that my portfolio is live and auto-deploying, I can easily add new projects as I complete them. The site itself becomes a living demonstration of my cloud skills.</p><p><strong>Check out the live site:</strong> <a href="https://main.dw4k8zj5zj0c5.amplifyapp.com/">main.dw4k8zj5zj0c5.amplifyapp.com</a></p><p><strong>GitHub:</strong> <a href="https://github.com/elnala24/portfolio-site">github.com/elnala24/portfolio-site</a></p><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c56d9efbc6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — From Console Chaos to Code]]></title>
            <link>https://medium.com/@elnala24/project-from-console-chaos-to-code-153b91223fdf?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/153b91223fdf</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 12:09:02 GMT</pubDate>
            <atom:updated>2026-01-06T12:09:02.150Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project — From Console Chaos to Code</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*iymmgGRiXo4qIEuz" /></figure><p>How I transformed a 5-year-old manually-built AWS infrastructure into automated, version-controlled code in under an hour!</p><p>Picture this: A healthcare tech company has been clicking through the AWS Console for 5 years, manually creating every VPC, subnet, security group, and database instance. No documentation. No version control. No way to replicate environments. Every change is a prayer that you don’t click the wrong button.</p><p>This was the reality for TechHealth Inc., a startup whose patient portal was built entirely through manual AWS Console operations.</p><p>I recently completed a project migrating their entire infrastructure to Infrastructure as Code using AWS CDK with TypeScript. What used to take hours of error-prone clicking now deploys in 15 minutes with a single command. Here’s how I did it.</p><h3>The Problem: Console-First Infrastructure</h3><p>TechHealth’s AWS environment had grown organically over 5 years with some serious issues:</p><ul><li><strong>No version control</strong> — Who changed what? When? Why? Nobody knew.</li><li><strong>No reproducibility</strong> — Want a staging environment? Good luck remembering all those clicks.</li><li><strong>Outdated documentation</strong> — If it existed at all, it was out of sync with reality.</li><li><strong>Security gaps</strong> — Everything thrown into public subnets because NAT Gateways seemed complicated.</li><li><strong>Slow changes</strong> — Every infrastructure change took hours of manual work.</li></ul><p>The scariest part is if the primary engineer left the company, critical knowledge about the infrastructure would walk out the door with them.</p><h3>The Solution: AWS CDK with TypeScript</h3><p>I chose AWS CDK with TypeScript for this migration because:</p><ol><li><strong>Type safety</strong> catches configuration errors before deployment</li><li><strong>IDE autocomplete</strong> speeds up development and reduces mistakes</li><li><strong>Abstraction</strong> means less boilerplate than raw CloudFormation</li><li><strong>Real programming language</strong> allows loops, conditions, and reusable constructs</li></ol><h3>The Architecture</h3><p>I designed a proper multi-tier architecture with security and high availability in mind:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrZ5g6vDw889KzqXvSQEPA.png" /></figure><p><strong>Key Design Decisions:</strong></p><ul><li><strong>2 Availability Zones</strong> for high availability</li><li><strong>Public subnets</strong> (10.0.1.0/24, 10.0.2.0/24) for the web server</li><li><strong>Private isolated subnets</strong> (10.0.101.0/24, 10.0.102.0/24) for the database</li><li><strong>Multi-AZ RDS</strong> for automatic database failover</li><li><strong>No NAT Gateway</strong> to minimize costs during testing</li></ul><h3>The Implementation</h3><p>Let me walk through the key parts of the CDK stack.</p><h4>VPC Configuration</h4><p>The foundation of everything is the VPC:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*Kqx6b63vkO6SJrD9YDQFMw.png" /></figure><p>Setting <strong>natGateways: 0</strong> saved approximately $32/month. Since the EC2 instance is in a public subnet, it doesn’t need a NAT Gateway to reach the internet.</p><h4>Security Groups</h4><p>Security groups implement the principle of least privilege:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*PqkS6mvgMB_i1CVDhZ3pyg.png" /></figure><p>Line 62–64: notice how the RDS security group references the EC2 security group directly — not an IP address. This means any EC2 instance with that security group can connect, making the configuration more maintainable:</p><ul><li>If you add more EC2 instances with that security group, they automatically get database access</li><li>If EC2 IP addresses change, no updates needed</li><li>If you move EC2 to a different subnet, it still works!</li></ul><h4>EC2 Instance</h4><p>The web server runs on a t2.micro instance with Amazon Linux 2023:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*yLngpQjTqY8VMQHgOrj-GQ.png" /></figure><p>This data script automatically installs the MySQL client when the instance launches, so it’s ready to connect to the database immediately.</p><h4>RDS Database</h4><p>The MySQL database sits in private subnets with Multi-AZ enabled:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*cd-yCeabDvL84zA91paWmg.png" /></figure><p>Line 122: using <strong>Credentials.fromGeneratedSecret(‘admin’)</strong> automatically creates a strong password and stores it in AWS Secrets Manager — no hardcoded credentials in the code.</p><h3>Testing the Deployment</h3><p>After running <strong>cdk deploy</strong>, I verified everything worked:</p><ul><li>Retrieved the database password from Secrets Manager</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*_nOMwoXIYNuw9X54MNMdtQ.png" /></figure><ul><li>Connected to EC2 via SSH</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*oUWajdzKzIPiCQyYt1s2dA.png" /></figure><ul><li>Connected to RDS from EC2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*ycoPydGL5W7nDVl68sPZtw.png" /></figure><ul><li>Tested the database</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*XUB-FkkCMEP4cZN4gmXUJg.png" /></figure><p>The query returned both rows successfully — the EC2 instance in the public subnet could reach the RDS database in the private subnet through the security group rules.</p><h3>Cost Optimization</h3><p>I made several decisions to minimize costs while maintaining functionality:</p><ul><li>No NAT Gateway (saves ~$32/month)</li><li>Free-tier eligible EC2 (t2.micro)</li><li>Smallest RDS instance (db.t3.micro)</li><li>Backups disabled for testing</li><li>Destroyed all resources after testing</li></ul><p><strong>Total project cost: ~$0.20</strong></p><h3>What I Learned</h3><p>This project reinforced several important lessons:</p><p><strong>Network isolation matters.</strong> Putting the database in private subnets with no internet access is a fundamental security practice. The database should only be reachable from the application tier.</p><p><strong>Security groups are powerful.</strong> Referencing security groups instead of IP addresses makes configurations more flexible and easier to maintain.</p><p><strong>CDK abstracts complexity well.</strong> What would be hundreds of lines of CloudFormation YAML becomes readable TypeScript that my IDE can validate.</p><p><strong>Secrets Manager is worth it.</strong> Auto-generated credentials eliminate the temptation to use weak passwords or commit secrets to version control.</p><p><strong>Multi-AZ is easier than you think.</strong> One boolean flag (<strong>multiAz: true</strong>) gives you automatic failover. There&#39;s no excuse not to use it for production databases.</p><h3>Future Improvements</h3><p>For a production deployment, I would add:</p><ul><li>Application Load Balancer with health checks</li><li>Auto Scaling Group for EC2 instances</li><li>NAT Gateway for private subnet internet access</li><li>Automated backups with point-in-time recovery</li><li>CloudWatch alarms for monitoring</li><li>VPC Flow Logs for network traffic analysis</li><li>Separate dev/staging/prod environments</li></ul><h3>Resources</h3><p><strong>GitHub Repository:</strong> <a href="https://github.com/elnala24/project2-techhealth-cdk">github.com/elnala24/project2-techhealth-cdk</a></p><p>Feel free to take a look at my repo which includes the complete CDK stack, architecture diagrams, deployment instructions, and screenshots of the working infrastructure.</p><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=153b91223fdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — IAM Security Using IaC CloudFormation]]></title>
            <link>https://medium.com/@elnala24/project-iam-security-using-iac-cloudformation-546ee94485e0?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/546ee94485e0</guid>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[cloudformation]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 22:54:49 GMT</pubDate>
            <atom:updated>2026-02-21T00:22:41.215Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project — IAM Security Implementation Using IaC: CloudFormation, Terraform, &amp; CDK</h3><p>From shared root credentials to role-based access control with MFA enforcement — a complete IAM transformation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*uLx1AUcYv6WDs4HU.png" /></figure><p>Imagine a startup company named StartupCo that has a 10-person team for a fitness tracking app. All 10 employees — developers, operations, finance, and data analysts — shared the same AWS root account credentials. They passed them around via team chat. Everyone had top-level access to everything. One wrong click could delete the production database.</p><p>Unfortunately, this is more common than you’d think. In the rush to launch, many startups take dangerous security shortcuts. I recently completed a project to transform this security nightmare into a properly architected IAM solution.</p><p>Here’s how I implemented role-based access control using <strong>three Infrastructure as Code tools</strong>: CloudFormation, Terraform, and AWS CDK (Python) — same security outcome, three different approaches.</p><h3>The Problem: Shared Root Credentials</h3><p>If any employee’s laptop was compromised, or if any former employee still had those credentials, the entire AWS account and customer data was at risk. Let me paint the picture of what StartupCo was dealing with:</p><p><strong>The Setup:</strong></p><ul><li>10 employees, 1 AWS account</li><li>Everyone using the root account credentials</li><li>Password shared via Slack and email</li><li>No Multi-Factor Authentication</li><li>No audit trail of who did what</li><li>No separation of duties</li><li>Developers could accidentally delete the production database</li><li>Finance team could spin up expensive EC2 instances</li></ul><p><strong>The Infrastructure:</strong></p><ul><li>EC2 instances running the fitness tracking app</li><li>RDS database storing user workout data</li><li>S3 buckets for profile pictures and assets</li><li>CloudWatch for monitoring</li><li>Everything manually created through the Console</li></ul><p><strong>Why This Was Dangerous:</strong></p><ol><li><strong>No Accountability</strong> — Can’t tell who made changes or deleted resources</li><li><strong>Privilege Escalation</strong> — Everyone has maximum permissions</li><li><strong>Compliance Issues</strong> — Healthcare data (fitness/health) requires audit trails</li><li><strong>Single Point of Failure</strong> — If credentials leak, entire AWS account is compromised</li><li><strong>No Password Rotation</strong> — Same password for 3+ months</li><li><strong>Human Error Risk</strong> — Developers could accidentally terminate production resources</li></ol><h3>The Goal: Proper IAM Architecture</h3><p>I needed to implement security best practices while keeping the team productive:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*dSq0pfpyQkfPS97u3qIZTg.png" /></figure><p><strong>Security Requirements:</strong></p><ul><li>✅ Eliminate shared root account access</li><li>✅ Implement role-based access control (RBAC)</li><li>✅ Enforce Multi-Factor Authentication (MFA)</li><li>✅ Apply least-privilege access principles</li><li>✅ Enable audit logging via CloudTrail</li><li>✅ Secure root account with MFA and restricted access</li></ul><p><strong>Team Structure &amp; Access Needs:</strong></p><ul><li><strong>4 Developers</strong> → EC2 and S3 access for deploying code</li><li><strong>2 Operations</strong> → Full infrastructure access for troubleshooting</li><li><strong>1 Finance Manager</strong> → Cost management and billing access</li><li><strong>3 Data Analysts</strong> → Read-only access to user data</li></ul><p><strong>The Challenge:</strong> Implement proper security WITHOUT blocking people from doing their jobs.</p><h3>The Solution: Role-Based Access Control (RBAC)</h3><p>I designed an IAM structure based on the <strong>principle of least privilege</strong>: give users only the permissions they need to do their jobs, and nothing more.</p><h3>The Four Groups</h3><ul><li>4 Developers with permissions to: EC2, Lambda, S3, CloudWatch, DynamoDB.</li><li>2 Operations with permissions to : Full EC2, VPC, CloudWatch, some IAM</li><li>2 Finance with permissions to: Billing, Cost Explorer, Budgets (read-only)</li><li>2 Data Analysts with permissions to: S3 read-only, Athena, QuickSight</li></ul><p>Each group has its own IAM policy with precisely scoped permissions, plus MFA enforcement.</p><h3>Implementation #1: AWS CloudFormation</h3><p>CloudFormation is AWS’s native IaC tool. It uses YAML or JSON templates to define resources.</p><h4>Setting Up the Groups</h4><p>First, I created the four IAM groups, each linked to their respective policy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*KIK3PF7X6D_Cs5Nq-2SeTA.png" /></figure><h4>The Developers Policy</h4><p>Developers need EC2 access, S3 for application files, and CloudWatch for monitoring — but nothing more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*hUq4T3hSrfM73YyF_7LVUA.png" /></figure><p><strong>Lines 92 &amp; 94:</strong> notice how S3 access is scoped to specific bucket patterns (startupo-app-assets and startupo-dev-*). This means that the Developers can’t access finance data or user analytics.</p><h4>The Finance Policy</h4><p>Finance needs billing access and read-only resource visibility for cost analysis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*gwyNeYczRkYtU2g1PI2XUA.png" /></figure><h4>Creating Users</h4><p>Each user is assigned to their appropriate group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*aTb5l0XWLfQhjGD1N5-Gtw.png" /></figure><h3>MFA Enforcement — The Critical Piece</h3><p>This is where the real security comes in. The MFA policy has three parts:</p><ol><li><strong>Allow users to set up their own MFA</strong></li><li><strong>Allow users to change their password</strong></li><li><strong>Deny everything else if MFA isn’t enabled</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*nxraLQQ3UR-aZLCRDQGpnw.png" /></figure><p>I also attached MFA enforcement directly to each group as an inline policy.</p><h4>Developers MFA</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*WcaCWrtD6Gmg_ngGkl_TSg.png" /></figure><h4>Operations MFA</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*tP9mCx4iKl0wmJYUGuLG5g.png" /></figure><h4>Finance MFA</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*DcNGFoCXT9ZoMDej8SpK8A.png" /></figure><h4>Analysts MFA</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*8g3aUuPDq-WkAzuLo9B2Eg.png" /></figure><h3>Deploying the Stack</h3><p>Once the CloudFormation template is ready, deploy it with these commands:</p><p>aws cloudformation deploy <br>template-file iam-template.yaml <br>stack-name startupco-iam-security <br>capabilities CAPABILITY_NAMED_IAM</p><p><strong>What this command does:</strong></p><ul><li>template-file: points to your YAML file</li><li>stack-name: gives your deployment a name you can reference later</li><li>capabilities CAPABILITY_NAMED_IAM: required because we&#39;re creating IAM resources with custom names</li></ul><p>You can verify the deployment in the AWS Console under <strong>CloudFormation → Stacks</strong>.</p><h3>Testing: Proving It Works</h3><p>After deployment, I tested each group’s permissions to make sure least privilege was working correctly.</p><h4>How I Tested</h4><ol><li><strong>Created console passwords</strong> for each test user in IAM</li><li><strong>Logged into AWS Console</strong> as each user in an incognito window</li><li><strong>Attempted various actions</strong> to verify what was allowed vs. denied</li></ol><h3>Test 1: Developer Access (dev-john-smith)</h3><p>I logged in as the developer and tried accessing different services:</p><p><strong>What worked (as expected):</strong></p><ul><li>✅ Launched an EC2 instance</li><li>✅ Uploaded a file to the <strong>startupo-app-assets</strong> S3 bucket</li><li>✅ Viewed CloudWatch logs</li></ul><p><strong>What was blocked (as expected):</strong></p><ul><li>❌ Viewing the billing dashboard — “You need permissions”</li><li>❌ Accessing the <strong>startupo-user-data</strong> S3 bucket — &quot;Access Denied&quot;</li></ul><p>The developer could do their job, but couldn’t see billing or access data they shouldn’t.</p><h3>Test 2: Finance Access (finance-manager)</h3><p><strong>What worked (as expected):</strong></p><ul><li>✅ Viewed Cost Explorer</li><li>✅ Viewed the billing dashboard</li><li>✅ Described EC2 instances (read-only)</li></ul><p><strong>What was blocked (as expected):</strong></p><ul><li>❌ Launching an EC2 instance — “You are not authorized”</li><li>❌ Uploading to any S3 bucket — “Access Denied”</li></ul><p>Finance could see costs and resources, but couldn’t create or modify anything.</p><h3>Test 3: MFA Enforcement</h3><p>This was the most important test. I logged in as a developer <strong>without</strong> MFA enabled:</p><p><strong>Without MFA:</strong></p><ul><li>✅ Setting up MFA device — worked (this is allowed)</li><li>✅ Changing password — worked (this is allowed)</li><li>❌ Listing EC2 instances — “Access Denied”</li><li>❌ Accessing any other service — “Access Denied”</li></ul><p>Then I enabled MFA and logged in again:</p><p><strong>With MFA enabled:</strong></p><ul><li>✅ Listing EC2 instances — worked</li><li>✅ All permitted actions — worked</li></ul><p><strong>The MFA policy worked exactly as designed</strong> — users can only set up MFA until they actually enable it, then they get full access to their permitted resources.</p><h3>The Results: Before and After</h3><p><strong>Before:</strong></p><ul><li>❌ 10 users with root access</li><li>❌ 0% MFA enabled</li><li>❌ No audit trail</li><li>❌ Everyone had admin permissions</li><li>❌ Credentials shared via Slack</li><li>❌ Not compliance ready</li></ul><p><strong>After:</strong></p><ul><li>✅ 0 users with root access</li><li>✅ 100% MFA enabled</li><li>✅ Complete audit trail with CloudTrail</li><li>✅ Least privilege permissions per group</li><li>✅ No credential sharing</li><li>✅ Compliance ready (SOC2, ISO 27001)</li></ul><h3>Implementation #2: Terraform</h3><p>Same security architecture, different tool. Terraform uses HCL (HashiCorp Configuration Language) and manages state explicitly — meaning it tracks every resource it creates and can detect drift.</p><h4>Key Differences from CloudFormation</h4><p>Before diving into the code, here’s what changes with Terraform:</p><ul><li><strong>Policy definitions use jsonencode() </strong>instead of raw YAML</li><li><strong>Attachments are separate resources</strong> — you create the group, create the policy, then create an <strong>aws_iam_group_policy_attachment</strong> to link them</li><li><strong>Variables replace hardcoded values</strong> — bucket prefixes and account IDs come from <strong>variables.tf</strong></li><li><strong>Password policy is a first-class resource</strong> — CloudFormation doesn’t have a native resource for account password policy, but Terraform does with <strong>aws_iam_account_password_policy</strong></li></ul><h4>Setting Up the Groups</h4><p>In Terraform, each group is its own resource block:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*tNiIy156Q7gIw_RyB0B_Jg.png" /></figure><p>Clean and readable. Each group is independently manageable — you can <strong>terraform destroy -target=aws_iam_group.analysts</strong> without touching other groups.</p><h4>The Developers Policy</h4><p>Here’s where Terraform differs most from CloudFormation. The policy JSON is wrapped in <strong>jsonencode()</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*HkS9owCG-3YX4An5VfpnMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*d09V8kZcF9I6aHZvgYFXhw.png" /></figure><p>line 67–68: notice <strong>${var.app_bucket_prefix}</strong> — instead of hardcoding <strong>startupo-app</strong>, Terraform pulls this from a variables file. This makes the code reusable for any company.</p><h4>Attaching Policies to Groups</h4><p>This is the biggest structural difference. In CloudFormation, you reference policies inside the group definition. In Terraform, attachments are their own resources:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*qzRxBjX4NAjXlGyNKSKB2g.png" /></figure><p>This seems like extra code, but it’s actually more flexible — you can attach and detach policies without modifying the group or policy resources.</p><h4>MFA Enforcement</h4><p>The MFA policy uses <strong>NotAction</strong> (same logic as CloudFormation) but notice Terraform’s <strong>$$ </strong>syntax for escaping AWS policy variables:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*A-lEaaSs3k0iLPcgTb7jvw.png" /></figure><p>lines 289–290: <strong>$${aws:username}</strong> tells Terraform: “don’t interpret this as a Terraform variable — pass it through literally as <strong>${aws:username}</strong> for AWS to resolve at runtime.” Without the double dollar sign, Terraform would try to find a variable called <strong>aws</strong> and fail.</p><h4>Password Policy &amp; Deployment</h4><p>One area where Terraform has a clear advantage: account password policies. Terraform has a native resource for it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*5zdzu67xdr2z3dWSGn2nlg.png" /></figure><p>CloudFormation doesn’t have an equivalent resource — you’d need a custom resource with a Lambda function or set it manually via the CLI. This alone is a reason some teams prefer Terraform for IAM work.</p><p>With everything defined, deploying is three commands:</p><ul><li><strong>cd terraform</strong></li><li><strong>terraform init</strong></li><li><strong>terraform plan</strong></li><li><strong>terraform apply</strong></li></ul><p>The middle step <strong>terraform plan</strong> is worth highlighting. It shows you exactly what will be created, modified, or destroyed before you commit. Think of it as a dry run. CloudFormation has change sets, but <strong>terraform plan</strong> is built into the core workflow and easier to read.</p><h3>Implementation #3: AWS CDK (Python)</h3><p>CDK takes a completely different approach. Instead of writing configuration files (YAML or HCL), you write real Python code that generates CloudFormation under the hood.</p><h4>Why CDK?</h4><ul><li><strong>Real programming constructs</strong> — loops, conditionals, functions, classes</li><li><strong>Type checking</strong> — your IDE catches errors before deployment</li><li><strong>Less boilerplate</strong> — CDK’s L2 constructs handle common patterns automatically</li><li><strong>Same output</strong> — CDK generates CloudFormation templates, so AWS deploys it the same way</li></ul><h4>Setting Up Groups</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*PHjYEWMS9-Gu0kl9RC3pQQ.png" /></figure><p>Already more readable!! The groups are Python objects you can reference directly.. no string lookups or ARN references needed.</p><h4>The Developers Policy — CDK’s Cleaner Syntax</h4><p>This is where CDK really shines. Instead of writing JSON inside YAML (CloudFormation) or JSON inside HCL (Terraform), policies are native Python objects:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*4AZfS-D8SpYTWlz0GwtNqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*DPhj5Fl9Oe-iU5RfpLFxVQ.png" /></figure><p>line 84: <strong>developers_group.add_managed_policy(developers_policy) — </strong>one line to attach. No separate attachment resource like Terraform. CDK handles the CloudFormation wiring for you.</p><h4>MFA Enforcement — The Deny Statement</h4><p>CDK handles the <strong>NotAction</strong> deny pattern with <strong>not_actions</strong> and <strong>conditions</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*b1Gbj1xR6zrEicQ8XLDWpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*CI47S2P_vNuwuI5owSo8YQ.png" /></figure><h4>Attaching MFA to all four groups is clean:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*Ojv3_zJYhuaJIgtcnzzSkQ.png" /></figure><h4>CDK’s Limitation: No Password Policy Construct</h4><p>One thing CDK can’t do natively — there’s no L2 construct for the account password policy. You’d need to either use a CfnResource (L1 construct) or set it via the CLI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*tgGVhY_Rnf4D22q9LM0o6A.png" /></figure><p>Terraform wins here with its native <strong>aws_iam_account_password_policy</strong> resource.</p><h4>Deploying with CDK</h4><ul><li><strong>cd aws-cdk</strong></li><li><strong>python -m venv .venv</strong></li><li><strong>source .venv/bin/activate</strong></li><li><strong>pip install -r requirements.txt</strong></li><li><strong>cdk deploy</strong></li></ul><h3>Comparing All Three Tools</h3><p>After building the same IAM architecture three times, here’s how they stack up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*4O_jN8RaRHh-va0PLc0GDw.png" /></figure><h3>Which Should You Use?</h3><ul><li><strong>CloudFormation</strong> if you’re AWS-only and want the simplest path</li><li><strong>Terraform</strong> if you need multi-cloud support or work with a team that manages state</li><li><strong>CDK</strong> if you’re comfortable with Python/TypeScript and want to use real programming logic (loops, conditionals, helper functions)</li></ul><p>For this project, all three produced the same result — 4 groups, 5 policies, MFA enforcement, and users assigned to the right teams. The choice comes down to your team’s preferences and your infrastructure’s complexity.</p><h3>Lessons Learned</h3><ol><li><strong>Start with least privilege</strong> — It’s easier to add permissions than remove them</li><li><strong>MFA is non-negotiable</strong> — Enforce it from day one</li><li><strong>Use groups, not individual policies</strong> — Much easier to manage at scale</li><li><strong>Scope S3 access to specific buckets</strong> — Don’t give blanket access</li><li><strong>Infrastructure as Code is essential</strong> — Never configure IAM manually in the console</li><li><strong>Multiple IaC tools have tradeoffs</strong> — Terraform handles password policies natively, CDK gives you the cleanest syntax, and CloudFormation is the simplest to start with. Understanding all three makes you versatile.</li></ol><h3>Resources</h3><p>I’ve made the complete CloudFormation template available on my GitHub. Feel free to use it as a starting point for your own IAM security implementation!</p><p><strong>GitHub Repository:</strong> <a href="https://github.com/elnala24/aws-iam-security-project">github.com/elnala24/aws-iam-security-project</a></p><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=546ee94485e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project — Building a VPC with Terraform]]></title>
            <link>https://medium.com/@elnala24/project-building-a-vpc-with-terraform-89ba3135837d?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/89ba3135837d</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 20:40:49 GMT</pubDate>
            <atom:updated>2026-01-03T20:40:49.283Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project — Building a VPC with Terraform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OLbfWezefcjriGoB.jpg" /></figure><p>A typical Terraform Workflow starts with:</p><ul><li>The <a href="http://main.tf/"><strong>main.tf</strong></a> file creation and defining the provider via HCL.</li></ul><p><strong>-HashiCorp Configuration Language:</strong> The language used to write infrastructure code in Terraform.</p><p><strong>-Declarative</strong>: You describe what infrastructure you want (such as a t2.micro EC2 instance) and Terraform figures out how to create it.</p><p><strong>-Human-readable</strong>: It looks like a mix of JSON and YAML, but easier to read and write.</p><p><strong>-Purpose-built</strong>: Designed specifically for IaC — unlike general-purpose languages like Python.</p><ul><li>Writing: building the code for our infrastructure and configurations.</li><li>Terraform init: initialize the configuration that we want to apply within the directory.</li><li>Terraform plan: creates an execution plan to preview our changes.</li><li>Terraform apply: we apply the changes required to reach the desired state of the configuration. With Terraform we declare what we want our infrastructure to be aka the desired state of the infrastructure, and then terraform applies it with the terraform apply command.</li><li>Terraform destroy: destroys the infrastructure that Terraform is managing for us. Anything we know longer need can be used with terraform destroy.</li></ul><h3>Go to VScode and start writing!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*UeMFfO9W4foiIboQ8VRmAg.png" /><figcaption>Building AWS VPC with Terraform</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*0jMLgUhhVVdRZ_2nYNmKEA.png" /></figure><ul><li>Line 12: Define the Resource and name it.</li><li>Line 13: CIDR block for the IP range.</li><li>Line 15–16: Tags for the VPC.</li></ul><h3>Creating Subnet 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*kCAaWkM6rlvTSXW7G97QUw.png" /></figure><ul><li>Line 21: Define the Resource and name it</li><li>Line 22: Reference vpc ID from line 12. This will ensure this subnet knows it belongs with the VPC we just created.</li><li>Line 23: Define CIDR block that refers to line 13.</li><li>Line 24: AZ.</li><li>Line 26–27: Tags.</li></ul><h3>Creating Subnet 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*0XTVemcvnA7JPNgbvbX61A.png" /></figure><ul><li>Very similar to Subnet 1 but slight changes to reference Subnet 2 and make sure you change line 35 to a different availability zone aka “us-west-1b”.</li></ul><h3>Creating Internet Gateway (IGN)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*YbyGFbLvyJKdefUqXeqi3w.png" /></figure><ul><li>Line 43: Define the Resource and name it.</li><li>Line 44: Reference vpc ID from line 12. This will ensure this subnet knows it belongs with the VPC we just created.</li><li>Lines 46–47: Tags.</li></ul><h3>Creating Route Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*Owgp4kSY7z0ecv_Qa5r2RA.png" /></figure><ul><li>Line 52: Define the Resource and name it.</li><li>Line 53: Reference vpc ID from line 12. This will ensure this subnet knows it belongs with the VPC we just created.</li><li>Line 55–58: Reference the route’s cidr block and gateway id.</li><li>Lines 59–60: Tags.</li></ul><h3>Creating Route Table Association Subnet 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*c8pGZiIz-PxHJicYZAUrJA.png" /></figure><ul><li>Line 65: Define the Resource and name it.</li><li>Line 66: Reference subnet id from line 21. This will ensure this route table association knows it belongs with subnet1 we created earlier.</li><li>Line 67: Reference route table we created in line 52.</li></ul><h3>Creating Route Table Association Subnet 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*Iu0myDf8Tctn__bx5dTylA.png" /></figure><ul><li>Similar to Route Table Association Subnet 1.</li></ul><h3>Recap: We wrote code for..</h3><ul><li>AWS VPC</li><li>Subnets 1&amp;2 with different AZs (us-west-1a &amp; 1b)</li><li>IGW: Attached IGW to the VPC.</li><li>Route Table: Which has a route through the IGW for all traffic (i.e. 0.0.0.0/0).</li><li>Route Table Association Subnet 1&amp;2: We associated the Route Tables to our subnets.</li></ul><h3>Terraform Init</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*IfYuHdXPp_riSPRa3nKX7w.png" /></figure><ul><li>We will use the command “terraform init” to initialize our code.</li><li>We had a referencing and syntax hiccups in our code, but after reviewing them.. We ended up fixing it.</li></ul><h3>Terraform Plan</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*1Llu5JTP8hgtvNNAa2S56w.png" /></figure><ul><li>The feedback will give you a preview of what Terraform will create, change, or destroy based on your .tf files.</li></ul><h3>Terraform apply</h3><ul><li>When you use the command terraform apply, it will prompt you to enter a value to say yes to confirm.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*-E6H-9GDsymBd6BCguL0cw.png" /></figure><ul><li>After confirming, we got an error! The problem was that Terraform failed when trying to create subnet1 in Availability Zone us-west-1a, but that zone is not currently available in your AWS account or region.</li><li>InvalidParameterValue: Value (us-west-1a) for parameter availabilityZone is invalid.</li><li>Subnets can currently only be created in the following availability zones: us-west-1b, us-west-1c.</li><li>What we fixed: Change the <strong>availability_zone</strong> value in your <strong>aws_subnet.subnet1</strong> resource from <strong>us-west-1a</strong> to one of the valid zones listed in the error message, like us-west-1b or us-west-1c.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*KXukryoYB8p3CL_ww_3x_w.png" /></figure><ul><li>After saving the fix. Run command again for terraform apply.</li><li>We will get a huge feedback that I have broken into 2 parts:</li></ul><h3>First Half of the Feedback</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*N8fLeoaHKkDVFZ5GqGz5cA.png" /></figure><ul><li>Destroy and then create replacement:</li></ul><p>-It is telling us that Terraform will <strong>replace an existing resource by deleting and re-creating </strong>it.</p><p>-Terraform must <strong>recreate route table association b because its subnet_id is changing</strong> because the new subnet (subnet1) is being added and the association logic needs to match it or something in your config changed (like which subnet it was attached to).</p><p>-Terraform doesn’t support in-place modification of some resources (like associations), so it destroys and recreates them instead.</p><ul><li><strong>aws_route_table_association.a</strong> will be created:</li></ul><p>-This is a new route table association for your new subnet1 so the plan is:</p><ol><li>Create subnet1</li><li>Create a new route table association for subnet1 (a)</li><li>Replace the existing association for subnet2 (b) if it changed</li></ol><h3>Second Half of the Feedback</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*KxyTE7YWzUHmzOh192vuzA.png" /></figure><ul><li>Subnet2 had to be replaced because we changed its availability_zone from us-west-1b to us-west-1c. Because subnets are AZ-specific, changing the AZ requires Terraform to:</li></ul><p>-Destroy the old subnet.</p><p>-Create a new one with the updated AZ.</p><p>-Terraform can’t “move” a subnet to another AZ — it must recreate it.</p><ul><li>aws_route_table_association.b was replaced. This association was tied to the original subnet2, so when that subnet was replaced:</li></ul><p>-The association had to be <strong>destroyed and recreated</strong> to point to the new subnet.</p><ul><li>New subnet1 and its route table association were created:</li></ul><p>-Subnet1 was added (after fixing the AZ issue earlier).<br>-Association.a was created to connect subnet1 to your route table.</p><h3>Summary “Apply complete! Resources: 4 added, 0 changed, 2 destroyed.”</h3><ul><li>4 resources were created.</li><li>2 resources were destroyed and replaced.</li><li>0 resources were updated in-place.</li></ul><p>The infrastructure now includes:</p><ul><li>A working VPC.</li><li>Two subnets in separate AZs (us-west-1b and us-west-1c).</li><li>An Internet Gateway.</li><li>A Route Table.</li><li>Two Route Table Associations.</li></ul><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89ba3135837d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform]]></title>
            <link>https://medium.com/@elnala24/terraform-a8982dc944b4?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8982dc944b4</guid>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 18:41:11 GMT</pubDate>
            <atom:updated>2026-01-02T18:41:11.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2MLfWRcI7f2J8Q8e.png" /></figure><p>Learning the Primary Terraform Commands is crucial because they form the basis of how you interact with Terraform to manage your infrastructure.</p><ul><li>Understanding how they fit into the Terraform Workflow is important.</li><li>Terraform provides a CLI aka command-line interface that allows us to interact with its core functionality.</li><li>These commands are used to manage infrastructure lifecycle from creating/updating resources to destroying them when no longer needed.</li></ul><h3>Primary Terraform Commands</h3><p><strong>Terraform init: </strong>initializes a new or existing Terraform Configuration.</p><ul><li>Downloads the necessary Provider Plugins.</li><li>Sets up the backend for storing State Files.</li></ul><p>You should run Terraform init after creating a New Configuration or when you’ve added a New Provider to an existing Configuration</p><p><strong>Terraform plan:</strong> Creates an Execution Plan and it compares the Current State of your infrastructure with the Desired State defined in your configuration files and determines what actions need to be taken to achieve that Desired State.</p><ul><li>The plan output shows you the changes that Terraform will make to your Infrastructure before you apply them.</li></ul><p><strong>Terraform apply:</strong> After reviewing the plan in the previous step, you can use terraform apply to apply the changes to your infrastructure.</p><ul><li>This command executes the Actions proposed in your plan: Creating, Modifying, or Deleting Resources as necessary.</li><li>This is the same as using aws cloudformation deploy command.</li></ul><p><strong>Terraform show:</strong> Displays the Current State of your Infrastructure Resources in a Human-readable Format.</p><ul><li>It’s useful for inspecting your infrastructure’s configuration and understanding the relationship between resources.</li><li>This is the same as using aws cloudformation describe command.</li></ul><p><strong>Terraform output:</strong> If you’ve defined Output Values in your configuration, you can use Terraform Output to retrieve the values of those Outputs.</p><ul><li>Useful for retrieving information about your infrastructure such as IP address, Resources IDs, or any other Metadata.</li></ul><p><strong>Terraform destroy:</strong> When you’re ready to tear down your infrastructure, you can use the terraform destroy command to remove all resources managed by your configuration.</p><ul><li>This command will prompt you for confirmation before proceeding with the destruction.</li><li>This is the same as using the aws cloudformation delete stack command.</li></ul><p><strong>Terraform fmt:</strong> Automatically formats your Terraform Configuration Files according to the Canonical Style Conventions.</p><ul><li>Helps maintain consistent formatting across your codebase making it easier to read and collaborate.</li><li>There’s no cloudformation alternative for this command.</li></ul><p><strong>Terraform validate:</strong> Checks the syntax of your Terraform Configuration Files and ensures that they’re properly formatted.</p><ul><li>Useful step to cache any errors/issues before applying changes to your infrastructure.</li></ul><h3>Recap</h3><ul><li>Terraform follows a Consistent Pattern: Plan, Apply, and Observe.</li><li>You use terraform plan to preview changes</li><li>You use terraform apply to execute those changes</li><li>You use terraform show and terraform output to observe the resulting Infrastructure State.</li></ul><h3>How does it really work? 3 Concepts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*CGYBQizmXzTl_l-B3OcIvQ.png" /></figure><p><strong>Terraform Call</strong>: Known as a Terraform CLI which is what you can install and interact with when we run Terraform init, plan, and apply.</p><p><strong>Terraform Providers:</strong> Modules that enable Terraform to communicate with a range of services and resources such as AWS, Azure, GCP, and other database services. Each of these providers is responsible for defining the resources that Terraform can manage within a specific service and translating the Terraform configuration files into API calls that are specific to that service.</p><ul><li>What this means is that if we want to create a EC2, we define it in the configuration file.</li><li>What Terraform does is that it hits the AWS APIs to create our EC2.</li></ul><p><strong>Terraform State File:</strong> This is a key aspect of Terraforms functionality. With CloudFormation, we don’t need to worry about a state file because it manages it automatically.</p><ul><li>It is a JSON file that stores information about the resources that Terraform manages as well as the current state and dependencies of the infrastructure. A State File can be kept locally in our machine running Terraform, or we can store it remotely using a remote backend.</li><li>In this case, we can use S3. It is very important that we look after the state file and maintain it with frequent backups because it contains sensitive information about the infrastructure that Terraform is managing.</li><li>Important because it has everything about our infrastructure: what we deployed and what we used.</li><li>Terraform uses a state file to figure out what changes need to be made to the infrastructure when we apply a new configuration. This makes sure that the resources are not unnecessarily recreated across multiple runs of Terraform.</li><li>What it does is it checks what is the current state in the infrastructure in AWS, what we want to apply, and then it applies what we want to do. It doesn’t redeploy any existing infrastructure, only the necessary changes that we are trying to make.</li></ul><h3>Example</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*C2g8TmgPhHZP7277ItsRMg.png" /></figure><ul><li>If we have subnets already deployed in our infrastructure, and we want to deploy EC2, Terraform reads our configuration file. It goes to the Terraform core via CLI, then checks the Terraform State and says okay, I already have a VPC, but I’m trying to add an EC2. So, then it goes and deploys the EC2.</li><li>It uses the Providers to login and deploys the EC2.</li><li>Terraform Provisioners are a feature that allows Terraform to execute scripts or commands on newly created resources. These scripts can be used for various purposes such as setting and configuring infrastructure, installing software, running tasks, and performing any other actions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*k7r-RJ5Z6DBfFl5A-vH2yQ.png" /></figure><ul><li>Define Phase: Where we define the infrastructure in our configuration file with all the required blocks.</li><li>Init Phase: Initializes Terraform in the working directory with the Terraform init command.</li><li>Plan Phase: Where we review Terraform execution plan to see what changes will be made to the infrastructure. We run Terraform Plan command to show us the actions that Terraform is about to perform when we go and run Terraform Apply.</li><li>Apply Phase: This is where we apply the changes or modify the infrastructure.</li><li>Validate Phase: We can inspect the State of the infrastructure using the Terraform State file.</li></ul><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8982dc944b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intro to IaC & Terraform]]></title>
            <link>https://medium.com/@elnala24/intro-to-iac-terraform-1fb691d985eb?source=rss-ccb0ee0da29d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fb691d985eb</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Alan Le]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 18:39:44 GMT</pubDate>
            <atom:updated>2026-01-02T18:39:44.459Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZXCU6CTsqJ-L1qpB.png" /></figure><ul><li>IaC is a key DevOps practice that involves managing and provisioning infrastructure resources through machine-readable definition files rather than manual configuration or interactive tools such as the AWS console.</li><li>Core principle of IaC is to treat your infrastructure (i.e. networks, virtual machines, databases, load balances) as if it were software code. This approach eliminates manual configuration allowing for infrastructure deployment to be consistent and repeatable.</li></ul><h3><strong>Benefits Adopting IaC Approach</strong></h3><ul><li>Consistency &amp; Accuracy: IaC minimizes human errors compared to manual configuration. IaC configuration scripts ensure the same environment setup is used every time, reducing configuration drift and ensuring consistency across different environments.</li><li>Speed &amp; Simplicity: Infrastructure environments can be rapidly set up and toned down. This rapid provisioning allows for quick testing, development, and deployment cycles enabling faster time to market and agile workflows.</li><li>Version Control: Like software development, infrastructure changes can be versioned and tracked in detail through commits, just like source code. This allows you to audit changes, revert to previous versions, and manage infrastructure updates with the same level of rigor as application code changes.</li></ul><h3><strong>Terraform</strong></h3><ul><li>Terraform is the most popular IaC tool that builds, changes, and version-controls infrastructures safely and efficiently across various cloud providers, on-premise environments, and hybrid setups.</li><li>It uses the declarative configuration language known as HCL to describe the desired infrastructure state.</li></ul><h3><strong>Key Feature of Terraform</strong></h3><ol><li>Declarative Approach: This means that you as an engineer define what the infrastructure should be and Terraform handles the how. Making sure the real world infrastructure matches your configuration.</li><li>Cloud Agnostic: This means you can use Terraform to build in AWS, Acure, and GCP, unlike CloudFormation which only works with AWS.</li><li>CLI Outputs: When we use Terraform commands.</li><li>By adopting Terraform and IaC practices, we can unlock numerous benefits such as consistency &amp; reproducibility, collaboration &amp; version control, automated provisioning, dependency management, cost optimization, and scalability.</li></ol><h3><strong>CloudFormation Vs Terraform</strong></h3><ul><li>CloudFormation is best for AWS environments due to its tight integration and service benefits. It is also optimized for AWS users who want service specific infrastructure as code tooling with native support for all AWS services.</li><li>Terraform offers versatility with multi-cloud support and suitable for a diverse and hybrid cloud infrastructures providing more of a unified approach to infrastructure management across different platforms.</li><li>Even though a lot of companies use Terraform for their platforms, they still only use only 1 cloud provider like AWS. Don’t think that just because they’re using Terraform, they’re using AWS, Azure, and GCP.</li></ul><h3><strong>CloudFormation</strong></h3><ul><li>Native to AWS, so specifically designed for AWS infrastructure.</li><li>Uses declarative syntax in JSON or YAML to describe the desired state of the infrastructure.</li><li>Groups together resources into stacks which makes it easier to manage and orchestrate infrastructure.</li></ul><h3>CloudFormation Advantages</h3><ol><li>AWS Specific: Optimized for AWS services and has a deep integration into AWS services.</li><li>Managed Service: AWS handles the provisioning of dating and rollback of resources for you.</li></ol><h3><strong>CloudFormation Disadvantages</strong></h3><ol><li>AWS Lock In: It only works with AWS that limits use for multi-cloud environments.</li><li>Write a lot of code: YAML files become very long and difficult to maintain. If you remember we had to write 100s of lines of code for a simple networking application.</li></ol><h3><strong>Terraform</strong></h3><ul><li>Uses declarative syntax called HCL which is human readable and easy to understand.</li><li>Supports multi-cloud which means you can manage infrastructures across AWS, Azure, and Google cloud + any other cloud providers.</li><li>The State management in your infrastructure is tracked inside State files with Terraform.</li><li>Has a modular architecture that encourages the use of reusable modules with better organization and management.</li></ul><h3><strong>Terraform Advantages</strong></h3><ul><li>Cloud Agnostic: You can manage resources across multiple cloud platforms which is perfect for hybrid or multi-cloud environments.</li><li>Big Community: Has a very strong community because it’s widely used.</li></ul><h3>Terraform Disadvantages</h3><ul><li>Learning Curve: With Terraform there’s a steep learning curve when it comes to State management.</li><li>State Management: Complex because it requires handling of State files, particularly with team environments.</li><li>Licenses: It has licenses as of Summer 2024, which means it’s no longer open-source at the enterprise level.</li></ul><p>Thank you for your time and please stay tuned for the next post!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fb691d985eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>