<?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 Pasquale Kwan on Medium]]></title>
        <description><![CDATA[Stories by Pasquale Kwan on Medium]]></description>
        <link>https://medium.com/@pasqualekwan?source=rss-dc52bab4550b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HCSGQhJKj9zCNi5Z3HXD6Q.jpeg</url>
            <title>Stories by Pasquale Kwan on Medium</title>
            <link>https://medium.com/@pasqualekwan?source=rss-dc52bab4550b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 01:14:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pasqualekwan/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[Week 11 — Cloud Security Fundamentals]]></title>
            <link>https://medium.com/@pasqualekwan/week-11-cloud-security-fundamentals-af58b0c528e4?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/af58b0c528e4</guid>
            <category><![CDATA[aws-kms]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[defense-in-depth]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 15:35:09 GMT</pubDate>
            <atom:updated>2025-10-29T15:35:09.839Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 11 — Cloud Security Fundamentals</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5MC0f8qQl8XMGpGqv1qTw.jpeg" /></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>This week, we shifted our focus entirely from building to <strong>protecting</strong>. Week 11 marked a critical deep dive into <strong>Cloud Security Fundamentals</strong>. We moved beyond basic configuration to understand risk, control mechanisms, and securing everything we build — making security a <strong>design priority</strong> with services like KMS and S3.</p><h3>Key Concepts Learned This Week</h3><h4>The CIA Triad</h4><ul><li><strong>Confidentiality</strong> — is about keeping our data private.</li><li><strong>Integrity</strong> — is about keeping our data accurate and untampered.</li><li><strong>Availability</strong> — is about ensuring our data is there when needed.</li></ul><h4>Authentication vs. Authorization — A Critical Difference</h4><p>The difference between verifying identity and granting permissions is non-negotiable for cloud security.</p><ul><li><strong>Authentication (AuthN):</strong> Confirms your identity — it proves <em>who</em> is accessing the system (e.g., “I am Pasquale”).</li><li><strong>Authorization (AuthZ):</strong> Determines your access rights — it dictates <em>what</em> actions you can take once you’ve been authenticated (e.g., “Pasquale can read this S3 bucket, but not delete it”).</li></ul><h4><strong>AWS Context</strong></h4><p>We implement these concepts using specific AWS tools and methods:</p><ul><li><strong>Methods of Authentication</strong>: I learned to verify identity using credentials such as User Names/Passwords, Access Keys, and MFA applied to IAM Users and Roles.</li><li><strong>Methods of Authorization</strong>: We define permissions using IAM Policies attached to roles and users. These policies enable advanced methods like Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC).</li></ul><h4><strong>Defense-in-Depth</strong></h4><p>Security is a layered defense: <strong>Authentication</strong> is the initial perimeter check (Who are you?), while <strong>Authorization</strong> is the critical inner defense that ensures the <strong>Principle of Least Privilege</strong> (What can you do?) is maintained, even if the user is legitimate or compromised.</p><h4>Security Controls: Preventative, Detective, and Corrective</h4><p>In the cloud world, security controls are essential measures we put in place to protect our data, systems, and networks. They function as a layered defense, much like the different security systems in a bank.</p><p>We classify these controls into three necessary types:</p><p><strong>1. Preventative Controls (The Vault Door):</strong> Designed to stop bad things from happening in the first place.</p><ul><li><strong>Function:</strong> To prevent unauthorized access or system failure.</li><li><strong>AWS Examples:</strong> Security Groups, NACLs (virtual firewalls), KMS for encryption, and strict IAM Policies.</li></ul><p><strong>2. Detective Controls (The Security Camera):</strong> They are our watchdogs — they won’t stop the incident, but they’ll catch it in the act.</p><ul><li><strong>Function:</strong> To identify anomalous activity as it happens.</li><li><strong>AWS Examples:</strong> CloudWatch Logs, <strong>CloudTrail for API activity</strong>, and VPC Flow Logs for monitoring. Services like AWS Config provide continuous auditing against standards.</li></ul><p><strong>3. Corrective Controls (The Cleanup Crew):</strong> They kick in after something has gone wrong to fix the problem and prevent further damage.</p><ul><li><strong>Function:</strong> To minimize damage and recover the system.</li><li><strong>AWS Examples:</strong> AWS Backup and Recovery Systems, Auto Scaling for self-healing, and automated remediation via AWS Systems Manager.</li></ul><h4><strong>Layered Defense</strong></h4><p>We must think of security in the cloud like a <strong>three-legged stool</strong>. We need all three types of controls — Preventative, Detective, and Corrective — to ensure a stable and secure environment. It is not enough to just try and prevent bad things; we must be able to detect when they happen and have a robust plan for how to fix things when they go wrong.</p><h4>Risk Asessment</h4><p>At its core, a risk assessment follows a simple formula:</p><p><strong><em>Risk = Threat x Vulnerability x Impact</em></strong></p><p>Think about it like assessing the security of your home:</p><ul><li>The <strong>Threat</strong> might be burglars in your neighborhood.</li><li>The <strong>Vulnerability</strong> could be a broken lock on your window.</li><li>The <strong>Impact</strong> would be what you might lose if someone broke in.</li></ul><h4>Risk Assesment Process</h4><ol><li><strong>Identify Assets — </strong>Inventory our cloud environment. Determine critical system, data and resources based on their values.</li><li><strong>Look for Threats/Vulnerabilities:</strong> Determine where the weak spots lie, often utilizing tools like <strong>AWS Security Hub</strong> or <strong>Amazon Inspector</strong>.</li><li><strong>Analyze and Prioritize:</strong> Apply the risk formula to prioritize actions.</li><li><strong>Determine Response (The Four Ts)</strong>: Decide whether to <strong>Accept, Mitigate</strong> (implement a control), <strong>Transfer</strong> (e.g., insurance, managed service), or <strong>Avoid</strong> the risk.</li></ol><h4>Web App Risk Assessments — Real World Example</h4><p>A practical risk assessment to a typical VPC web application:</p><ol><li>Single Availability Zone (AZ)</li><li>Default security group on EC2</li><li>No data-at-rest encryption on RDS</li><li>No DDOS protection.</li></ol><h4>Recomended solutions:</h4><ol><li>Implement multi-AZ setups</li><li>Custom Security Group for EC2 with least privilege permission</li><li>KMS encryption enabled for RDS data at rest</li><li>Add AWS WAF (Web Applicarion Firewalls), AWS Shield for DDOS protection,</li><li>NACL (Network Access Control List) for traffic control</li></ol><h4>Network Security &amp; Segmentation</h4><p>Our VPC (Virtual Private Cloud) is our isolated, private section of the AWS cloud, forming the foundation of our network security strategy.</p><p>Network security relies on dividing the VPC into separate subnets, each with a defined role and security posture:</p><ol><li><strong>Public Subnets</strong>: Resources that requires internet access (e.g., Application Load Balancers (ALBs) and the NAT Gateway.</li><li><strong>Private Subnets</strong>: Secured critical infrastructure (e.g., Application Servers, RDS Database Instances, and internal APIs)</li></ol><h4>Private Subnets are one-way doors:</h4><ul><li><strong>No inbound internet access from the internet</strong>.</li><li>Controlled <strong>Outbound Internet Access</strong> must flow through a NAT Gateway (Network Address Translation).</li><li>Use <strong>NACLs (Network Access Control Lists)</strong> to provide subnet-level packet filtering, allowing us incredibly granular control over network communications. This provides multiple layers of access control.</li></ul><h4>Security Best Practices</h4><p>Some simple but powerful principles:</p><ul><li><strong>AZ Distribution</strong> for High Availability</li><li><strong>Layered Security</strong> — Resource-level (Security Groups), subnet-level (NACLs), and network-level (AWS Network Firewall)</li><li><strong>Monitoring</strong> — VPC Flow Logs, Traffic Analysis and Alerts gives visibility to what is happening in our cloud</li></ul><h4>Data Security — The Locked Safe</h4><h4><strong>Encryption At Rest</strong></h4><ul><li>This is when our data is <strong>sitting still (</strong>S3 bucket and RDS database).</li><li>The principle is like having your valuables locked in a physical safe. Even if someone somehow gets to your data, they cannot read it without the key.</li></ul><h4><strong>Encryption In Transit</strong></h4><ul><li>This is when your data is <strong>moving</strong>, for example, traveling between your application and your database (when you’re writing or reading data).</li><li>Think of this like having an armored vehicle (the encrypted data) moving between banks, protected by <strong>TLS/SSL protocols</strong> ensuring integrity and confidentiality while in motion.</li></ul><h4><strong>Understand Data Classifications</strong>:</h4><ul><li><strong>Public</strong> — e.g., marketing materials</li><li><strong>Internal</strong> — e.g., project plans</li><li><strong>Confidential</strong> — e.g., strategic plans</li><li><strong>Regulated</strong> — e.g., credit card info (PCI), medical records (HIPAA)</li></ul><p>Each one has different security needs — and AWS tools to match.</p><h4>AWS Key Management Service (KMS)</h4><p>Think of it like a super secure key cabinet for all of your digital keys.</p><ul><li><strong>Customer Managed Keys (CMKs)</strong> — Full control. Perfect for regulated workloads</li><li><strong>AWS Managed Keys</strong> — Easier, AWS handles the heavy lifting</li><li><strong>AWS Owned Keys</strong> — Used internally across AWS services</li></ul><h4>Advanced Key Features</h4><ul><li><strong>Symmetric Keys:</strong> Used for encrypting our data (the most common type).</li><li><strong>Asymmetric Keys:</strong> Used when we need to handle encryption/decryption or digital signing operations.</li></ul><h4><strong>Multi-Region Keys</strong>:</h4><ul><li>Allow us to encrypt and decrypt data <strong>consistently across different AWS regions</strong>.</li></ul><h4><strong>Key concepts</strong>:</h4><ul><li><strong>Envelope encryption</strong> — AWS encrypts your data with a unique <strong>Data Key</strong>, then encrypts the Data Key with a <strong>KMS Customer Master Key (CMK)</strong>. This is essential for performance and security.</li><li><strong>Multi-region keys </strong>— Great for global applications</li><li><strong>Key policies + ABAC</strong> — Tight control over who can use what</li></ul><h4>KMS Best Practices</h4><ol><li><strong>For regulated data (e.g., healthcare), always use Customer Managed Keys</strong> to provide the necessary control and audit capability</li><li><strong>Implement the principle of least privilege</strong> in key policies</li><li><strong>Take advantage of ABAC</strong> for scalable access control</li><li><strong>Enable CloudTrail logging</strong> for all KMS actions to track who is performing what action with each key</li><li><strong>Always implement proper key backup procedures</strong> for disaster recovery</li></ol><h4>S3 Bucket Security</h4><p>Imagine we are building a social media platform where users share photos and videos. Public content is fine, but private messages and draft posts must remain confidential. What does S3 provdes for security access?</p><ul><li><strong>Bucket Policies</strong> — Resource-based access (e.g., allow uploads only if encrypted)</li><li><strong>IAM Policies</strong> — Identity-based permissions (e.g., dev team can read but not delete)</li><li><strong>Block Public Access</strong> — Just do it. Always. Unless you <em>really</em> need public access.</li></ul><h4>Critical Security Features</h4><ul><li><strong>MFA Delete</strong> — Extra layer for critical actions like permanent deletes and versioning changes</li><li><strong>Versioning</strong> — Protects against accidental or malicious deletes</li><li><strong>Object Ownership — </strong>Controls who owns the objects in our bucket</li><li><strong>S3 Access Points — </strong>Provide another way to manage access for different applications or teams using the same bucket</li><li><strong>Server Access Logging — </strong>Provides detailed records of all requests made to our bucket; critical for security audits, access pattern analysis, and troubleshooting.</li></ul><h4>S3 Encryption Options</h4><p>three main options for encryption, depending on your control and audit needs:</p><ol><li><strong>SSE-S3 (AWS Managed Keys) — </strong>The default encryption <strong>at rest</strong> provided automatically by AWS (using a key managed by AWS).</li><li><strong>SSE-KMS (KMS Managed Keys) — </strong>Used when we require <strong>additional control and audit capability</strong> over the encryption keys. This is done via the AWS Key Management Service (KMS).</li><li><strong>SSE-C (Customer Provided Keys) — </strong>Used when we need <strong>full key management</strong> by providing your own encryption keys to S3.</li></ol><h4>S3 Security Best Practice</h4><p>Critical best practices for S3 security:</p><h4>Access Control</h4><ol><li>Enable <strong>Block Public Access (BPA)</strong> at the Account Level by default (a free feature)</li><li>Use<strong> Bucket Policies </strong>for broad access controls and <strong>IAM Policies</strong> for fine-grained controls (also a free feature)</li></ol><h4>Data Protection</h4><ol><li>Enable <strong>MFA Delete</strong> for Buckets containing critical data — requires Multi-Factor Authentication for critical operations like changing versioning state or permanently deleting objects</li><li><strong>Implement Versioning </strong>for data protection for multiple copies of our objects. This incurs storage cost as it keeps multiple copies of S3 objects</li><li><strong>Configure Lifecycle policies — </strong>manage these versions and control costs by transitioning or expiring older versions.</li></ol><h4>Logging &amp; Monitoring</h4><ol><li>Enable <strong>Server Access Logging</strong> on all production buckets to log all records of requests (This incurs storage costs for our logs)</li><li>Enable<strong> CloudTrail </strong>for API Activity Logging made to S3. There is a free tier for the first CloudTrail log, but subsequent trails or high volume will incur costs.</li><li><strong>Automated Scanning using Amazon Macie</strong> for sensitive data detection. Macie will incur costs based on data scanned.</li><li><strong>Regular Auditing — </strong>Perform <strong>regular security assessments</strong> and <strong>configuration reviews</strong> to verify permissions and policy compliance. Regularly review access logs and monitor for unusual activities to spot potential issues early.</li></ol><h3>Key Takeaway</h3><p>This week fundamentally shifted my focus: <strong>Security is a design priority, not a feature.</strong> These are the non-negotiable, AWS-specific principles I will carry forward:</p><ol><li><strong>Enforce the Layered Defense Model:</strong> I must ensure every architecture uses <strong>Preventative</strong> controls (like <strong>IAM</strong> and <strong>Security Groups</strong>), <strong>Detective</strong> controls (<strong>CloudTrail</strong> and <strong>VPC Flow Logs</strong>), and <strong>Corrective</strong> controls (<strong>AWS Backup</strong> and <strong>Auto Scaling</strong>) for comprehensive resilience.</li><li><strong>Least Privilege is the Golden Rule via IAM:</strong> I will enforce the separation of <strong>Authentication</strong> (via <strong>IAM Users/Roles</strong> with <strong>MFA</strong>) and <strong>Authorization</strong> (via strict <strong>IAM Policies</strong>). This critical step ensures that every identity can only access the bare minimum resources required.</li><li><strong>Proactive Risk Management:</strong> I will approach all new deployments by quantifying risk: <strong>Risk = Threat x Vulnerability x Impact</strong>. This framework guides the implementation of <strong>Mitigation</strong> strategies, such as using <strong>AWS WAF</strong> or <strong>AWS Shield</strong>, and helps define <strong>Transfer</strong> or <strong>Avoidance</strong> decisions.</li><li><strong>Data Security Starts with Encryption and KMS:</strong> I will automatically assume all data requires protection. This means implementing both <strong>Encryption At Rest</strong> (e.g., on <strong>RDS</strong> and <strong>S3</strong>) and <strong>Encryption In Transit</strong> (using <strong>TLS/SSL</strong>), with <strong>AWS KMS</strong> providing the necessary audit and control over encryption keys.</li><li><strong>Network Segmentation with VPC and NACLs:</strong> I will design network security by isolating resources into dedicated <strong>VPC</strong> subnets (Public vs. Private) and leveraging <strong>NACLs</strong> for critical, stateless packet filtering at the subnet perimeter, controlling all inbound and outbound traffic.</li><li><strong>S3 Security is a Default Setting:</strong> The core S3 safeguards — enabling <strong>Block Public Access (BPA)</strong> at the account level and using <strong>Versioning</strong> with <strong>MFA Delete</strong> for critical assets — are not optional features; they are foundational, free-of-cost security defaults I will always apply.</li></ol><h3>Conclusion &amp; Next Steps</h3><p>This week’s deep dive into Cloud Security Fundamentals has fundamentally changed how I view architecture. It’s clear that true engineering excellence requires me to be just as skilled in defense as I am in deployment. Moving forward, every design will be guided by the CIA Triad and the non-negotiable principle of Least Privilege.</p><p>While there was no Lab this week, the mental exercise of applying risk assessments to every service I’ve learned — from VPCs to S3 — has been the most valuable practical work yet.</p><h3>My Challenge Moving Forward:</h3><ul><li><strong>Audit My Work:</strong> I plan to immediately review my previous project architectures to ensure I applied the new <strong>Preventative, Detective, and Corrective</strong> controls learned this week.</li><li><strong>KMS Adoption:</strong> I’m making <strong>Customer Managed Keys (CMKs)</strong> in <strong>KMS</strong> my standard for any data that falls under the “Confidential” or “Regulated” classification.</li><li><strong>Reinforce the Core:</strong> This security focus perfectly complements the <strong>80/20 Principle</strong> by zeroing in on the 20% of controls (like IAM and S3 policies) that deliver 80% of the overall security value.</li></ul><p>Thank you for following my journey! What is one security best practice you always prioritize in your cloud environments? Let me know in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af58b0c528e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 10 — Automation with TypeScript (Part 2): Building IaC with the AWS CDK]]></title>
            <link>https://medium.com/@pasqualekwan/week-10-automation-with-typescript-part-2-building-iac-with-the-aws-cdk-bf045d94fcc0?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf045d94fcc0</guid>
            <category><![CDATA[aws-cdk]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[iac]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 02:46:31 GMT</pubDate>
            <atom:updated>2025-10-28T20:52:27.320Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 10 — Automation with TypeScript (Part 2): Building IaC with the AWS CDK</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YAX-CgezHwg0d_57zfayPA.jpeg" /><figcaption><strong>The Power of Constructs:</strong> Just as every complex structure is built from simple, reusable Lego bricks, the AWS CDK allows us to define multi-tiered cloud architecture using simple, composable <strong>Constructs</strong> as our building blocks.</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>Following our deep dive into TypeScript fundamentals in Part 1, this post covers the exciting application of that knowledge: mastering <strong>Infrastructure as Code (IaC)</strong> using the <strong>AWS Cloud Development Kit (CDK)</strong>. This week, we didn’t just write code; we defined, deployed, and validated a complete network and compute stack on AWS.</p><h3>Key Concepts Learned This Week</h3><p>We established the essential components, terminology, and command-line workflows of the CDK framework, focusing on the core structure of Infrastructure as Code.</p><h4><strong>What is the AWS CDK?</strong></h4><p>The AWS Cloud Development Kit (CDK) is an open-source framework that lets you define cloud infrastructure using real programming languages (like TypeScript, Python, Java, C#, and Go).</p><p>Unlike static CloudFormation templates (YAML/JSON), the CDK gives you the full power of software development:</p><ul><li>We can use familiar logic like <strong>loops, conditions, and variables</strong>.</li><li>It lets us organize and <strong>reuse infrastructure patterns</strong> into Constructs.</li><li>We can <strong>test and version-control</strong> your infrastructure like standard software.</li></ul><p>Essentially, the CDK offers developer flexibility by compiling our code into reliable CloudFormation templates, giving us the benefit of AWS-native stability.</p><h4><strong>CDK Structure (Stacks and Constructs)</strong></h4><p>We mastered the CDK’s hierarchical structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BXArt-NVoFwxZUutqYB6mg.png" /></figure><ol><li><strong>CDK App (TypeScript):</strong> This is the top-level container for our code.</li><li><strong>CDK Stack extends the </strong><strong>cdk.Stack</strong>class and represents a collection of related AWS resources, mapping directly to one CloudFormation stack for deployment.</li><li>The <strong>CDK toolchain synthesizes</strong> our TypeScript code into an <strong>AWS CloudFormation Template </strong>for<strong> </strong>deployment.</li></ol><h4>CDK Install</h4><p>We covered the essential multi-step process for preparing the development environment, starting from scratch to a ready-to-code project:</p><p><strong>Global Tool Installation:</strong> Before starting a project, we installed the necessary global dependencies using NPM (Node Package Manager). This included the <strong>TypeScript Compiler (</strong><strong>tsc)</strong> and the <strong>AWS CDK Command Line Interface (</strong><strong>aws-cdk)</strong> itself. These tools are the foundation for building and synthesizing the code.</p><pre># Install TypeScript and check version<br>week_10_cdk % npm install -g typescript<br><br>changed 1 package in 369ms<br>week_10_cdk % tsc --version<br>Version 5.9.3<br><br># Install AWS CDK amd check version<br>week_10_cdk % npm install -g aws-cdk<br><br>added 2 packages in 2s<br>week_10_cdk % cdk --version<br>2.1031.0 (build 3d7b09b)</pre><h4><strong>CDK Project Initialization</strong></h4><p>We used the command cdk init app --language typescript to generate the required project structure and boilerplate code. This automatically sets up a new application within a directory, providing the essential configuration files (cdk.json) and source folders.</p><pre>mkdir week_10_cdk &amp;&amp; cd my-iac-project<br>cdk init app — language typescript</pre><p><strong>Project Structure:</strong></p><pre>week_10_cdk/                    &lt;= Project folder &quot;week_10_cdk&quot;<br>├──bin<br>│    └── week_10_cdk.ts         &lt;= CDK App entry point<br>│<br>├──lib<br>│    └── week_10_cdk-stack.ts   &lt;= Our Constructs<br>│<br>├── package.json<br>├── cdk.json</pre><p>The generated structure gives us two main development folders: the <strong>bin</strong> folder (containing the application&#39;s entry point, which loads stacks) and the <strong>lib</strong> folder (containing the stack definition file, where we write all our <strong>Constructs</strong> to define the AWS infrastructure).</p><h4>TypeScript Interface</h4><p>A <strong>TypeScript Interface</strong> is a powerful feature that defines a <strong>contract</strong> for the shape of an object, a class, or a function. It’s one of the core ways TypeScript provides <strong>static type checking</strong>.</p><p>In simple terms, an interface specifies <strong>what properties an object must have</strong> and <strong>what their data types must be</strong>.</p><p><strong>Key Characteristics and Purpose</strong></p><p><strong>Defining Shape (The Contract):</strong> An interface specifies the “look” of an object without implementing it. It dictates the names and types of properties that any object claiming to adhere to that interface must possess.</p><pre>// File: types.ts<br><br>// --- TypeScript Types ---<br><br>// 1. Basic Data Types (Illustrated by S3 Bucket-related properties)<br>let bucketName: string = &#39;my-bucket&#39;;<br>let maxItems: number = 100;<br>let isPublic: boolean = false;<br>let tags: string[] = [&#39;project:cdk&#39;, &#39;env:dev&#39;]; // An array of strings<br><br>// --- TypeScript Interface ---<br>// An interface defines the expected structure of an object.<br>// We import the S3 Encryption type to use it in our contract.<br>import * as s3 from &#39;aws-cdk-lib/aws-s3&#39;;<br><br>/**<br> * Interface defining the properties required to configure a custom S3 Bucket.<br> * This acts as a contract for type-safe resource creation.<br> */<br>export interface MyBucketProps {<br>    bucketName: string;<br>    versioned: boolean;<br>    // Uses a specific CDK enum for type safety on the encryption setting<br>    encryption: s3.BucketEncryption;<br>}<br><br>// Note: In a real CDK project, this interface would typically be placed <br>// in the same file as the Stack or in a common utility folder for sharing.<br></pre><p><strong>Type Checking at Compile Time:</strong> Interfaces help TypeScript catch errors early. If you create an object and try to assign it to the User interface type, TypeScript will immediately flag an error if the object is missing a required property (id or name) or if a property has the wrong data type.</p><p><strong>Readability and Documentation:</strong> They make code easier to understand by providing clear documentation of an object’s expected structure.</p><p><strong>Application in CDK (Infrastructure as Code):</strong> In the AWS CDK, interfaces are crucial for defining <strong>type-safe configuration</strong>. When creating a new resource (like an S3 bucket), an interface is often used to define the required and optional properties (BucketProps). This ensures that developers correctly pass all the necessary configuration settings, catching potential infrastructure errors before deployment.</p><h4>The Three Levels of CDK Constructs</h4><p>A <strong>Construct</strong> is the fundamental building block of the CDK, representing an AWS resource or a group of resources. We learned that Constructs exist at three distinct levels of abstraction, allowing developers to choose the right level of control versus efficiency.</p><p><strong>L1 Constructs (Low-Level):</strong> These are the lowest-level constructs that map <strong>directly</strong> to every resource available in <strong>CloudFormation</strong> (e.g., s3.CfnBucket). They offer the highest degree of <strong>fine-grained control</strong>, but require you to manually configure every parameter, which results in more verbose code.</p><p><strong>L2 Constructs (High-Level):</strong> These are <strong>intent-based</strong> constructs (e.g., s3.Bucket) that are the <strong>recommended default</strong> choice. They encapsulate L1 details, apply <strong>sensible defaults</strong>, and automatically implement AWS best practices (like blocking public access or setting encryption) with minimal lines of code.</p><pre>import * as cdk from &#39;aws-cdk-lib&#39;;<br>import { Construct } from &#39;constructs&#39;;<br>import * as s3 from &#39;aws-cdk-lib/aws-s3&#39;;<br><br>interface MyBucketProps {<br>    bucketName: string;<br>    versioned: boolean;<br>    encryption: s3.BucketEncryption;<br>}<br><br>export class Week10CdkStack extends cdk.Stack {<br>  constructor(scope: Construct, id: string, props?: cdk.StackProps) {<br>    super(scope, id, props);<br><br>    const bucketProps: MyBucketProps = {<br>      bucketName: &#39;My-S3-Bucket-SS-CDK-&#39; + this.account, <br>      versioned: true,<br>      encryption: s3.BucketEncryption.S3_MANAGED, <br>    };<br><br>    new s3.Bucket(this, &#39;MyFirstBucket&#39;, bucketProps);<br>  }<br>}</pre><p><strong>L3 Constructs (Patterns/Multi-Resource):</strong> These are the highest-level constructs, representing complex, <strong>multi-resource architectural patterns</strong> (e.g., a secured web service or a scalable data pipeline). They implement best practice solutions with a single line of code, significantly speeding up development for common organizational patterns.</p><p>The strategy is to <strong>default to L2 Constructs</strong> for simplicity and built-in best practices, falling back to L1 only when absolutely necessary for full manual control, and using L3 when an entire architectural pattern needs to be deployed efficiently.</p><h4>CDK Deployment Steps (Terminal Commands)</h4><p><strong>1. Build Code</strong>: Run the TypeScript compiler to convert the code to JavaScript:</p><p>(Bash) npm run build</p><p><strong>2. Check Credentials</strong>: Ensure your AWS CLI credentials are correctly configured (</p><p>(Bash) aws configure</p><p><strong>3. Bootstrap (If Needed)</strong>: If deploying for the first time in a new region/account, you must run the bootstrap command:</p><p>(Bash) cdk bootstrap</p><p><strong>4. Deploy Stack</strong>: Run the deployment command. The CDK translates the TypeScript code into a CloudFormation template and begins deployment:Bash</p><p>(Bash) cdk deploy</p><ul><li><strong>Process</strong>: Review the list of changes (the CloudFormation changeset) and confirm the deployment by typing yes.</li><li><strong>Result</strong>: The terminal shows CloudFormation logs, and upon completion, displays the stack outputs, including the <strong>VPC ID</strong>.</li></ul><h4>Verification in AWS Console</h4><p><strong>1. VPC Stack Recap</strong>: After deployment, check if AWS resources (e.g., VPC or EC2) have been created by the CDK (via CloudFormation)</p><p><strong>2. Console Check</strong>: Navigate to the <strong>CloudFormation</strong> service (as CDK uses it as the default IaC service). Locate the project stack. Review the <strong>Resources</strong> tab to confirm the existence of the AWS resources. Also verify the resource properties (e.g., CIDR range, pubic/private subnet configuration)</p><h4>Cleanup</h4><p><strong>Resource Deletion</strong>: To avoid incurring costs, run the destroy command from the terminal after verification:</p><p>(Bash) cdk destroy</p><p><strong>Alternative</strong>: The stack can also be deleted directly from the CloudFormation console.</p><h4>Guided CDK Walkthroughs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h9sZnMGh2iDtV4kXv2Uhzg.jpeg" /></figure><p>The core of our study involved a comprehensive demonstration that showed the end-to-end process of defining and managing common AWS infrastructure. We began with foundational components and immediately moved into advanced architectural exercises.</p><p>The initial demonstration covered the end-to-end process of defining and deploying a robust, multi-AZ VPC (Virtual Private Cloud) with segregated public and private subnets, and then provisioning an EC2 instance within that secure network (Private Subnets). This established the basic Infrastructure as Code (IaC) flow.</p><h3>Hands-on Experience &amp; Lab Work</h3><p>Immediately following the demonstrations, our lab work focused on extending our VPC into a truly <strong>resilient, multi-tiered application architecture</strong>. These exercises required independent application of Constructs and configuration properties.</p><h4><strong>1. Multi-AZ Resiliency (EC2 Exercise):</strong></h4><ul><li><strong>Goal:</strong> Ensure high availability for the compute layer by provisioning a <strong>second EC2 instance</strong>.</li><li><strong>Solution: </strong>I duplicated the instance code and, critically, used the availabilityZones property within vpcSubnets to target the second Availability Zone by its index ([props.vpc.availabilityZones[1]]). This guaranteed one instance resided in each private subnet across both AZs, achieving a fault-tolerant setup.</li></ul><h4><strong>2. Provisioning a Persistence Layer (RDS Exercise):</strong></h4><ul><li><strong>Goal:</strong> Provision highly available <strong>RDS (Relational Database Service)</strong> instances, demanding the highest level of network isolation.</li><li><strong>Implementation &amp; Troubleshooting: </strong>I looked up the <a href="https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.DatabaseInstance.html">rds.DatabaseInstance Construct</a>. To ensure the database was isolated, I used the <strong>subnetGroupName</strong> property to force the RDS instance into a dedicated <strong>&quot;Database&quot; subnet group</strong>, separate from the private isolated subnets.</li><li>During setup, I encountered a roadblock with a non-existent MySQL version. I used the <strong>AWS CLI</strong> (aws rds describe-db-engine-versions...) to find the list of valid engine versions, allowing me to successfully implement version <strong>v8.0.43</strong>.</li></ul><h4><strong>3. Advanced Database Configuration (Optional Challenges):</strong></h4><p>I took the opportunity to configure the RDS layer beyond the basic requirements, using the optional challenges to implement best practices for a production-ready database.</p><ol><li><strong>PostgreSQL Implementation:</strong> I successfully provisioned a <strong>PostgreSQL</strong> instance (version 17.6) alongside the initial MySQL setup, demonstrating flexibility in engine selection.</li><li><strong>Custom Parameter Groups:</strong> I defined and applied a <strong>rds.ParameterGroup</strong> to fine-tune the database engine settings. For example, setting log_connections: &#39;1&#39; and restricting max_connections: &#39;100&#39; provides better control and observability.</li><li><strong>High Availability and Backups:</strong> I configured the RDS instance for <strong>High Availability</strong> by enabling multiAz: true, and implemented a clear data recovery strategy by setting <strong>backupRetention</strong> to 7 days with a defined preferred backup window.</li></ol><p>The final code for the RDS Construct incorporated these advanced settings:</p><pre>// rds-stack.ts<br><br>import * as cdk from &#39;aws-cdk-lib&#39;;<br>import { Construct } from &#39;constructs&#39;;<br>import * as ec2 from &#39;aws-cdk-lib/aws-ec2&#39;;<br>import * as rds from &#39;aws-cdk-lib/aws-rds&#39;;<br><br>// Props<br><br>interface RDSStackProps extends cdk.StackProps {<br>    vpc: ec2.Vpc;<br>}<br><br>export class RDSStack extends cdk.Stack {<br>    constructor(scope: Construct, id: string, props: RDSStackProps) {<br>        super(scope, id, props);<br><br>    // 1. Define DB Engine <br>    const DBEngine = rds.DatabaseInstanceEngine.postgres({<br>            version: rds.PostgresEngineVersion.VER_17_6<br>        })<br><br>    // 2. Define custome parameter group<br>    const parameterGroup = new rds.ParameterGroup(this, &#39;CustomParameterGroup&#39;, {<br>        engine: DBEngine,<br>        parameters: {<br>            log_connections: &#39;1&#39;,<br>            max_connections: &#39;100&#39;,<br>            }<br>        })<br>    <br>    // RDS config here<br>    const rdsInstance = new rds.DatabaseInstance(this, &#39;MyRDSInstance&#39;, {<br>        <br>        // 3. Use my VPC and place it in the isolated subnet &#39;Database&#39;<br>        vpc: props.vpc,<br>        vpcSubnets: {<br>                subnetGroupName: &#39;Database&#39;,<br>        },<br>        <br>        // 4. Set up MySQL 8.0 as the database engine<br>        engine: DBEngine,<br><br>        // 5. Use t3.micro for the instance type<br>        instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),<br><br>        // 6. Configure storage settings - Initial 20G and can scale up to 30G<br>        allocatedStorage: 20,<br>        maxAllocatedStorage: 30,<br><br>        // 7. High availability<br>        multiAz: true,        <br>        <br>        // 8. Delete Protection set to OFF<br>        deletionProtection: false,<br><br>        // 9. Add appropriate tags<br>        databaseName: &#39;MyPrivateRDS&#39;,<br><br>        // 10. Configure Backup<br>        backupRetention: cdk.Duration.days(7), // Retain backups for 7 days<br>        preferredBackupWindow: &#39;03:00-04:00&#39;,  // Set backup window to 3 AM - 4 AM UTC        <br>        <br>        // 11. Apply Custom Parameter Group<br>        parameterGroup: parameterGroup<br>    });        <br><br>        // 12. Set removal policy to ensure the DB is destroyed when the stack is deleted.<br>        rdsInstance.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY)<br><br>        cdk.Tags.of(rdsInstance).add(&#39;Name&#39;, &#39;MyPrivateRDS&#39;)<br><br>        new cdk.CfnOutput(this,&#39;RDS-Endpoint&#39;,{<br>        value: rdsInstance.instanceEndpoint.hostname,<br>        description: &#39;My Private RDS Database&#39;,<br>        exportName: &#39;RDSHostname&#39;<br>        }) <br>    }<br>}</pre><p>Deploying the CDK stack:</p><pre>pasqualekwan@Pasquales-Mac-mini vpc-cdk-project % cdk deploy MyRDSStack<br>Including dependency stacks: VpcCdkProjectStack<br><br>✨  Synthesis time: 2.81s<br><br>VpcCdkProjectStack<br>MyRDSStack: start: Building MyRDSStack Template<br>MyRDSStack: success: Built MyRDSStack Template<br>VpcCdkProjectStack: deploying... [1/2]<br><br> ✅  VpcCdkProjectStack (no changes)<br><br>✨  Deployment time: 0.31s<br><br>Outputs:<br>VpcCdkProjectStack.ExportsOutputRefMyVpcDatabaseSubnet1Subnet4D5ADE52DB1B85BA = subnet-0a8d3c2db83440f27<br>VpcCdkProjectStack.ExportsOutputRefMyVpcDatabaseSubnet2Subnet0C9ED35E82D4DF0E = subnet-043f6b520cf2d6625<br>VpcCdkProjectStack.ExportsOutputRefMyVpcF9F0CA6FBC8737E9 = vpc-0226b1ea955917d94<br>VpcCdkProjectStack.ExportsOutputRefMyVpcPrivateSubnet1Subnet5057CF7EBB23EA1E = subnet-03ec3f8e6c3553543<br>VpcCdkProjectStack.ExportsOutputRefMyVpcPrivateSubnet2Subnet0040C983A26C73F6 = subnet-0d234e87708531bd3<br>VpcCdkProjectStack.VpcId = vpc-0226b1ea955917d94<br>Stack ARN:<br>arn:aws:cloudformation:eu-west-2:859551916765:stack/VpcCdkProjectStack/9af6e790-b139-11f0-852a-02215d137973<br><br>✨  Total time: 3.12s<br><br>MyRDSStack: start: Publishing MyRDSStack Template (current_account-current_region-4bc97d99)<br>MyRDSStack: success: Published MyRDSStack Template (current_account-current_region-4bc97d99)<br>MyRDSStack<br>Stack MyRDSStack<br>Security Group Changes<br>┌───┬────────────────────────────────────────┬─────┬────────────┬─────────────────┐<br>│   │ Group                                  │ Dir │ Protocol   │ Peer            │<br>├───┼────────────────────────────────────────┼─────┼────────────┼─────────────────┤<br>│ + │ ${MyRDSInstance/SecurityGroup.GroupId} │ Out │ Everything │ Everyone (IPv4) │<br>└───┴────────────────────────────────────────┴─────┴────────────┴─────────────────┘<br>(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)<br><br><br>&quot;--require-approval&quot; is enabled and stack includes security-sensitive updates: &#39;Do you wish to deploy these changes&#39; (y/n) y<br>MyRDSStack: deploying... [2/2]<br>MyRDSStack: creating CloudFormation changeset...<br><br> ✅  MyRDSStack<br><br>✨  Deployment time: 968.34s<br><br>Outputs:<br>MyRDSStack.RDSEndpoint = myrdsstack-myrdsinstance48fd439c-c9nwozgheeqm.c5as2aaaovm8.eu-west-2.rds.amazonaws.com<br>Stack ARN:<br>arn:aws:cloudformation:eu-west-2:859551916765:stack/MyRDSStack/8e8fc920-b13b-11f0-8273-0a75ed0ee70f<br><br>✨  Total time: 971.14s<br><br>pasqualekwan@Pasquales-Mac-mini vpc-cdk-project % </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HsoLNa2qk121-KVeN2_ikw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRTCAuZopaIr2ZxD5QlZjQ.png" /></figure><h3>Key Takeaway:</h3><p>The most profound lesson this week was understanding the essential trade-off in the AWS CDK: the balance between <strong>high-level abstraction</strong> and <strong>granular architectural control</strong>.</p><ol><li><strong>The Benefit of Abstraction:</strong> We learned that relying on <strong>L2 Constructs</strong> (like s3.Bucket) delivers immense value by automatically applying security best practices and simplifying complex configurations into single lines of code, promoting speed and code cleanliness.</li><li><strong>The Need for Control and the Trade-Off:</strong> However, building our resilient, multi-tiered architecture forced us to seek granular control. To enforce required isolation (e.g., placing RDS in a specific dedicated subnet via <strong>subnetGroupName</strong>) or achieving high availability (e.g., manually targeting the second AZ via <strong>availabilityZones</strong>), we had to bypass some of the CDK&#39;s default &quot;magic.&quot; This granular approach, while necessary to meet precise architectural requirements, carried a cost: it made the code <strong>less generic and reusable</strong> and required us to <strong>manually ensure adherence to best practices</strong>.</li></ol><p><strong>The Conclusion:</strong> Mastering the CDK means knowing <strong>when to trust the abstraction</strong> for efficiency and safety, and <strong>when to dive into lower-level properties</strong> to precisely enforce a specific, non-default architectural mandate. This ability to choose the right level of control is the defining skill of a production-ready Cloud Engineer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf045d94fcc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 10 — Automation with TypeScript (Part 1): JavaScript & TypeScript Fundamentals]]></title>
            <link>https://medium.com/@pasqualekwan/week-10-automation-with-typescript-part-1-javascript-typescript-fundamentals-d70cec4d7323?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d70cec4d7323</guid>
            <category><![CDATA[aws-cdk]]></category>
            <category><![CDATA[cloud-engineering]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 02:44:10 GMT</pubDate>
            <atom:updated>2025-10-27T02:44:10.982Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 10 — Automation with TypeScript (Part 1): JavaScript &amp; TypeScript Fundamentals</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sN9enwcgkJmQZRvooZdsTw.jpeg" /><figcaption>Welcome to the new routine. Week 10 is all about the <strong>Code</strong>!</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>This week marks a major turning point: the transition from general Python scripting to the <strong>TypeScript</strong> programming fundamentals necessary to build <strong>Infrastructure as Code (IaC)</strong> with the <strong>AWS Cloud Development Kit (CDK)</strong>. This first post summarizes the language and logic foundations we built, which will be immediately applied to infrastructure in Part 2.</p><h3>Key Concepts Learned This Week</h3><p>Our focus was mastering the structural and procedural logic required to write reliable IaC, which is built on the JavaScript ecosystem.</p><h4>Programming Transition: JavaScript &amp; TypeScript</h4><p><strong>1. Why JavaScript is Essential:</strong> We learned that <strong>JavaScript</strong> is the foundational language because it runs on Node.js, the environment used by the AWS CDK. <strong>TypeScript</strong> is merely a layer of safety <em>on top of</em> JavaScript, meaning a solid understanding of the underlying JavaScript syntax is mandatory for writing any functional CDK code.</p><p><strong>2. Syntax and Structure:</strong> We defined the core structural differences: Python uses <strong>indentation</strong> for code blocks, while JavaScript/TypeScript uses <strong>curly braces</strong> ({}) to define blocks within functions, loops, and conditional statements. We also noted the use of <strong>semicolons</strong> (;) to optionally terminate statements and <strong>double forward slashes</strong> (//) for comments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gAlKklHoM_4zdwrMWujTDQ.png" /><figcaption>Key differences in Variables of JavaScript (on the left) and Python (on the right)</figcaption></figure><p><strong>3. Variable Scope (</strong><strong>let and </strong><strong>const):</strong> This was a major focus for preventing configuration bugs:</p><ul><li><strong>const</strong>: Used for declaring <strong>immutable constants</strong> (values that cannot be reassigned). This is vital for defining static configuration values like region names or API endpoints.</li><li><strong>let</strong>: Used for variables that can be <strong>reassigned</strong>. It enforces <strong>Block Scope</strong>, ensuring a variable declared inside a block (like an if statement for production settings) does not interfere with a variable of the same name outside that block.</li></ul><pre>// Demonstrating Block Scope using &#39;let&#39;<br>function deployResources(isProduction) {<br>    let region = &#39;eu-west-1&#39;; // Default region<br>    if (isProduction) {<br>        let region = &#39;eu-west-2&#39;; // SEPARATE variable due to &#39;let&#39;<br>        console.log(`Deploying production resources in ${region}`); // Output: eu-west-2<br>    }<br>    console.log(`Setting up monitoring in ${region}`); // Output: eu-west-1 (Unaffected)<br>}</pre><p><strong>4. Data Types:</strong> We reviewed the core types, which are the containers for all configuration values.</p><p>The <strong>Number</strong> type handles both integers and floats, used for defining limits.</p><pre>// ---- Number ----<br>const instanceCount = 5;<br>const cpuUtilization = 75.5;<br>console.log(typeof instanceCount) // Ouputs: number<br>console.log(typeof cpuUtilization) // Ouputs: number</pre><p>The <strong>String</strong> type is essential for all names and ARNs.</p><pre>// ---- String ----<br>const region = &#39;us-west-2&#39;<br>const errorMessage = &quot;Resource not found&quot;;<br>const logEntry = &#39;Deployment failed in ${region}: $(errorMessage)&#39;<br>console.log(typeof region); // Outputs: string</pre><p>The <strong>Boolean</strong>values (true/false) are critical for setting resource properties.</p><pre>// ---- Boolean ----<br>const isProduction = true;<br>const debugMode = false;<br>console.log(typeof isProduction) // Outputs: boolean<br>if (isProduction &amp;&amp; !debugMode) {<br>    console.log(&quot;Running in production mode&quot;);<br>}</pre><p>The<strong> </strong><strong>undefined</strong> is used to check if a value has been set or if an optional parameter was provided. This is important for error checking and ensuring all necessary configurations are loaded before proceeding with any cloud operation.</p><pre>// ---- Undefined ----<br>let configFile;<br>console.log(typeof configFile); //Outputs: undefined<br><br>if (configFile === undefined) {<br>    console.log(&quot;Config file not loadeed&quot;);<br>    // Load config file here<br>}</pre><p>The <strong>null</strong> is often used to represent the absence of a value in database queries or API responses.</p><pre>// ---- Null ----<br>const cacheResult = null;<br>console.log(typeof cacheResult); // Outputs: object (this is a known JavaScript quirk)<br>if (cacheResult === null) {<br>    console.log(&quot;No data in cache, fetching from database&quot;);<br>    // Fetch data from database<br>}</pre><p>We also covered <strong>Object Literals</strong> (key-value pairs) for defining complex configuration structures.</p><pre>// ---- Object Literals ----<br>const ec2Instance = {<br>    instanceID: &#39;i-1234567890abcdef0&#39;,<br>    type: &#39;t2.micro&#39;,<br>    status: &#39;running&#39;,<br>    iaunchTime: new Date(&#39;2023-09-15T10:00:00Z&#39;)<br>};<br>console.log(typeof ec2Instance); // Outputs: object<br>console.log(ec2Instance.type); // Outputs: t2.micro</pre><p>The <strong>Arrays</strong> (ordered lists) is for managing collections (like <strong>Availability Zones</strong>).</p><pre>// ---- Arrays ----<br>const availabilityZones = [&#39;us-west-2a&#39;, &#39;us-west-2b&#39;, &#39;us-west-2c&#39;];<br>console.log(typeof availabilityZones); //Outputs: object<br>console.log(Array.isArray(availabilityZones)); // Outputs: true<br>availabilityZones.forEach(zone =&gt; {<br>    console.log(`Deploying to ${zone}`); // Must use the backquote (`)<br>});</pre><p>5. <strong>Control Flow (Procedural Logic):</strong> We mastered the JavaScript syntax for controlling program execution, which is vital for dynamic infrastructure definitions.</p><ul><li><strong>if / else statements</strong> for decision-making (e.g., checking if cloudProvider === &quot;AWS&quot;).</li></ul><pre>// ---- If-Else ----<br>let cloudProvider = &quot;Azure&quot;;<br>if (cloudProvider === &quot;AWS&quot;) {<br>    console.log(&quot;We&#39;re using Amazon Web Services&quot;);<br>} else {<br>    console.log(&quot;We&#39;re not using AWS&quot;);<br>}</pre><ul><li><strong>For Loops</strong> for <strong>definite iteration</strong> over resource lists (e.g., deploying to regions).</li></ul><pre>// ---- For loop ----<br>let regions = [&quot;us-west-1&quot;, &quot;us-east-1&quot;, &quot;eu-west-1&quot;];<br>for (let i = 0; i &lt; regions.length; i++) {<br>    console.log(&quot;Deploying to region: &quot; + regions[i]);<br>}</pre><ul><li><strong>While Loops</strong> for <strong>indefinite iteration</strong> (e.g., implementing retry or polling logic).</li></ul><pre>// ---- While Loops ----<br>let instanceCount = 0;<br>const targetCount = 5;<br>while (instanceCount &lt; targetCount) {<br>    console.log(&quot;Launching EC2 instance #&quot; + (instanceCount + 1));<br>    instanceCount++;<br>}</pre><p><strong>6. Functions:</strong> Functions are the key to modularity and reusability, defined using the function keyword. We practiced using <strong>parameters</strong> to make functions dynamic, which directly mirrors how we will define configurable <strong>Constructs</strong> in the AWS CDK.</p><pre>// ---- Function ----<br>// Example: Function with parameters for service configuration<br>function configureService(serviceName, tier) {<br>    console.log(&quot;Configuring &quot; + serviceName + &quot; service with tier: &quot; + tier);<br>}<br>configureService(&quot;EC2&quot;, &quot;t2.micro&quot;);<br>configureService(&quot;S3&quot;, &quot;standard&quot;)</pre><pre>Configuring EC2 service with tier: t2.micro<br>Configuring S3 service with tier: standard</pre><h4>Introduction to TypeScript: Static Typing for Cloud Code</h4><p><strong>1. TypeScript as a Superset:</strong> We learned that <strong>TypeScript</strong> is a powerful language that is a <strong>superset of JavaScript</strong>, meaning it adds crucial features without breaking existing JavaScript code.</p><p><strong>2. Static Typing for Reliability:</strong> TypeScript’s core feature is <strong>static typing</strong> (e.g., name: string). This ensures that if we accidentally pass an incorrect data type to a property, the <strong>compiler immediately throws an error</strong> during development. This is vital for IaC because it <strong>catches configuration errors</strong> <em>before</em> the code is ever deployed to AWS.</p><pre>// TypeScript prevents configuration errors before deployment<br>function greet(name: string): void {<br>    console.log(`Hello, ${name}!`);<br>}<br>greet(42); // &lt;-- TypeScript compiler throws an error here!</pre><p><strong>3. Compilation and Execution (Running TypeScript):</strong> TypeScript code cannot be run directly. It must first be <strong>compiled (transpiled)</strong> into standard JavaScript. We covered two ways to run the code:</p><ul><li><strong>Standard Tooling (Two Steps):</strong> First, use the <strong>TypeScript Compiler (</strong><strong>tsc)</strong> to generate a JavaScript file (tsc my-script.ts creates my-script.js), and then execute the resulting file with Node.js (node my-script.js).</li></ul><pre>% npm install -g typescript<br>added 1 package in 825ms<br><br>% which tsc<br>/opt/homebrew/bin/tsc<br><br>% tsc type_scripts.ts <br><br>% node type_scripts.js<br>Hello, Cloud Engineer!</pre><ul><li><strong>Development Alternative (</strong><strong>ts-node):</strong> For a smoother workflow, the <strong>ts-node</strong> utility allows us to execute TypeScript files directly (npx ts-node my-script.ts). This is the <strong>preferred method</strong> for local development and testing, especially when working with the AWS CDK, as it handles the compilation step on-the-fly.</li></ul><p><strong>4. Cloud Engineering Relevance:</strong> This language, with its enhanced tooling support and reliable type system, is the official and preferred foundation for managing the complexity of interconnected AWS systems via the CDK.</p><h3>Next Steps</h3><p>This comprehensive foundational knowledge sets the stage perfectly. In <strong>Part 2 of Week 10</strong>, we will move directly from the language concepts and into the framework, focusing entirely on <strong>AWS CDK Basics</strong>, <strong>Constructs</strong>, and the hands-on process of building and deploying our first full <strong>VPC</strong> and <strong>EC2</strong> infrastructure using TypeScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d70cec4d7323" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 9 — Programming Fundamentals]]></title>
            <link>https://medium.com/@pasqualekwan/week-9-programming-fundamentals-657c542f3ef4?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/657c542f3ef4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 17:59:43 GMT</pubDate>
            <atom:updated>2025-10-25T12:26:09.671Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 9 — Programming Fundamentals</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zzPui7GtZRLPbbX_" /></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>This week, we took a slight detour from core AWS services to dive into a crucial refresher on <strong>Python</strong>, an essential language for cloud automation and scripting. This week’s lessons covered foundational to intermediate Python concepts, preparing us to better manage and interact with AWS resources.</p><h3>Key Concepts Learned This Week</h3><p>This week’s lessons were structured around reinforcing fundamental Python syntax and data structures. The main concepts covered included:</p><p>This week’s lessons were structured around reinforcing fundamental Python syntax and data structures. The main concepts covered, and their practical implications, included:</p><h4>1. Indentation</h4><p>Indentation, using whitespace, typically four spaces, is not optional in Python — it is <strong>mandatory</strong>. It defines the <strong>logical structure and scope</strong> of code blocks (like those inside functions, if statements, or loops). If you indent a line that shouldn&#39;t be indented, or fail to indent one that should be, Python will throw an error.</p><pre>if True:<br>    print(&quot;This line is okay.&quot;)<br>  print(&quot;This line has an extra space.&quot;) # &lt;-- ERROR HERE</pre><pre>File &quot;indentation_error.py&quot;, line 3<br>    print(&quot;This line has an extra space.&quot;) # &lt;-- ERROR HERE<br>IndentationError: unindent does not match any outer indentation level</pre><h4><strong>2. Comments</strong></h4><p>We reviewed how to use <strong>Comments</strong> (the # symbol) to annotate code. This is crucial for improving code <strong>clarity</strong> and <strong>maintainability</strong>, allowing developers to quickly understand the <em>why</em> behind a piece of logic—not just the <em>what</em>. Good comments are essential when writing automation scripts that others (or your future self!) will need to read and modify.</p><p>Python supports two main ways to comment:</p><ul><li><strong>Single-line comments</strong> using the # symbol:</li></ul><pre># This is a single-line comment in Python<br>print(“I am learning python”) # This comment is after a line of code</pre><ul><li><strong>Multi-line strings</strong> (often used as docstrings or multi-line comments) using triple quotes:</li></ul><pre>&quot;&quot;&quot;<br>IaC<br>AWS integration<br>Automation and scripting<br>&quot;&quot;&quot;</pre><h4>3. String</h4><p>We covered <strong>Strings</strong>, which are the fundamental data type for representing text in Python, enclosed in single or double quotes. Strings are essential in cloud scripting for everything from printing user prompts to constructing resource names and log messages.</p><pre># Single quotes<br>single_quoted_string = &#39;This is an EC2&#39;<br><br># Double quotes<br>double_quoted_string = &quot;This is an S3 bucket&quot;<br><br># Triple single quotes for multi-line string<br>triple_single_quoted_string = &#39;&#39;&#39;This is a multi-line<br>string that spans multiple lines<br>using triple single quotes.&#39;&#39;&#39;<br><br>print(single_quoted_string)<br>print(double_quoted_string)<br>print(triple_single_quoted_string)<br><br># Exercise: Create your own strings<br># Create a single quoted string for an AWS region name<br>aws_region = &#39;eu-west-2&#39;<br><br># Create a double quoted string for an ec2 instance type<br>ec2_instance_type = &quot;t3.micro&quot;<br><br># Create a multi line string for a single IAM policy<br>iam_policy = &quot;&quot;&quot;{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;s3:ListBucket&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}&quot;&quot;&quot;<br><br># Print all three strings<br><br>print(aws_region)<br>print(ec2_instance_type)<br>print(iam_policy)</pre><pre>This is an EC2<br>This is an S3 bucket<br>This is a multi-line<br>string that spans multiple lines<br>using triple single quotes.<br>eu-west-2<br>t3.micro<br>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: &quot;s3:ListBucket&quot;,<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}</pre><p>A key operation we focused on was <strong>String Concatenation</strong> (or “concat”), which is the process of joining two or more strings together, typically using the addition operator (+). For example, we might use string concat to build a full S3 bucket name by joining a base name with a dynamic identifier, or to create a personalized log entry like: &quot;Instance Name: &quot; + instance_variable. Mastering this operation is vital for creating dynamic and descriptive output in automation scripts.</p><pre># EXERCISE EC2 STRING CONCATENATION<br><br># Environment name prod, dev, staging<br>environment = &quot;prod&quot;<br><br># application name<br>app_name = &quot;webapp&quot;<br><br># instance number<br>inst_number = &quot;01&quot;<br><br># Concatenate to form EC2 instance name<br>ec2_instance_name = environment + &#39;-&#39; + app_name + &#39;-&#39; + inst_number<br><br># Print the resulting EC2 instance name<br>print(f&quot;EC2 Instance Name: {ec2_instance_name}&quot;)</pre><pre>EC2 Instance Name: prod-webapp-01</pre><h4>4. List</h4><p>A <strong>List</strong> is Python’s primary way to handle an ordered, mutable (changeable) collection of items. In cloud scripting, lists are often used to store collections of AWS resource IDs, tags, or configuration values. We practiced core list manipulation, including adding, removing, and checking for item membership.</p><pre># List of EC2 instance<br>instance_ids = [&quot;i-1234&quot;, &quot;i-5678&quot;, &quot;i-9012&quot;]<br><br># List of IP addresses for a security group<br>ip_addresses = [&quot;10.0.0.1&quot;, &quot;10.0.0.2&quot;, &quot;10.0.0.3&quot;]<br><br># List of availability zones in a region<br>availablility_zones = [&quot;eu-west-1&quot;, &quot;eu-west-2&quot;, &quot;eu-west-3&quot;]<br><br>#Print the lists<br>print(f&quot;EC2 instances to terminate: {instance_ids}&quot;)<br>print(f&quot;EC2 instances to terminate: {ip_addresses}&quot;)<br>print(f&quot;EC2 instances to terminate: {availablility_zones}&quot;)   <br>Availability Zones: [&#39;eu-west-1&#39;, &#39;eu-west-2&#39;, &#39;eu-west-3&#39;]<br>EC2 instances to terminate: [&#39;i-1234&#39;, &#39;i-9012&#39;, &#39;i-5678&#39;]<br>EC2 instances to terminate: [&#39;10.0.0.1&#39;, &#39;10.0.0.2&#39;, &#39;10.0.0.3&#39;, &#39;10.0.0.4&#39;]<br>EC2 instances to terminate: [&#39;eu-west-1&#39;, &#39;eu-west-2&#39;, &#39;eu-west-3&#39;]</pre><p>We focused heavily on the mechanics of accessing and ordering data within a list:</p><ul><li><strong>Slicing and Indexing:</strong> These operations are vital for targeting specific elements. <strong>Indexing</strong> allows you to access individual items by their position, while <strong>Slicing</strong> lets you extract an entire sub-section of the list. We learned how Python supports <strong>negative indexing</strong> (like [-1]) to access items from the end of the list.</li></ul><pre># Slicing a list (getting a sub-section)<br>first_two_zones = availablility_zones[:2]<br>print(f&quot;First two availability zones: {first_two_zones}&quot;)<br><br># Accessing the last item using negative indexing<br>last_zone = availablility_zones[-1]<br>print(f&quot;Last availability zone: {last_zone}&quot;)</pre><pre>First two availability zones: [&#39;eu-west-1&#39;, &#39;eu-west-2&#39;]<br>Last availability zone: eu-west-3</pre><ul><li><strong>Sorting:</strong> This method is crucial for presenting data clearly or processing resources in a systematic order (e.g., alphabetically or numerically). The .sort() method changes the list in place.</li></ul><pre># Sorting a list<br>instance_ids.sort()<br>print(f&quot;Sorted EC2 instances: {instance_ids}&quot;)</pre><pre>Sorted EC2 instances: [&#39;i-1234&#39;, &#39;i-9012&#39;]</pre><ul><li><strong>Length:</strong> We also used the built-in len() function to quickly determine the number of items in a list, which is useful for checking resource counts or loop boundaries.</li></ul><pre># Finding the length of a list<br>number_of_ips = len(ip_addresses)<br>print(f&quot;Number of EC2 instances: {number_of_ips}&quot;)</pre><pre>Number of EC2 instances: 4</pre><p>Mastering these list operations is essential for managing resources efficiently and iteratively across AWS.</p><h4><strong>5. Dictionaries</strong></h4><p>We explored <strong>Dictionaries</strong>, which are a powerful, flexible data structure that stores information in <strong>key-value pairs</strong>. This structure is fundamental for handling configuration data or structured responses from API calls, especially when working with AWS APIs (which return JSON data that translates directly into a Python dictionary).</p><p>We practiced three main operations:</p><ul><li><strong>Accessing Data:</strong> We learned to retrieve values using the key name (e.g., ec2_instance[&quot;InstanceID&quot;]). We also used the .get() method, which is safer as it allows you to specify a <strong>default value</strong> if the key doesn&#39;t exist, preventing a program crash:</li></ul><pre># Dictionaries<br># - Store and retrieve information<br># - Key-value pairs<br><br># EC2<br>ec2_instance = {<br>    &quot;InstanceID&quot;: &quot;i-1234567890abcdef0&quot;,<br>    &quot;instance_type&quot;: &quot;t2.micro&quot;,<br>    &quot;State&quot;: &quot;running&quot;,<br>    #&quot;PublicIpAddress&quot;: &quot;203.0.111.2&quot;,<br>}<br><br>instance_type = ec2_instance[&quot;InstanceID&quot;]<br>print(f&quot;This is a {instance_type} instacnce.&quot;)<br><br>public_ip = ec2_instance.get(&quot;PublicIpAddress&quot;, &quot;No Public IP address is here&quot;)<br>print(f&quot;the instance Public IP Address is: {public_ip}&quot;)</pre><pre>This is a i-1234567890abcdef0 instacnce.<br>the instance Public IP Address is: No Public IP address is here</pre><ul><li><strong>Removing Data:</strong> We practiced two methods for removal: the .pop() method, which removes a key and <strong>returns its value</strong> (useful if you need to use the removed value), and the del keyword, which permanently removes the key-value pair from the dictionary.</li></ul><pre># Using pop() to remove and retrieve a value<br>rm_instance_type = ec2_instance.pop(&quot;instance_type&quot;)<br>print(f&quot;Removed instance type: {rm_instance_type}&quot;)<br><br># Using Del to simply remove the pair<br>del ec2_instance[&quot;AvailabilityZone&quot;]</pre><pre>Removed instance type: t2.micro<br>{&#39;InstanceID&#39;: &#39;i-1234567890abcdef0&#39;, &#39;State&#39;: &#39;stopped&#39;, &#39;AvailabilityZone&#39;: &#39;eu-west-2&#39;}<br>{&#39;InstanceID&#39;: &#39;i-1234567890abcdef0&#39;, &#39;State&#39;: &#39;stopped&#39;}</pre><h4><strong>6. If/Else (Control Flow)</strong></h4><p>This concept is the cornerstone of <strong>decision-making</strong> in Python. It allows our scripts to execute specific blocks of code based on whether a given condition evaluates to True or False. This is vital in cloud engineering for writing scripts that respond dynamically to different resource states. We covered the use of if for the primary check, elif (else if) for checking alternative conditions, and else for handling all other possibilities.</p><p>For example, when checking the state of an EC2 instance:</p><pre>instance_running = &quot;broken&quot;<br><br>if instance_running == &quot;running&quot;:<br>    print(&quot;Instance is running.&quot;)<br>elif instance_running == &quot;stopped&quot;:<br>    print(&quot;Instance is stopped.&quot;)<br>else:<br>    # Handles &quot;broken,&quot; &quot;pending,&quot; or any other status<br>    print(&quot;The EC2 instance is in an unexpected state.&quot;)</pre><p>We also used simpler if/else checks for boolean values, such as validating S3 security configurations:</p><pre>public_acess_block = False<br><br>if public_acess_block == True:<br>    print(&quot;The S3 bucket is secured.&quot;)<br>else:<br>    print(&quot;The S3 bucket is not secured.&quot;)</pre><p>Mastering control flow is essential for building reliable, condition-aware automation scripts.</p><h4><strong>7. For Loops</strong></h4><p>The <strong>For Loop</strong> is Python’s mechanism for <strong>definite iteration</strong>. It is used to execute a block of code repeatedly for <em>every item</em> in a sequence (like a list, a string, or a range of numbers). In cloud engineering, the For Loop is arguably the most common tool for automation, allowing us to process many resources with minimal code. We focused on tasks like iterating over a list of EC2 instance IDs or S3 bucket names to perform an action on each one.</p><p>Here is how we automate checking the status of multiple instances:</p><pre>instance_ids = [&quot;i-1234567890abcdef0&quot;, &quot;i-0abcdef1234567890&quot;, &quot;i-0987654321fedcba0&quot;]<br><br>for instance_id in instance_ids:<br>    print(f&quot;Checking status of instance {instance_id}...&quot;)<br>    # Code to check instance status <br>    print(f&quot;Instance {instance_id} status check complete.&quot;)<br><br>print (&quot;All instance statuses have been checked.&quot;)</pre><pre>Checking status of instance i-1234567890abcdef0...<br>Instance i-1234567890abcdef0 status check complete.<br>Checking status of instance i-0abcdef1234567890...<br>Instance i-0abcdef1234567890 status check complete.<br>Checking status of instance i-0987654321fedcba0...<br>Instance i-0987654321fedcba0 status check complete.<br>All instance statuses have been checked.</pre><p>This ensures the same check is performed reliably and efficiently for every item in the list, making it foundational for scalable scripting.</p><h4>8. While Loops: Indefinite Iteration</h4><p>The <strong>While Loop</strong> is used for <strong>indefinite iteration</strong>. Unlike the For Loop, which runs a set number of times, the While Loop will repeat a block of code <em>as long as</em> a specified boolean condition remains True. This is incredibly useful in cloud automation when we need to poll the status of a resource, waiting for it to reach a desired state (like an EC2 instance moving from &#39;pending&#39; to &#39;running&#39;). Since we don&#39;t know exactly how long the process will take, the loop runs until the condition is met or a safety limit is reached.</p><p>Our example simulates polling an EC2 instance status:</p><pre># The loop will continue as long as the instance is NOT &#39;running&#39; AND<br># the attempts are less than 10.<br>while instance_state != &quot;running&quot; and attempts &lt; 10:<br>    print(f&quot;Attempt {attempts + 1}: Instance state is {instance_state}&quot;)<br>    instance_state = simulate_instance_state()<br>    attempts += 1<br>    time.sleep(1) # Simulates waiting before the next check</pre><pre>Attempt 1: Instance state is pending<br>Instance is now running.</pre><p>By including a counter (attempts &lt; 10), we ensure the loop doesn&#39;t run forever, demonstrating the need for <strong>fail-safes</strong> when using indefinite loops in production scripts.</p><h4>9. Functions: Reusable Code Blocks</h4><p>We concluded our refresher with an introduction to <strong>Functions</strong>, the core mechanism for creating <strong>reusable, modular code</strong>. A function is a named block of code that performs a specific task. By defining logic within a function, we can execute that entire sequence of steps simply by calling the function’s name, avoiding repetition and dramatically improving code organization. This is crucial for cloud automation, where the same operation (like creating a resource or sending a notification) needs to be performed multiple times.</p><p>Our example demonstrates how a function can automate the generation of a unique S3 bucket name, ensuring it adheres to naming conventions and includes a unique suffix:</p><pre>import random<br><br>def generate_bucket_name(project_name):<br>    # Generates a random number for uniqueness<br>    random_suffix = random.randint(1000, 9999) <br>    # Uses an f-string to combine the project name and suffix<br>    bucket_name = f&quot;{project_name}-bucket-{random_suffix}&quot;<br>    return bucket_name<br><br>new_bucket = generate_bucket_name(&quot;pasquale-kwan-project&quot;)<br>print(new_bucket)</pre><pre>pasquale-kwan-project-bucket-9866</pre><p>Functions are essential for writing scalable, maintainable scripts and are the building blocks for interacting with AWS services via dedicated SDKs.</p><h3>Hands-on Experience &amp; Lab Work</h3><p>The most valuable part of this refresher was applying the Python fundamentals directly in a cloud context. The lab work bridged the gap between basic Python syntax and practical <strong>AWS</strong> automation.</p><p><strong>AWS Integration with Basics:</strong> We used the foundational elements — like variables, conditional logic, and printing — to set up a basic environment that would interact with AWS.</p><p>Developed a python function to create a unique bucket name, and then use it to create a S3 bucket.</p><pre>import random<br><br>def generate_bucket_name(project_name):<br>    random_suffix = random.randint(1000, 9999)<br>    bucket_name = f&quot;{project_name}-bucket-{random_suffix}&quot;<br>    return bucket_name<br><br>new_bucket = generate_bucket_name(&quot;pasquale-kwan-project&quot;)<br>#print(f&quot;Created new S3 bucket: {new_bucket}&quot;)<br>print(new_bucket)</pre><pre>pasqualekwan@Pasquales-Mac-mini python-learning % aws s3 mb s3://$(python3 functions.py)<br>make_bucket: pasquale-kwan-project-bucket-5388</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wudmu7agAyiI3XkrLQZIVw.png" /></figure><h3>Takeaway</h3><p>This Python refresher was a timely and highly relevant exercise. While I was familiar with many of the concepts, applying them immediately to <strong>AWS resources</strong> like EC2 and S3 shifted the focus from theoretical learning to <strong>practical, automated cloud management</strong>.</p><p>The key takeaway is that proficiency in Python is <strong>non-negotiable</strong> for a Cloud Engineer. Functions and loops are the engine for powerful scripting, helping to manage infrastructure at scale. This week has solidly prepared me to tackle the next phase of the Academy. I feel much more confident moving forward with future AWS automation tasks and am ready to integrate these foundational scripting skills with the more complex services and concepts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=657c542f3ef4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 8 — CI/CD]]></title>
            <link>https://medium.com/@pasqualekwan/week-8-ci-cd-794e4da09d50?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/794e4da09d50</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[pull-request]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Mon, 20 Oct 2025 22:45:37 GMT</pubDate>
            <atom:updated>2025-10-22T10:23:40.870Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 8 — CI/CD</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OihMD03Z7uANv492lc-2-w.jpeg" /><figcaption>“Debugging is like being the detective in a crime movie where you are also the murderer.”</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>This week, Week 8, was a deep dive into the practical and advanced side of <strong>CI/CD</strong>, specifically focusing on how to leverage <strong>GitHub Actions</strong> for complex automation and infrastructure testing. I moved beyond simple “push-to-deploy” models and started building <strong>Pull Request-based workflows</strong> — a critical skill for any professional engineering team.</p><h3>Key Concepts Learned This Week</h3><p>This week’s focus was on establishing robust, automated pipelines by mastering foundational DevOps concepts and advanced GitHub Actions features.</p><h4>DevOps and CI/CD Fundamentals</h4><p><strong>Before DevOps:</strong> Explored the challenges and limitations of traditional, siloed development models (long cycles, manual deployments, high failure rates).</p><p><strong>DevOps Revolution:</strong> Understood how DevOps principles (Culture, Automation, Lean, Measurement, Sharing) enable faster, more reliable software delivery through collaboration and automation.</p><p><strong>CI/CD Fundamentals:</strong> Solidified the difference between.</p><ul><li><strong>Continuous Integration (CI):</strong> Merging code frequently, running automated builds and tests (e.g., unit tests).</li><li><strong>Continuous Deployment (CD):</strong> Automatically releasing code that passes all tests directly to production.</li><li><strong>Continuous Delivery:</strong> Readying code for quick deployment to production, but often requiring a manual approval gate.</li></ul><h4>GitHub Actions and the DevOps Lifecycle</h4><p><strong>Central Automation Platform:</strong> GitHub Actions is a full automation platform, not just a CI/CD tool, that integrates directly into your GitHub repositories to implement DevOps practices.</p><p><strong>Role in DevOps Stages:</strong> It touches and works with all six phases of the DevOps lifecycle:</p><ul><li><strong>Plan:</strong> Integrates with project management tools to automate tasks and update boards.</li><li><strong>Code:</strong> Automates code quality checks, including linters, auto-formatting, and code reviews.</li><li><strong>Build:</strong> Compiles code, runs unit tests, and creates build artifacts to catch issues early.</li><li><strong>Test:</strong> Runs automated unit, integration, and end-to-end tests on every push/PR.</li><li><strong>Deploy:</strong> Handles consistent and reliable automated deployment to staging and production environments.</li><li><strong>Operate:</strong> Assists with infrastructure management by integrating with IaC tools like Terraform.</li><li><strong>Monitor:</strong> Responds to alerts, automatically creates issues for incidents, or triggers rollbacks.</li></ul><p><strong>Key Benefit:</strong> Its deep integration across the entire DevOps lifecycle is crucial for achieving the speed, reliability, and efficiency that DevOps promises.</p><h4>GitHub Actions Key Features</h4><p><strong>Integrated CI/CD:</strong> Provides built-in Continuous Integration (CI) and Continuous Delivery (CD) capabilities, allowing users to create complex pipelines for build, test, and deployment directly within their GitHub repository.</p><p><strong>Workflow Automation:</strong> Enables the creation of custom workflows that can be triggered by a wide variety of GitHub events, such as push events, pull requests, or new issues.</p><p><strong>Multi-Environment Support:</strong> Workflows can run on different operating systems and versions, including Linux, Windows, and macOS, ensuring code compatibility across various platforms.</p><p><strong>Reusable Actions (Modular Approach):</strong> Promotes efficiency and reduces code duplication by allowing users to create custom reusable components or utilize prebuilt actions from the GitHub Marketplace.</p><p><strong>Secure Secrets Management:</strong> Offers a secure way to store and manage sensitive information (like API keys and passwords) by encrypting secrets and only exposing them to selected actions during workflow runs.</p><h4>GitHub Actions Components</h4><p>The main components that make up a GitHub Actions workflow:</p><ol><li><strong>Events (Triggers):</strong> These are the specific activities that initiate the workflow, such as a code <strong>push</strong> to a branch, a new <strong>pull request</strong>, or a <strong>scheduled</strong> time.</li><li><strong>Jobs (Workhorses):</strong> A job is an independent unit of work composed of multiple steps, executed on the same <strong>runner</strong>. Jobs can be configured to run in <strong>parallel</strong> or sequentially.</li><li><strong>Runners (Execution Environments):</strong> These are the virtual machines (like Linux, Windows, or macOS) or containers that provide the computing resources (CPU, memory) necessary to <strong>execute</strong> the jobs.</li><li><strong>Steps (Tasks):</strong> The individual, ordered <strong>tasks</strong> within a job. Each step runs either a <strong>shell script</strong> or an <strong>action</strong> and is where the actual work of the workflow takes place.</li><li><strong>Actions (Building Blocks):</strong> <strong>Reusable</strong> units of code (from GitHub, other engineers, or the Marketplace) used within steps to simplify complex or repetitive tasks.</li></ol><p>The overall process involves an <strong>Event</strong> triggering the workflow, which executes one or more <strong>Jobs</strong> on a <strong>Runner</strong>, with each job containing <strong>Steps</strong> that utilize <strong>Actions</strong> to perform tasks.</p><h4>A Simple Push Event</h4><pre># Workflow identifcation<br>name: My Github Action Workflow<br># 1. Event trigger<br>on: [push]<br># 2. Job<br>jobs:                                                                       <br>  testing_github:<br># 3. Runner<br>    runs-on: ubuntu-latest<br># 4. Step 1 name<br>    steps:<br># 5. Action - run a simple shell command<br>      - name: Hello<br>        run: echo &quot;Hello, Github Actions!&quot;<br># 5. Action - using a context variable<br>      - name: Display repo name<br>        run: echo &quot;This workflow is running on ${{ github.repository }}&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*drJHJZRTfKxYm1hvij8T6w.png" /><figcaption>Viewing the Push event workflow in the GitHub Actions tab.</figcaption></figure><h4>Advanced GitHub Actions Concepts</h4><p><strong>The Pull Request (PR) Event:</strong> Learned to trigger workflows not just on code pushes, but specifically when a Pull Request is opened or updated. This is essential for code review and testing.</p><p><strong>Secure Credential Handling:</strong> Reinforced the critical use of <strong>GitHub Secrets</strong> (secrets.AWS_ACCESS_KEY_ID) to authenticate the pipeline with AWS without exposing credentials in the code.</p><p><strong>Conditional Job Execution (</strong><strong>if statements):</strong> Learned how to control when jobs run based on context, notably using the if: ${{ github.event.pull_request.merged == true }} condition to perform cleanup only after a successful merge.</p><p><strong>Workflow Components in Depth:</strong> Gained a clearer understanding of how <strong>Events</strong>, <strong>Jobs</strong>, <strong>Runners</strong>, and <strong>Steps</strong> are combined to form a complete, multi-stage pipeline.</p><h3>Hands-on Experience &amp; Lab Work</h3><p>The lab work this week involved building two real-world CI/CD pipelines: a simple deployment and an advanced infrastructure testing workflow.</p><h4>Lab 1: Push-to-Deploy for AWS Lambda</h4><ul><li><strong>Goal:</strong> Create a pipeline that automatically updates an AWS Lambda function every time code is pushed to the main branch.</li><li><strong>Summary:</strong> Built a GitHub Actions workflow (lambda-deploy.yml) using the on: push trigger. The pipeline successfully zipped the Lambda code and ran aws lambda update-function-code to deploy changes to AWS.</li></ul><h4>Lab 2: CloudFormation Infrastructure Testing with PRs</h4><ul><li><strong>Goal:</strong> Create a robust pipeline to <strong>validate and deploy a temporary test environment</strong> for infrastructure-as-code (IaC) changes associated with a Pull Request.</li><li><strong>Summary:</strong> Wrote a <strong>CloudFormation template</strong> for an S3 bucket and built a two-job GitHub Actions workflow (cfn-validate-pr.yml) using the on: pull_request trigger, including a conditional cleanup job on merge.</li></ul><h4>Main Points of the Debug Exercise: CI/CD Workflow Debugging</h4><p>This exercise was a valuable lesson in troubleshooting, tracking the process of creating a feature branch, triggering a GitHub Actions workflow with a Pull Request (PR), debugging multiple CloudFormation deployment failures, and successfully merging the corrected code.</p><p><strong>Initial Setup and Branching Issues</strong></p><ul><li><strong>Problem:</strong> Attempting to push a new feature branch (update-cfn) resulted in the error: fatal: The current branch has no upstream branch.</li><li><strong>Fix:</strong> The tracking link was established using git push --set-upstream origin &lt;branch-name&gt;.</li><li><strong>Problem:</strong> Subsequent push failures ([rejected] (non-fast-forward)) indicated the local branch was behind the remote.</li><li><strong>Fix:</strong> The local branch was synchronized using git pull origin &lt;branch-name&gt; before pushing.</li><li><strong>Problem:</strong> Confusing git branch --set-upstream-to by running it while on the wrong branch (main was incorrectly set to track origin/update-cfn).</li><li><strong>Fix:</strong> Corrected tracking for main via git branch --set-upstream-to=origin/main main and then switched to the feature branch.</li></ul><p><strong>GitHub Actions and CloudFormation Deployment Failures</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mcvwtM5WGDu7m7n_eV_asw.png" /></figure><ul><li><strong>Problem:</strong> The first major deployment failure resulted in ROLLBACK_COMPLETE due to a CloudFormation validation error: extraneous key {key} is not permitted.</li><li><strong>Fix:</strong> The CloudFormation template was corrected to use <strong>Key (capital K)</strong> instead of key (lowercase k) for the S3 tag property, as CloudFormation is case-sensitive.</li><li><strong>Problem:</strong> The second deployment attempt failed with an AlreadyExistsException: Stack [pr-test-stack-3] already exists.</li><li><strong>Fix:</strong> The failed stack (pr-test-stack-3) was <strong>manually deleted</strong> from the AWS CloudFormation Console.</li><li><strong>Problem:</strong> The S3 bucket name was still vulnerable to global name collisions.</li><li><strong>Fix:</strong> The S3 bucket name in the template was updated to include a unique prefix: BucketName: !Sub &#39;pkwan-${AWS::StackName}-${Environment}-bucket&#39;.</li></ul><p><strong>3. Final Success and Cleanup</strong></p><ul><li><strong>Result:</strong> The final deployment (incorporating the Key casing fix and the pkwan- prefix) was successful, resulting in the stack state CREATE_COMPLETE.</li><li><strong>Cleanup:</strong> The Pull Request was merged, and the feature branch was deleted on GitHub.</li><li><strong>Final Git Synchronization:</strong> Local branches were synchronized and cleaned up by switching to main, running git pull, and running git fetch --prune.</li></ul><h3>Takeaway</h3><p>The biggest takeaway from Week 8 is the shift from automation being <em>possible</em> to automation being <strong>structured and safe</strong>.</p><p>Moving to <strong>Pull Request-triggered workflows</strong> and integrating <strong>automated cleanup</strong> for temporary test resources is the standard for professional DevOps. This pattern allows us to validate infrastructure changes in a live environment <em>before</em> they touch production (or even the main branch), drastically reducing the risk of errors.</p><p>Furthermore, the detailed <strong>debugging exercise</strong> highlighted that real-world problems often involve a mix of git branch management, case sensitivity in IaC (CloudFormation), and managing external cloud resource state (deleting failed stacks). I’m now much more confident in building automated, secure, and resource-efficient deployment systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=794e4da09d50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 7 — Infrastructure as Code with Terraform]]></title>
            <link>https://medium.com/@pasqualekwan/week-7-infrastructure-as-code-with-terraform-185e71be58e7?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/185e71be58e7</guid>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Thu, 16 Oct 2025 18:15:44 GMT</pubDate>
            <atom:updated>2025-10-16T18:15:44.468Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 7 — Infrastructure as Code with Terraform</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFxJzQhuJvSBmQhsbAIheA.jpeg" /><figcaption>“Automation means solving a problem once, then putting the solution on autopilot.” — Michael Hyatt</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>Following our foundational work with CloudFormation last week, the focus for Week 7 shifted to another powerful and essential IaC tool: <strong>Terraform</strong>. This marks a pivotal step in expanding our skills to manage cloud infrastructure in an efficient, repeatable, and potentially multi-cloud way.</p><h3>Key Concepts Learned this Week</h3><p>This week was packed with essential theoretical knowledge, setting the stage for practical application. We covered the foundational principles and tools required to effectively implement IaC.</p><h4><strong>Intro to IaC &amp; Terraform:</strong></h4><p>We established a clear understanding of what IaC is — managing infrastructure (networks, virtual machines, databases) through configuration files rather than manual processes.</p><p><strong>Benefits of Adopting an IaC Approach:</strong></p><ul><li><strong>Consistency and Accuracy:</strong> IaC minimizes human errors compared to manual configuration.</li><li><strong>Speed and Simplicity:</strong> Infrastructure and environments can be <strong>rapidly set up and torn down</strong>.</li><li><strong>Version Control:</strong> Like software development, infrastructure changes can be <strong>versioned and tracked in detail</strong> through commits, just like source code.</li></ul><p><strong>Key Features of Terraform</strong></p><ul><li><strong>Declarative Approach:</strong> As an engineer, you <strong>define <em>what</em> the infrastructure should be</strong>, and Terraform handles the <em>how</em>, ensuring the real-world infrastructure matches your configuration.</li><li><strong>Cloud Agnostic:</strong> You can use Terraform to build infrastructure on <strong>AWS, Azure, and GCP</strong>, unlike cloud-specific tools (like CloudFormation, which only works with AWS).</li></ul><h4><strong>Terraform vs CloudFormation:</strong></h4><ul><li><strong>CloudFormation</strong> is best for <strong>pure AWS environments</strong> due to its high integration and managed service benefits and native support for all AWS services.</li><li><strong>Terraform</strong> offers <strong>versatility with multi-cloud support</strong>.</li><li>Many companies use Terraform to <strong>avoid vendor lock-in</strong>.</li></ul><h4>Setting Up and Understanding Terraform</h4><p>We covered the necessary steps for local setup, including <strong>Installing Terraform</strong> and understanding its core components like <strong>Terraform Providers and Plugins</strong>, which act as the communication layer with specific cloud services (like the AWS Provider).</p><p>When I define a provider in my configuration, Terraform automatically downloads and installs the required provider plug-in during the terraform init process.</p><h4><strong>Terraform Configuration File</strong></h4><p>We explored the anatomy of a Terraform key configuration blocks:</p><ul><li><strong>Provider Block</strong>: This specifies which cloud provider we want to use (e.g., <strong>AWS</strong>, <strong>Azure</strong>, or <strong>Google Cloud</strong>).</li><li><strong>Resource Block</strong>: This defines and describes the infrastructure resources we want to build (e.g., <strong>EC2</strong>, <strong>S3</strong>, <strong>VPC</strong>).</li><li><strong>Variable Block</strong>: This declares <strong>input variables</strong> for creating reusable parameters in our configuration.</li><li><strong>Output Block</strong>: This specifies the values we want to retrieve after we’ve applied our configuration.</li></ul><h4>Terraform Commands</h4><p>Terraform provides a <strong>CLI</strong> (Command Line Interface) that allows us to interact with its core functionality. These commands forms the workflow to manage our infrastructure’s lifecycle, from creating and updating resources to destroying them when they are no longer needed.</p><p>The primary Terraform commands are:</p><ul><li><strong>terraform init </strong>command initializes a new or existing Terraform configuration. It downloads the necessary provider plugins and sets up the backend for storing state files.</li><li><strong>terraform plan </strong>command creates an execution plan. 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.</li><li><strong>terraform apply </strong>command executes the actions proposed in your plan, creating, modifying, or deleting resources as necessary.</li><li><strong>terraform destroy </strong>command to remove all resources managed by your configuration.</li></ul><h4><strong>Terraform File, Folder Structure &amp; State Management</strong></h4><ul><li><strong>Modules</strong> are used for reusability, allowing us to create reusable and shareable infrastructure components. Best practice involves separating configurations for different environments (e.g., production, staging, and development) to avoid accidental changes.</li><li>The <strong>Terraform state file</strong> (terraform.tfstate) is vital, as it tracks the real-world infrastructure. We learned the importance of using a <strong>remote state</strong> (like in Amazon S3) for better collaboration and to ensure all team members work with the latest state.</li></ul><h3>Hands-on Experience &amp; Lab Work</h3><p>This week was heavily focused on practical application, completing two major projects and gaining real-world experience in both technical implementation and professional communication.</p><h4>Class Project: Building a VPC</h4><p>Our initial hands-on training focused on the <strong>Terraform Workflow &amp; Building a VPC</strong>. This fundamental classroom project immediately put the core <strong>Terraform Commands</strong> into practice, providing tangible experience in defining and deploying networking infrastructure using HCL. We executed the standard workflow, using terraform plan to carefully review execution plans and terraform apply to provision resources.</p><p>I pushed the final Terraform code for this project to my GitHub repository for version control and reference:</p><p><a href="https://github.com/PasqualeKwan/cea-terraform-class-example">https://github.com/PasqualeKwan/cea-terraform-class-example</a></p><h4>Major Project: Next.js Portfolio Deployment</h4><p>The primary focus was a major capstone project: deploying a static <strong>Next.js portfolio website</strong> for a client named James Smith. This was a comprehensive exercise that put all our new Terraform knowledge into practice, achieving a fully deployed, highly available, and performant web application. The deployment required:</p><ul><li><strong>IaC Implementation:</strong> Defining the entire infrastructure stack using declarative <strong>Terraform configuration files</strong> (.tf).</li><li><strong>Core AWS Resources:</strong> Provisioning an <strong>S3 Bucket</strong> specifically configured for static website hosting, including setting up the necessary <strong>S3 Bucket Policy</strong> for public access.</li><li><strong>Global Content Delivery:</strong> Implementing an <strong>AWS CloudFront Distribution</strong> to use the S3 bucket as its origin, ensuring <strong>fast loading times</strong> and global availability while automatically enforcing <strong>HTTPS</strong> via a viewer certificate.</li><li><strong>Deployment Workflow:</strong> Utilizing the complete Terraform workflow (init, plan, apply) to provision the infrastructure, followed by using the <strong>AWS CLI</strong> (aws s3 sync) to upload the static site files to S3, linking the code deployment to the infrastructure deployment.</li></ul><h4>Professional Development and Communication</h4><p>In addition to the technical implementation, a critical component of our training focused on professional soft skills. For the Next.js project, I pushed the final Terraform code to my GitHub repository for version control and reference. It also included the Loom video, linked in the <strong>README.md</strong>, which served to explain the Next.js directory structure and deployment concept. This practice is essential for building confidence in explaining and communicating technical ideas to team members and stakeholders.</p><p><a href="https://github.com/PasqualeKwan/terraform-aws-nextjs-portfolio">https://github.com/PasqualeKwan/terraform-aws-nextjs-portfolio</a></p><h3>Key Takeaway</h3><p>The most impactful lesson this week is the confirmation that <strong>real learning happens when you face resistance.</strong> This was demonstrated technically when I chose to research and implement the more modern <strong>Origin Access Control (OAC)</strong> for S3/CloudFront security, a decision that was time-consuming but invaluable.</p><p>Similarly, the first-time creation of the technical <strong>Loom video</strong> — a real challenge as a non-native English speaker — underscored that a cloud engineer’s role equally demands deep technical skill and clear, confident communication.</p><p>The complexity of managing the <strong>Terraform </strong>remains a critical foundational best practice. I look forward to applying these robust technical and professional skills to the next phase of our curriculum, where we’ll continue building on this IaC foundation!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185e71be58e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 6 — Mastering AWS Automation with CloudFormation]]></title>
            <link>https://medium.com/@pasqualekwan/week-6-mastering-aws-automation-with-cloudformation-19fb1dbdcea3?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/19fb1dbdcea3</guid>
            <category><![CDATA[application-load-balancer]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[cloudformation]]></category>
            <category><![CDATA[autoscaling]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Fri, 10 Oct 2025 01:59:29 GMT</pubDate>
            <atom:updated>2025-10-10T01:59:29.790Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 6 — Mastering AWS Automation with CloudFormation</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ioTl96BrqIDcpe_s" /><figcaption>“Practice isn’t the thing you do once you’re good. It’s the thing you do that makes you good.” — Malcolm Gladwell</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>Week 6 was the direct solution to managing AWS infrastructure reliably. I moved entirely into <strong>Infrastructure as Code (IaC)</strong> using <strong>CloudFormation</strong>.</p><p>This transition allowed me to define my entire environment (the VPC and subnets I designed last week, along with <strong>access controls</strong>) in code. I learned how to automate the build, management, and teardown of complex systems consistently and automatically. Beyond automation, I also covered the deployment of key services like EC2, Elastic Load Balancing, S3, RDS, and <strong>IAM</strong>, using IaC principles for everything.</p><h3>Key Concepts Learned this Week</h3><p>This period focused on automating the core services needed for any modern web application.</p><p><strong>CloudFormation (Infrastructure as Code):</strong></p><ul><li>I learned to define my entire infrastructure using simple YAML templates. This means I can deploy the same environment many times without manual errors.</li><li>I primarily used <strong>VS Code</strong> to write and edit these templates, and kept the code synchronized with a <strong>GitHub repository</strong>. This process ensured <strong>version control</strong> and collaborative management of all my infrastructure definitions.</li><li>The core concept is deploying “stacks,” which are collections of related resources managed as a single unit. I used commands like create stack, update stack, delete stack, and describe stacks to manage these units.</li><li>A major challenge and learning opportunity was <strong>debugging</strong> templates to find syntax and logic errors before deployment.</li></ul><p><strong>VPC Automation:</strong></p><ul><li>I learned how to write CloudFormation templates to create the entire network structure, including the <strong>VPC</strong>, <strong>Public and Private Subnets</strong> across multiple AZs, the <strong>Internet Gateway (IGW)</strong>, and <strong>Route Tables</strong>.</li></ul><p><strong>IAM Automation:</strong></p><ul><li>I learned to define <strong>IAM Users, Groups, Policies, and Roles</strong> using CloudFormation templates.</li><li>Automating IAM setup ensures that all users and services start with the <strong>Principle of Least Privilege</strong> enforced by code, which is critical for security and compliance.</li></ul><p><strong>Compute and Scaling:</strong></p><ul><li><strong>EC2 Instances:</strong> I automated the deployment of the EC2 instances, including the crucial <strong>Bastion Host</strong>, using CloudFormation to ensure they were launched with the correct AMI, key pair, and Security Groups.</li><li><strong>Elastic Load Balancing (ELB):</strong> I learned how Application Load Balancers (ALBs) distribute incoming traffic to maintain application availability.</li><li><strong>Auto Scaling:</strong> I configured Auto Scaling Groups (ASGs) to automatically manage the number of EC2 instances, ensuring my application performs well under load and recovers automatically from failures.</li></ul><p><strong>Storage (S3):</strong></p><ul><li>I learned the structure of S3 and how to deploy buckets using CloudFormation, including setting up <strong>Bucket Policies</strong> for security and hosting a <strong>Static Website</strong>.</li></ul><p><strong>Databases (RDS):</strong></p><ul><li>I used CloudFormation to provision <strong>Relational Database Service (RDS)</strong> instances, securing them within my private subnets and ensuring they were configured for high availability.</li></ul><h3>Hands-on Experience &amp; Lab Work</h3><p>The goal of Week 6 was simple: if I built it manually in Week 5, I built it with code in Week 6.</p><h4>Deploy an S3 Bucket (Exercise 1)</h4><pre># CloudFormationTemplateVersion<br># Description<br><br>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;Cloudformation template for S3 Bucket&#39;<br>Resources:<br>  S3Bucket:<br>    Type: &#39;AWS::S3::Bucket&#39;<br>    Properties:<br>      BucketName: &#39;pasqualekwan-s3-bucket-yaml&#39;</pre><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation create-stack --stack-name my-s3-bucket-stack --template-body file://s3-bucket.yaml<br>{<br>    &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/my-s3-bucket-stack/a78f3cd0-a30d-11f0-ad51-06195ed5fb0d&quot;<br>}<br>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation describe-stacks --stack-name my-s3-bucket-stack<br>{<br>    &quot;Stacks&quot;: [<br>        {<br>            &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/my-s3-bucket-stack/a78f3cd0-a30d-11f0-ad51-06195ed5fb0d&quot;,<br>            &quot;StackName&quot;: &quot;my-s3-bucket-stack&quot;,<br>            &quot;Description&quot;: &quot;Cloudformation template for S3 Bucket&quot;,<br>            &quot;CreationTime&quot;: &quot;2025-10-06T23:39:08.995000+00:00&quot;,<br>            &quot;RollbackConfiguration&quot;: {},<br>            &quot;StackStatus&quot;: &quot;CREATE_COMPLETE&quot;,<br>            &quot;DisableRollback&quot;: false,<br>            &quot;NotificationARNs&quot;: [],<br>            &quot;Tags&quot;: [],<br>            &quot;EnableTerminationProtection&quot;: false,<br>            &quot;DriftInformation&quot;: {<br>                &quot;StackDriftStatus&quot;: &quot;NOT_CHECKED&quot;<br>            }<br>        }<br>    ]<br>}<br>pasqualekwan@Pasquales-Mac-mini CloudFormation % </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t0Xs6prwqIAHGdHc" /></figure><h4>VPC and Networking Automation (Exercises 2, 3, 4, 5)</h4><p>I created the entire multi-AZ VPC infrastructure using a unified CloudFormation stack, covering all subnets, the Internet Gateway, and associated Route Tables.</p><ul><li>VPC Template Snippet (Combined Subnets &amp; IGW/RTB Logic):</li></ul><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;CloudFormation for Multi-AZ VPC and Subnets&#39;<br>Resources:<br>  # My VPC (CidrBlock: 172.16.0.0/16)<br>  MyVPC:<br>    Type: &#39;AWS::EC2::VPC&#39;<br>    # ... properties ...<br>  # Public, App Private, and Data Private Subnets across AZ 1 and AZ 2<br>  PublicSubnet1A:<br>    Type: &#39;AWS::EC2::Subnet&#39;<br>    # ... properties and !Ref MyVPC ...<br>  # ... other 5 subnets ...<br>  # Internet Gateway (IGW) &amp; Attachment<br>  InternetGateway:<br>    Type: &#39;AWS::EC2::InternetGateway&#39;<br>  AttachInternetGateway:<br>    Type: &#39;AWS::EC2::VPCGatewayAttachment&#39;<br>    # ... properties ...<br>  # Public Route Table and Route to IGW<br>  PublicRouteTable:<br>    Type: &#39;AWS::EC2::RouteTable&#39;<br>  PublicRoute:<br>    Type: &#39;AWS::EC2::Route&#39;<br>    # ... properties referencing IGW ...<br>  # Subnet Associations<br>  PublicSubnet1ARouteTableAssociation:<br>    Type: &#39;AWS::EC2::SubnetRouteTableAssociation&#39;<br>    # ... properties ...</pre><ul><li>VPC Stack Deployment Status:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation describe-stacks --stack-name vpc-stack2<br>{<br>    &quot;Stacks&quot;: [<br>        {<br>            &quot;StackName&quot;: &quot;vpc-stack2&quot;,<br>            &quot;StackStatus&quot;: &quot;CREATE_COMPLETE&quot;,<br>            ...<br>        }<br>    ]<br>}</pre><h4>Bastion Host Compute and Connectivity (Exercise 6)</h4><p>I successfully deployed and tested core compute infrastructure, including the EC2 <strong>Bastion Host</strong>, and verified secure SSH access to private application instances.</p><ul><li>VPC Template Snippet to create the Basion Host:</li></ul><pre># Bastion Host EC2<br>  BastionHost:<br>   Type: &#39;AWS::EC2::Instance&#39;<br>   Properties:<br>      InstanceType: &#39;t3.micro&#39;<br>      KeyName: bastion-host<br>      ImageId: &#39;ami-0336cdd409ab5eec4&#39;<br>      SubnetId: !Ref PublicSubnet1A<br>      SecurityGroupIds:<br>        - !Ref BastionSG<br>      Tags:<br>        - Key: &#39;Name&#39;<br>          Value: &#39;BastionHost&#39;<br><br># Security Group for Bastion Host<br>  BastionSG:<br>    Type: &#39;AWS::EC2::SecurityGroup&#39;<br>    Properties:<br>      GroupDescription: &#39;Enable SSH access via port 22&#39;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: &#39;tcp&#39;<br>          FromPort: 22<br>          ToPort: 22<br>          CidrIp: &#39;185.216.146.246/32&#39;  # Replace with your IP address</pre><ul><li>Bastion Host SSH Test:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini downloads % ssh -i bastion-host.pem ec2-user@35.178.147.116<br>   ,     #_<br>   ~\_  ####_        Amazon Linux 2023<br>  ~~  \_#####\<br>  ~~     \###|<br>  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023<br>   ~~       V~&#39; &#39;-&gt;<br>    ~~~         /<br>      ~~._.   _/<br>         _/ _/<br>       _/m/&#39;<br>Last login: Tue Oct  7 19:54:06 2025 from 185.216.146.246<br>[ec2-user@ip-172-16-1-250 ~]$ </pre><ul><li>Key copying from local terminal to the Bastion Host (same key used for App 1).</li></ul><pre>pasqualekwan@Pasquales-Mac-mini Downloads % scp -i bastion-host.pem bastion-host.pem ec2-user@35.178.147.116:~/<br>bastion-host.pem                                                                                                            100% 1674   153.7KB/s   00:00</pre><pre>[ec2-user@ip-172-16-1-250 ~]$ ls<br>bastion-host.pem<br>[ec2-user@ip-172-16-1-250 ~]$</pre><ul><li>Building two EC2 instances APP1 and APP2 (and their SGs) in each of the private subnets 2A and 2B, using the following VPC Template Snippet:</li></ul><pre># App Instance in Private App Subnet 1A<br>  AppInstance1A:<br>   Type: &#39;AWS::EC2::Instance&#39;<br>   Properties:<br>      InstanceType: &#39;t3.micro&#39;<br>      KeyName: bastion-host<br>      ImageId: &#39;ami-0336cdd409ab5eec4&#39;<br>      SubnetId: !Ref AppPrivateSubnet1A<br>      SecurityGroupIds:<br>        - !Ref AppInstance1ASG<br>      Tags:<br>        - Key: &#39;Name&#39;<br>          Value: &#39;App1&#39;<br><br>       <br># App Instance in Private App Subnet 2B<br>  AppInstance2B:<br>   Type: &#39;AWS::EC2::Instance&#39;<br>   Properties:<br>      InstanceType: &#39;t3.micro&#39;<br>      KeyName: bastion-host<br>      ImageId: &#39;ami-0336cdd409ab5eec4&#39;<br>      SubnetId: !Ref AppPrivateSubnet2B<br>      SecurityGroupIds:<br>        - !Ref AppInstance2BSG<br>      Tags:<br>        - Key: &#39;Name&#39;<br>          Value: &#39;App2&#39;<br><br># Security Group for App Instance in Private App Subnet 1A<br>  AppInstance1ASG:<br>    Type: &#39;AWS::EC2::SecurityGroup&#39;<br>    Properties:<br>      GroupDescription: &#39;Enable SSH access via port 22 from Bastion Host&#39;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: &#39;tcp&#39;<br>          FromPort: 22<br>          ToPort: 22<br>          SourceSecurityGroupId: !Ref BastionSG<br><br># Security Group for App Instance in Private App Subnet 2B<br>  AppInstance2BSG:<br>    Type: &#39;AWS::EC2::SecurityGroup&#39;<br>    Properties:<br>      GroupDescription: &#39;Enable ICMP Ping from App1&#39;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: &#39;icmp&#39;<br>          FromPort: -1<br>          ToPort: -1<br>          SourceSecurityGroupId: !Ref AppInstance1ASG</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U6dSztrQzcvFqFtT" /></figure><ul><li>Bastion Host Connectivity testing: Login from local terminal to Bastion Host:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini Downloads % ssh -i bastion-host.pem ec2-user@35.178.147.116<br>   ,     #_<br>   ~\_  ####_        Amazon Linux 2023<br>  ~~  \_#####\<br>  ~~     \###|<br>  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023<br>   ~~       V~&#39; &#39;-&gt;<br>    ~~~         /<br>      ~~._.   _/<br>         _/ _/<br>       _/m/&#39;<br>Last login: Tue Oct  7 20:54:43 2025 from 185.216.146.246</pre><ul><li>App1 Connectivity testing: Login from Bastion Host to App1:</li></ul><pre>[ec2-user@ip-172-16-1-250 ~]$ ssh -i bastion-host.pem ec2-user@172.16.2.166<br>   ,     #_<br>   ~\_  ####_        Amazon Linux 2023<br>  ~~  \_#####\<br>  ~~     \###|<br>  ~~       \#/ ___   https://aws.amazon.com/linux/amazon-linux-2023<br>   ~~       V~&#39; &#39;-&gt;<br>    ~~~         /<br>      ~~._.   _/<br>         _/ _/<br>       _/m/&#39;<br>Last login: Tue Oct  7 20:34:09 2025 from 172.16.1.250</pre><ul><li>App2 ping (ICMP) testing:</li></ul><pre>[ec2-user@ip-172-16-2-166 ~]$ ping 172.16.5.70<br>PING 172.16.5.70 (172.16.5.70) 56(84) bytes of data.<br>64 bytes from 172.16.5.70: icmp_seq=1 ttl=127 time=0.730 ms<br>64 bytes from 172.16.5.70: icmp_seq=2 ttl=127 time=0.769 ms<br>64 bytes from 172.16.5.70: icmp_seq=3 ttl=127 time=0.806 ms<br>64 bytes from 172.16.5.70: icmp_seq=4 ttl=127 time=0.785 ms<br>64 bytes from 172.16.5.70: icmp_seq=5 ttl=127 time=0.763 ms<br>64 bytes from 172.16.5.70: icmp_seq=6 ttl=127 time=0.783 ms<br>^C<br>--- 172.16.5.70 ping statistics ---<br>6 packets transmitted, 6 received, 0% packet loss, time 5218ms<br>rtt min/avg/max/mdev = 0.730/0.772/0.806/0.023 ms</pre><h4>IAM Automation (Exercises 7, 8)</h4><p>I successfully automated the creation of IAM resources, defining users, groups, roles, and policies to enforce the Principle of Least Privilege by code.</p><ul><li>VPC Template Snippet to create the IAM user, group, roles and policies:</li></ul><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;CloudFormation for IAM Roles and Policies&#39;<br><br>Resources:<br>  # Create IAM User<br>  MyIAMUser:<br>    Type: &#39;AWS::IAM::User&#39;<br>    Properties:<br>      UserName: &#39;PeterCFN&#39;<br>      ManagedPolicyArns:<br>        - &#39;arn:aws:iam::aws:policy/AdministratorAccess&#39;<br><br>  # Create IAM Group<br>  MyIAMGroup:<br>    Type: &#39;AWS::IAM::Group&#39;    <br>    Properties:<br>      GroupName: &#39;PkwanGroup&#39;<br><br>  # Attach User to Group<br>  UserToGroup:<br>    Type: &#39;AWS::IAM::UserToGroupAddition&#39;<br>    Properties:<br>      GroupName: !Ref MyIAMGroup<br>      Users:<br>        - !Ref MyIAMUser<br><br>  # Create IAM Role<br>  MyIAMRole:<br>    Type: &#39;AWS::IAM::Role&#39;<br>    Properties:<br>      AssumeRolePolicyDocument:<br>        Version: &#39;2012-10-17&#39;<br>        Statement:<br>          - Effect: &#39;Allow&#39;<br>            Principal:<br>              Service: [&#39;ec2.amazonaws.com&#39;]<br>            Action: [&#39;sts:AssumeRole&#39;]<br>      ManagedPolicyArns:<br>        - &#39;arn:aws:iam::aws:policy/PowerUserAccess&#39;<br><br>  # S3 Custom Policy<br>  MyIAMPolicy:<br>    Type: &#39;AWS::IAM::Policy&#39;<br>    Properties:<br>      PolicyName: &#39;CustomPolicy&#39;<br>      PolicyDocument:<br>        Version: &#39;2012-10-17&#39;<br>        Statement:<br>          - Effect: &#39;Allow&#39;<br>            Action:<br>              - &#39;s3:GetObject&#39;<br>            Resource: &#39;*&#39;<br>      Roles:<br>        - !Ref MyIAMRole</pre><ul><li>Stack creation successfully executed:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JEp0wR7exrbBp9M9" /></figure><ul><li>IAM resources created:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FwGZD-kw8twem91F" /></figure><h4>Application Load Balancing (Exercise 9)</h4><p>I implemented the <strong>Application Load Balancer (ALB)</strong> by creating an ALB along with two webserver instances for testing.</p><ul><li>VPC Template snipplet:</li></ul><pre>  # Application Load Balancer<br>  MyLoadBalancer:<br>    Type: &#39;AWS::ElasticLoadBalancingV2::LoadBalancer&#39;<br>    Properties:<br>      Subnets:<br>        - !Ref PublicSubnet1A<br>        - !Ref PublicSubnet2B<br>      SecurityGroups: <br>        - !Ref WebServerSecurityGroup<br><br>  # Target Group for ALB<br>  MyTargetGroup:<br>    Type: &#39;AWS::ElasticLoadBalancingV2::TargetGroup&#39;<br>    Properties:<br>      VpcId: !Ref MyVPC<br>      Port: 80<br>      Protocol: HTTP<br>      Targets:<br>        - Id: !Ref WebServerInstance1A<br>        - Id: !Ref WebServerInstance2B<br><br>  # Listener for ALB<br>  MyListener:<br>    Type: &#39;AWS::ElasticLoadBalancingV2::Listener&#39;<br>    Properties:<br>      DefaultActions:<br>        - Type: forward<br>          TargetGroupArn: !Ref MyTargetGroup<br>      LoadBalancerArn: !Ref MyLoadBalancer<br>      Port: 80<br>      Protocol: HTTP<br><br>  # Web Server Security Group<br>  WebServerSecurityGroup:<br>    Type: &#39;AWS::EC2::SecurityGroup&#39;<br>    Properties:<br>      GroupDescription: &#39;Enable HTTP access via ALB&#39;<br>      VpcId: !Ref MyVPC<br>      SecurityGroupIngress:<br>        - IpProtocol: &#39;tcp&#39;<br>          FromPort: 80<br>          ToPort: 80<br>          CidrIp: &#39;0.0.0.0/0&#39;  # Allow HTTP from anywhere<br><br>  # WebServerInstance1A<br>  WebServerInstance1A:<br>    Type: &#39;AWS::EC2::Instance&#39;<br>    Properties:<br>      InstanceType: &#39;t3.micro&#39;<br>      ImageId: &#39;ami-0336cdd409ab5eec4&#39;<br>      SubnetId: !Ref PublicSubnet1A<br>      SecurityGroupIds:<br>        - !Ref WebServerSecurityGroup<br>      Tags:<br>        - Key: &#39;Name&#39;<br>          Value: &#39;WebServerInstance1A&#39;<br>      UserData:<br>        Fn::Base64: !Sub |<br>          #!/bin/bash<br>          yum update -y<br>          yum install -y httpd<br>          systemctl start httpd<br>          systemctl enable httpd<br>          echo &quot;Hello from WebServerInstance1A&quot; &gt; /var/www/html/index.html<br><br>  # WebServerInstance2B<br>  WebServerInstance2B:<br>    Type: &#39;AWS::EC2::Instance&#39;<br>    Properties:<br>      InstanceType: &#39;t3.micro&#39;<br>      ImageId: &#39;ami-0336cdd409ab5eec4&#39;<br>      SubnetId: !Ref PublicSubnet2B<br>      SecurityGroupIds:<br>        - !Ref WebServerSecurityGroup<br>      Tags:<br>        - Key: &#39;Name&#39;<br>          Value: &#39;WebServerInstance2B&#39;<br>      UserData:<br>        Fn::Base64: !Sub |<br>          #!/bin/bash<br>          yum update -y<br>          yum install -y httpd<br>          systemctl start httpd<br>          systemctl enable httpd<br>          echo &quot;Hello from WebServerInstance2B&quot; &gt; /var/www/html/index.html</pre><ul><li>ALB and 2 webservers created:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uYCPSXfGEWwzQCuX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sTVCihnWNFOv1HMO" /></figure><ul><li>Load Balancer in action:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XRzOxxcvJ6ku76Uh" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vOglyN1agLxKYv64" /></figure><h4>Auto Scaling (Exercise 10)</h4><p>I implemented the full scaling architecture by deploying the <strong>Auto Scaling Groups (ASGs)</strong> entirely through CloudFormation, utilizing the modern <strong>Launch Template</strong> approach.</p><ul><li>VPC Template snippet for ASG, scale-out policy and CloudWatch alarm to scale-out:</li></ul><pre>  # Auto Scaling Group (Updated to use Launch Template)<br>  MyAutoScalingGroup:<br>    Type: &#39;AWS::AutoScaling::AutoScalingGroup&#39;<br>    Properties:<br>      LaunchTemplate: # New property<br>        LaunchTemplateId: !Ref MyLaunchTemplate<br>        Version: !GetAtt MyLaunchTemplate.DefaultVersionNumber<br>      MinSize: &#39;1&#39;<br>      MaxSize: &#39;3&#39;<br>      DesiredCapacity: &#39;2&#39;<br>      VPCZoneIdentifier:<br>        - !Ref PublicSubnet1A<br>        - !Ref PublicSubnet2B<br><br>  # Alarm to scale out<br>  HighCPUAlarm:<br>    Type: &#39;AWS::CloudWatch::Alarm&#39;<br>    Properties:<br>      AlarmDescription: &#39;Alarm when CPU &gt; 70% for 5 minutes&#39;<br>      MetricName: &#39;CPUUtilization&#39;<br>      Namespace: &#39;AWS/EC2&#39;<br>      Statistic: &#39;Average&#39;<br>      Period: &#39;300&#39; # 5 minutes<br>      EvaluationPeriods: &#39;1&#39;<br>      Threshold: &#39;70&#39;<br>      ComparisonOperator: &#39;GreaterThanThreshold&#39;<br>      Dimensions:<br>        - Name: &#39;AutoScalingGroupName&#39;<br>          Value: !Ref MyAutoScalingGroup<br>      AlarmActions:<br>        - !Ref ScaleOutPolicy<br><br>  # Scale out policy<br>  ScaleOutPolicy:<br>    Type: &#39;AWS::AutoScaling::ScalingPolicy&#39;<br>    Properties:<br>      AutoScalingGroupName: !Ref MyAutoScalingGroup<br>      PolicyType: &#39;SimpleScaling&#39;<br>      ScalingAdjustment: 1<br>      Cooldown: &#39;300&#39;<br>      AdjustmentType: &#39;ChangeInCapacity&#39;</pre><ul><li>Auto-scaling stack completed successfully:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8B0fH9QCDX2LOpTz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qwRyrJz6_602tbPW" /></figure><ul><li>CloudWatch alarm screen capture:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0YmP2Rn-Kc5K9MoB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*aBkJrl-aM4qc_B0S" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/0*9FVFM1ca-Ep-p0PI" /></figure><h4>S3 Static Website (Exercise 11)</h4><p>I successfully deployed an S3 bucket to host a static website, demonstrating the process of defining <strong>Bucket Policies</strong> via CloudFormation to enable public access after initial deployment.</p><ul><li>VPC Template snipplet:</li></ul><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;S3 Bucket for Static File Hosting&#39;<br><br>Resources:<br>  MyS3Bucket:<br>    Type: &#39;AWS::S3::Bucket&#39;<br>    Properties:<br>      BucketName: &#39;pasqualekwan-static-website-ss&#39;<br>      WebsiteConfiguration:<br>        IndexDocument: index.html<br>      PublicAccessBlockConfiguration:<br>        BlockPublicAcls: false</pre><ul><li>Static website’s “index.html”:</li></ul><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;My S3 Hosted Website&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt; <br>    &lt;h1&gt;Welcome to My S3 Hosted Website&lt;/h1&gt;<br>    &lt;p&gt;This is a simple static website hosted on Amazon S3.&lt;/p&gt;<br>    &lt;p&gt;Enjoy browsing!&lt;/p&gt;  <br>&lt;/body&gt;<br>&lt;/html&gt;</pre><ul><li>Stack creation:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation create-stack --stack-name s3-web-stack --template-body file://s3-static.yaml<br>{<br>    &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/s3-web-stack/b86da6e0-a49d-11f0-b273-0abbf78dc8b7&quot;<br>}<br>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation describe-stacks --stack-name s3-web-stack                                   <br>{<br>    &quot;Stacks&quot;: [<br>        {<br>            &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/s3-web-stack/b86da6e0-a49d-11f0-b273-0abbf78dc8b7&quot;,<br>            &quot;StackName&quot;: &quot;s3-web-stack&quot;,<br>            &quot;Description&quot;: &quot;S3 Bucket for Static File Hosting&quot;,<br>            &quot;CreationTime&quot;: &quot;2025-10-08T23:22:55.991000+00:00&quot;,<br>            &quot;RollbackConfiguration&quot;: {},<br>            &quot;StackStatus&quot;: &quot;CREATE_COMPLETE&quot;,<br>            &quot;DisableRollback&quot;: false,<br>            &quot;NotificationARNs&quot;: [],<br>            &quot;Tags&quot;: [],<br>            &quot;EnableTerminationProtection&quot;: false,<br>            &quot;DriftInformation&quot;: {<br>                &quot;StackDriftStatus&quot;: &quot;NOT_CHECKED&quot;<br>            }<br>        }<br>    ]<br>}</pre><ul><li>Uploading of index.html to S3:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws s3 cp index.html s3://pasqualekwan-static-website-ss<br>upload: ./index.html to s3://pasqualekwan-static-website-ss/index.html</pre><ul><li>Although the file “index.html” has been uploaded, it cannot be opened because S3 bucket public access is blocked by default. We need to create a bucket policy to allow the access:</li></ul><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;S3 Bucket for Static File Hosting&#39;<br><br>Resources:<br>  MyS3Bucket:<br>    Type: &#39;AWS::S3::Bucket&#39;<br>    Properties:<br>      BucketName: &#39;pasqualekwan-static-website-ss&#39;<br>      WebsiteConfiguration:<br>        IndexDocument: index.html<br>      PublicAccessBlockConfiguration:<br>        BlockPublicAcls: false<br><br>  BucketPolicy:<br>    Type: &#39;AWS::S3::BucketPolicy&#39;<br>    Properties:<br>      Bucket: !Ref MyS3Bucket<br>      PolicyDocument:<br>        Version: &#39;2012-10-17&#39;<br>        Statement:<br>          - Sid: PublicReadGetObject<br>            Effect: Allow<br>            Principal: &#39;*&#39;<br>            Action:<br>              - &#39;s3:GetObject&#39;<br>            Resource: !Sub &#39;arn:aws:s3:::${MyS3Bucket}/*&#39;</pre><ul><li>Re-run the process by updating the stack again:</li></ul><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation update-stack --stack-name s3-web-stack --template-body file://s3-static.yaml<br>{<br>    &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/s3-web-stack/b86da6e0-a49d-11f0-b273-0abbf78dc8b7&quot;<br>}<br>pasqualekwan@Pasquales-Mac-mini CloudFormation % </pre><ul><li>Now the website becomes accessible:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fyrew6QM6k5g_8az" /></figure><h4>RDS CloudFormation (Exercise 12)</h4><p>I provisioned the <strong>Relational Database Service (RDS)</strong> instance using IaC.</p><ul><li>The VPC Template:</li></ul><pre>AWSTemplateFormatVersion: &#39;2010-09-09&#39;<br>Description: &#39;CloudFormation for RDS Instance&#39;<br>Resources:<br>  MyDB:<br>    Type: &#39;AWS::RDS::DBInstance&#39;<br>    Properties:<br>      DBInstanceIdentifier: &#39;MyNewRDS&#39;<br>      MasterUsername: &#39;admin&#39;<br>      MasterUserPassword: &#39;Admin12345!&#39;<br>      DBInstanceClass: &#39;db.t3.micro&#39;<br>      Engine: &#39;mysql&#39;<br>      EngineVersion: &#39;8.0&#39;<br>      AllocatedStorage: &#39;20&#39;<br>      BackupRetentionPeriod: 7</pre><pre>pasqualekwan@Pasquales-Mac-mini CloudFormation % aws cloudformation create-stack --stack-name rds-stack --template-body file://rds.yaml <br>{<br>    &quot;StackId&quot;: &quot;arn:aws:cloudformation:eu-west-2:859551916765:stack/rds-stack/afd12cf0-a50b-11f0-9b3a-02b7a89fe911&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nx0RGdJA36WpQVnk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tAxaOM2Mkz8zcNsu" /></figure><p>I spent significant time debugging failed deployments, which taught me how to read and interpret CloudFormation logs and error messages in the AWS console.</p><p>I practiced safely terminating entire application environments by simply deleting the main CloudFormation stack, ensuring all resources were cleanly removed.</p><h3>Key Takeaway</h3><p>The takeaway from Week 6 is definitive: CloudFormation is essential for cloud engineering.</p><p>I now understand that while the console is a good tool for learning the concepts, Infrastructure as Code is the only way to build real-world systems. CloudFormation allows me to eliminate human error, enforce consistency across environments, and manage complex infrastructure with a few lines of code. This transition from manual configuration to automated deployment is the most valuable skill I gained this week.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19fb1dbdcea3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 5 — AWS Fundamentals]]></title>
            <link>https://medium.com/@pasqualekwan/week-5-aws-fundamentals-68bc7ca1062d?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/68bc7ca1062d</guid>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-infrastructure]]></category>
            <category><![CDATA[aws-fundamentals]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 23:52:14 GMT</pubDate>
            <atom:updated>2025-10-09T23:52:14.223Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 5 — AWS Fundamentals</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hVJeoOEMxBymw81e" /><figcaption>“You can’t build a great building on a weak foundation. You must have a solid foundation if you’re going to have a strong superstructure.” — Gordon B. Hinckley</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>Week 5 of the Cloud Engineer Academy covered the basic parts of Amazon Web Services (AWS) fundamentals. This time focused on practical skills, moving from ideas to actual cloud setups. I focused on building secure networks and understanding core services like VPC, IAM, and EC2. This hands-on period helped me understand how to build the foundational components of scalable, secure, and reliable systems on AWS.</p><h3>Key Concepts Learned this Week</h3><p>This week’s lessons focused on the main building blocks of AWS and how they work together.</p><h4><strong>AWS Global Infrastructure</strong></h4><p>The AWS global infrastructure is the <strong>essential backbone</strong> for delivering highly available, scalable, and reliable services globally.</p><ul><li><strong>AWS Regions</strong> are independent geographical areas offering services globally.</li><li><strong>Availability Zones (AZs)</strong> are distinct, isolated data centers within a Region, separated by significant distance for resilience.</li><li><strong>Local Zones</strong> extend regions to bring services closer to users for low-latency needs.</li><li><strong>Edge Locations</strong> cache data closer to users, supporting services like CloudFront.</li><li><em>Note: Services like S3 and IAM are global, not tied to a specific region.</em></li></ul><h4>Amazon VPC</h4><p>The logically isolated private network within AWS.</p><ul><li><strong>CIDR Blocks:</strong> The IP address range defining the total available addresses (like property lines).</li><li><strong>Subnets:</strong> Smaller divisions of the VPC, which can be <strong>public</strong> (internet-facing, using an Internet Gateway) or <strong>private</strong> (internal, using a NAT Gateway for outbound access only).</li><li><strong>Route Tables:</strong> Rules that determine the direction of data traffic flow.</li><li><strong>Internet Gateway (IGW):</strong> The connection point between your VPC and the internet.</li><li><strong>NAT Gateway:</strong> Allows resources in a private subnet to initiate outbound internet traffic but prevents unsolicited inbound connections.</li><li><strong>Security Groups (SGs):</strong> Stateful firewalls for individual resources (instance-level protection).</li><li><strong>Network Access Control Lists (NACLs):</strong> Stateless firewalls for the entire subnet (subnet-level protection).</li></ul><h4><strong>AWS Identity and Access Management (IAM)</strong></h4><p>Securely controls access to AWS resources.</p><ul><li><strong>Users:</strong> Individuals or services needing access.</li><li><strong>Groups:</strong> Organized sets of users with similar access needs.</li><li><strong>Roles:</strong> Temporary permissions for services or temporary workers.</li><li><strong>Policies:</strong> Define granular access rules (security protocols).</li></ul><h3>Hands-on Experience &amp; Lab Work</h3><ul><li><strong>VPC Design &amp; Setup:</strong> I designed a multi-AZ VPC, including public and private subnets, an Internet Gateway (IGW), and route tables, then built this architecture using the AWS Console.</li><li><strong>Bastion Host:</strong> I set up a secure server (bastion host) in a public subnet to enable secure SSH access to servers located in private subnets.</li><li><strong>Multi-AZ Deployment:</strong> I configured the VPC across multiple AZs to ensure high availability and resilience.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5mrAK37QSCcXNNIsuXPgA.jpeg" /><figcaption>VPC with IGW, public and private subnets, route tables on multi-AZ</figcaption></figure><h3>Key Takeaway</h3><p>Week 5 was foundational, introducing me to many core AWS concepts through direct, hands-on practice in the AWS console. I gained a deep understanding of each component’s configuration and how they connect by manually building resources like VPCs, subnets, and EC2 instances.</p><p>This “point-and-click” experience was invaluable for me to visualize the AWS infrastructure and grasp its underlying structure. However, this manual setup also clearly showed me that it is prone to errors, difficult to consistently repeat, and time-consuming for any complex environment.</p><p>This personal experience strongly highlighted my crucial need for a more automated and reliable way to manage cloud resources in the future. I’m looking forward to diving into CloudFormation in Week 6 to address these challenges and automate infrastructure builds.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68bc7ca1062d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 4 — Linux and Bash]]></title>
            <link>https://medium.com/@pasqualekwan/week-4-linux-and-bash-e959f627e7a4?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e959f627e7a4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Thu, 02 Oct 2025 13:56:25 GMT</pubDate>
            <atom:updated>2025-10-09T16:37:18.776Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 4 — Linux and Bash</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmJ7L8idHyHGCOYfVtED3Q.jpeg" /><figcaption>“Live as if you were to die tomorrow. Learn as if you were to live forever.” — Mahatma Gandhi</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>Now, as we hit Week 4, the focus has shifted from high-level architecture to the fundamental command line interface (CLI) that powers the cloud: <strong>Linux and Bash</strong>. While the command syntax was often a helpful refresher, the core learning value was in mastering the integration of these tools into the AWS environment.</p><h3>Key Concepts Learned this Week</h3><p>The curriculum focused on two primary areas, with hands-on labs solidifying the concepts.</p><h4>Linux Basics and EC2 Interaction</h4><p>This module focused on connecting the Linux shell to the cloud. I successfully completed the <strong>EC2 Setup</strong>, launching and connecting to an <strong>Amazon Linux 2 EC2</strong> instance via SSH. I practiced <strong>File System Navigation</strong> using fundamental commands like pwd, ls, and cd. Finally, <strong>File Operations</strong> were essential, gaining proficiency in creating and manipulating files using touch, nano, vim (text editors), and cat (view file contents).</p><h4>File Permissions and Access Management</h4><p>This section taught cloud security and access from the perspective of the server. I confirmed the proper creation and application of an <strong>IAM Role</strong> (“ec2-S3”) to the EC2 instance, enabling secure interaction with other AWS services. I then tested this by utilizing the <strong>AWS CLI for S3</strong> directly from the terminal to first <strong>Create a Bucket</strong> (aws s3 mb s3://pkwan-bucket-exercise) and then <strong>Upload a File</strong> (aws s3 cp class_notes.txt s3://pkwan-bucket-exercise). A final, vital step was applying the <strong>octal notation system</strong> to master <strong>chmod </strong>for file permission.</p><h3>Hands-on Experience &amp; Lab Work</h3><p>The practical work confirmed theoretical understanding, particularly in managing file permissions and service access.</p><p><em>File creation and display in the home directory:</em></p><pre>ec2-user@ip-172-31-26-208 ~]$ touch class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ nano class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ ls<br>class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ cat class_notes.txt<br>Pasquale Kwan   2025-10-02<br><br>What I learned today:<br>- Create EC2 instance through AWS console<br>- Connect to the new EC2 instance<br>- Navigate the file system<br>- Create a file using the touch command<br>- Edit files using the nano and vim editors<br><br>[ec2-user@ip-172-31-26-208 ~]$ vim class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ cat class_notes.txt<br>Pasquale Kwan   2025-10-02</pre><p><em>File content extracted from </em><em>cat command:</em></p><pre>What I learned today:<br>- Create EC2 instance through AWS console<br>- Connect to the new EC2 instance<br>- Navigate the file system<br>- Create a file using the touch command<br>- Edit files using the nano editor<br>- Edit files using the vim editor</pre><p><em>Create IAM role “ec2-S3” to allow EC2 acesss to S3 resources:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hnq3uBigi1-m75CZHCYY9A.png" /></figure><p><em>Create S3 bucket:</em></p><pre>[ec2-user@ip-172-31-26-208 ~]$ aws s3 mb s3://pkwan-bucket-exercise<br>make_bucket: pkwan-bucket-exercise<br>[ec2-user@ip-172-31-26-208 ~]$ aws s3 cp class_notes.txt s3://pkwan-bucket-exercise<br>upload: ./class_notes.txt to s3://pkwan-bucket-exercise/class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ </pre><p><em>Upload a file to the S3 bucket:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tp-jwFm208MPa0cEaFzzEA.png" /></figure><p><em>Change file permission:</em></p><pre>[ec2-user@ip-172-31-26-208 ~]$ ls -l class_notes.txt<br>-rw-r--r--. 1 ec2-user ec2-user 261 Oct  2 11:57 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ chmod 444 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ ls -l<br>total 4<br>-r--r--r--. 1 ec2-user ec2-user 261 Oct  2 11:57 class_notes.txt<br>drwxr-xr-x. 2 ec2-user ec2-user   6 Oct  2 12:23 test_folder<br>[ec2-user@ip-172-31-26-208 ~]$ chmod 444 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ ls -l<br>total 4<br>-r--r--r--. 1 ec2-user ec2-user 261 Oct  2 11:57 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ ls -l class_notes.txt<br>-r--r--r--. 1 ec2-user ec2-user 261 Oct  2 11:57 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ chmod 744 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$ ls -l class_notes.txt<br>-rwxr--r--. 1 ec2-user ec2-user 261 Oct  2 11:57 class_notes.txt<br>[ec2-user@ip-172-31-26-208 ~]$</pre><p><em>Shutdown and terminated EC2 instance.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tUOXbZr9yTdxW46_h_KFWQ.png" /></figure><h3>Key Takeaway</h3><p>While the foundational <strong>Linux and Bash</strong> commands were a helpful refresher, the core learning value of Week 4 lay in mastering the <em>integration</em> of Linux within the cloud ecosystem. The critical new skill was launching and connecting to the <strong>AWS EC2 instance</strong> and immediately configuring it to interact with other AWS services (like S3) using the <strong>AWS CLI</strong>. This hands-on process proves that the shell is the ultimate interface for real-world automation and security in the cloud environment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e959f627e7a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 3 — System Design Applications]]></title>
            <link>https://medium.com/@pasqualekwan/week-3-system-design-applications-e4ee211c075d?source=rss-dc52bab4550b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4ee211c075d</guid>
            <category><![CDATA[monolithic-architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[cloud-engineering]]></category>
            <dc:creator><![CDATA[Pasquale Kwan]]></dc:creator>
            <pubDate>Wed, 01 Oct 2025 13:43:20 GMT</pubDate>
            <atom:updated>2025-10-09T13:37:11.025Z</atom:updated>
            <content:encoded><![CDATA[<h3>Week 3 — System Design Applications</h3><p><em>My journey with Cloud Engineering Academy</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5pFmk_4FrjFRkI0j" /><figcaption>“There are no easy solutions, only intelligent tradeoffs.” — Thomas Sowell</figcaption></figure><h3>Introduction</h3><p>Hello everyone, I’m Pasquale. I’ve recently embarked on a journey with the <strong>Cloud Engineering Academy</strong> to learn the AWS cloud technology. I’ll be using this weekly post to track my progress and share what I’m learning along the way.</p><p>In week 3, we dove into the core concepts and architectures that power modern software systems. From foundational architectural patterns to critical scaling tools, here’s a summary of the key takeaways from the “System Design Concepts” module and subsequent case studies.</p><h3>Key Concepts Learned this Week</h3><h4>Architecture Styles</h4><p><strong>Monolithic Architecture:</strong> I learned about the traditional, unified approach where all components (UI, business logic, data access) are housed in a single codebase. While simpler to deploy initially, I saw how it becomes challenging to scale and maintain as the application grows.</p><p><strong>Microservices Architecture:</strong> This is the modular antidote to the monolith, breaking the application into a collection of smaller, independently deployable services. The key benefit is <strong>independent scaling</strong> and <strong>technology heterogeneity</strong>, though it introduces complexities in networking and data consistency.</p><p><strong>Serverless Architecture:</strong> This paradigm focuses on abstracting away the infrastructure entirely. Concepts like <strong>Functions as a Service (FaaS)</strong> were explained, highlighting how you pay only for the compute time you consume, shifting the operational burden to the cloud provider.</p><h4>Foundational Components</h4><p><strong>Three-Tier Architecture:</strong> I revisited this classic, logical separation of an application into Presentation (or Web), Application (or Business Logic), and Data tiers. This foundational structure helps manage complexity and ensures clear separation of concerns.</p><p><strong>API’s Explained:</strong> A deep dive into <strong>Application Programming Interfaces (APIs)</strong> clarified their role as the contract for communication between different services or between a client and a service. This included understanding concepts like REST and RPC.</p><p><strong>Cloud Storage Options:</strong> The differences between common cloud storage types were detailed:</p><ul><li><strong>Object Storage (e.g., S3):</strong> Great for unstructured data (images, videos, backups).</li><li><strong>Block Storage (e.g., EBS volumes):</strong> Ideal for traditional databases and operating systems where fast, persistent disk access is required.</li><li><strong>File Storage (e.g., EFS):</strong> Best for use cases that require a shared file system interface.</li></ul><h4>Scaling and Optimization</h4><p><strong>Caching:</strong> This lesson explored how to dramatically reduce latency and database load by storing frequently accessed data closer to the user, covering different caching strategies and placement (e.g., CDN, in-memory cache).</p><p><strong>Load Balancer vs API Gateway:</strong> This comparison was crucial:</p><ul><li><strong>Load Balancer:</strong> Primarily distributes network traffic across multiple servers to ensure high availability and prevent any single server from becoming a bottleneck.</li><li><strong>API Gateway:</strong> Acts as a single entry point for all client requests, handling tasks like authentication, rate limiting, and request routing <em>before</em> hitting the backend services.</li></ul><p><strong>Server vs Serverless Scaling:</strong> A focused comparison illustrated the difference between scaling traditional <strong>Server-based</strong> architectures (which requires provisioning and managing new instances) and <strong>Serverless</strong> scaling (which is automatic and fine-grained, scaling based on function invocations).</p><h4>Design Case Walk-Through</h4><p>The course included practical application through various case studies and hands-on projects, which helped solidify the theory. The projects put theory into practice, including the design of a <strong>Video Sharing Platform</strong> — a complex challenge requiring the integration of multiple components — from content delivery networks (CDNs) and storage to encoding pipelines and API design — to build a platform like YouTube.</p><h3>Hands-on Experience &amp; Lab Work</h3><p>The course included practical application through various case studies and hands-on projects, which helped solidify the theory.</p><p>My hands-on experience focused on the following design challenges:</p><ul><li><strong>Project — Design a Basic Architecture:</strong> I applied the lessons on Monolithic, Microservices, and Three-Tier patterns to design a foundational, scalable architecture.</li></ul><p><a href="https://medium.com/@pasqualekwan/project-design-scalable-architecture-1686857ae3bd">Week 3 — 🚀 Project — Design Scalable Architecture</a></p><ul><li><strong>Project — Video Sharing Platform:</strong> This complex challenge involved integrating multiple components — from CDNs and storage to encoding pipelines and API design — to build a system comparable to YouTube.</li></ul><p><a href="https://medium.com/@pasqualekwan/week-3-video-sharing-platform-09516d514a23">Week3 — 🚀 Project — Video Sharing Platform</a></p><h3>Key Takeaway</h3><p>In summary, this learning journey provided a solid technical foundation, moving from defining fundamental architectures to mastering the critical components needed to design and scale complex, modern software systems. While diving into the practicalities of AWS, this entire module served as a vital reminder from my old system design days: with AWS’s vast array of services, the true challenge isn’t just knowing the technology, but deeply analyzing the <strong>business requirements, constraints, and tradeoffs</strong> necessary to choose the <em>right</em> solution <strong>and being able to articulate the rationale behind that choice.</strong> I’m excited to apply this analytical mindset as we dive deeper into AWS services in the coming weeks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4ee211c075d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>