<?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 Alex Bigzaad on Medium]]></title>
        <description><![CDATA[Stories by Alex Bigzaad on Medium]]></description>
        <link>https://medium.com/@bigzaad1?source=rss-4197886dd2c2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OhBa5MnkKhV9kPs_9vVZWQ.jpeg</url>
            <title>Stories by Alex Bigzaad on Medium</title>
            <link>https://medium.com/@bigzaad1?source=rss-4197886dd2c2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:55:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bigzaad1/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[Running My Own AI Chatbot From a Home Server — Because Why Not?]]></title>
            <link>https://medium.com/@bigzaad1/running-my-own-ai-chatbot-from-a-home-server-because-why-not-7973811267d4?source=rss-4197886dd2c2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7973811267d4</guid>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[mistral]]></category>
            <dc:creator><![CDATA[Alex Bigzaad]]></dc:creator>
            <pubDate>Wed, 07 May 2025 23:22:42 GMT</pubDate>
            <atom:updated>2025-05-13T16:13:18.534Z</atom:updated>
            <content:encoded><![CDATA[<h3>Running My Own AI Chatbot From a Home Server — Because Why Not?</h3><p>Ever wondered what it would be like to run your own AI chatbot, right from your home? Not from some data center, not rented from a cloud provider — but hosted on your own machine? Well, I did just that.</p><p>I turned an old PC into a home server, set up a virtualized environment using Proxmox, and deployed a completely self-hosted AI chatbot that’s now live and talking to my friends and family. The whole project started as a weekend curiosity — a tech playground for learning, breaking, and fixing things — and ended up becoming an exciting personal build.</p><p>My small home setup consists of three virtual machines: AlmaLinux, Ubuntu, and Red Hat Enterprise Linux, all running on Proxmox VE. It might not be AWS or Azure, but it’s mine. I call it my “home cloud.” It’s where I test ideas, mess around with configs, troubleshoot random issues, and build real-world systems — all managed through the command line over SSH, whether I’m at home or away. There’s no sandbox quite like the one you build for yourself.</p><p>And in this sandbox, I decided to launch an AI chatbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KzdDnTlTJ_z-VjNBrr64zQ.png" /><figcaption>The user interface of BigzaadAI chatbot.</figcaption></figure><h3>Why Build an AI Chatbot at Home?</h3><p>A lot of AI tools are available online, but I liked the challenge of hosting one myself. I wanted to understand what it takes to run a model, how the backend connects to the interface, and how to make something like that available on the web securely — all on a machine I controlled.</p><p>It was also a way to practice working with Linux systems, Docker, networking, and basic security — all in one project. Hosting something useful like a chatbot made it more fun and motivating. It’s not a production-grade system, but it works well enough to have real conversations.</p><h3>How I Deployed It — The Big Picture</h3><p>Let me walk you through the journey. I chose to host the AI chatbot on an AlmaLinux virtual machine, running on my GPU-accelerated Proxmox home server. AlmaLinux gave me the stability and control of an enterprise-grade OS, while the underlying infrastructure let me fully own and manage the stack — no cloud involved.</p><p>The chatbot itself runs on two key components:</p><ul><li>Open WebUI — a sleek, self-hosted interface for chatting with AI models</li><li>Ollama — a lightweight runtime for running large language models like Mistral 7B Instruct locally</li></ul><p>Ollama is installed directly on the VM as a background service to maximize performance and GPU access, while Open WebUI runs in a Docker container for easy isolation and updates. The two communicate seamlessly, with everything hosted securely inside my private network.</p><h3>Why Mistral? Why Not GPT?</h3><p>I chose Mistral 7B Instruct because it strikes a sweet spot between size and intelligence. At just 7 billion parameters, it’s compact enough to run efficiently at home, yet powerful enough to deliver surprisingly coherent and useful responses for everyday conversations.</p><p>Unlike massive models that demand cloud GPUs or enterprise-grade infrastructure, Mistral 7B runs comfortably on my local hardware — now with GPU acceleration. Thanks to my RTX 2060 passthrough setup, the model performs quickly and smoothly inside my AlmaLinux VM, using resources I already own.</p><p>Sure, it’s not as fast or broad as GPT-4, but that’s not the point. This build isn’t about chasing benchmarks — it’s about learning how everything works, building it myself, and running a model I fully control. No API keys, no usage limits, no subscriptions — just a smart assistant, running privately from my own home.</p><h3>Making It Public (But Secure)</h3><p>One of the most rewarding parts of the project was making the chatbot publicly accessible, so others could try it too. I didn’t want to mess with router settings, port forwarding, or expose my home IP directly — so I used Cloudflare Tunnel to safely publish my AlmaLinux VM to the internet.</p><p>This gave me a secure, custom domain like chat.bigzaad.us that routes through Cloudflare’s global edge network — handling SSL, DNS, and traffic routing — all without opening a single port on my router. From the outside, everything appears seamless; from the inside, my system remains locked down and private.</p><h3>Access Control: Signup + Admin Approval</h3><p>Since my system runs on limited resources, I didn’t want just anyone hammering it with requests. So I kept Open WebUI’s signup approval system enabled.</p><p>Here’s how it works:</p><ul><li>New users can sign up, but they’re marked as “pending”.</li><li>I, as the admin, get to manually approve or reject each signup.</li><li>Only approved users can actually start chatting with the AI.</li></ul><p>This simple gate ensures that my server doesn’t get overwhelmed, and I keep control over who’s using the service.</p><h3>What’s Next?</h3><p>I’m already thinking about what comes next.</p><p>Now that the AI setup is stable and running smoothly with GPU acceleration, I’m looking to expand my home server into more than just an AI lab. I’d love to set up Plex for personal media streaming, and explore self-hosted alternatives to cloud services — like a Google Photos-style solution for managing and backing up family photos. The idea is to make this server not just a playground for experiments, but a practical, private digital hub for everyday life — handling media, storage, and smart tools, all running securely from home.</p><p>What excites me most is that everything I used in this project is open source — AlmaLinux, Ubuntu, Proxmox, Open WebUI, Ollama, and the Mistral model itself. My only actual cost was about $7 a year for the domain name. No cloud subscriptions. No GPU rentals. No paywalls. Just time, curiosity, and free tools — the way it should be.</p><p><strong><em>Acknowledgment:</em></strong><em> I’m deeply grateful to the open-source communities and developers behind projects like Open WebUI, Ollama, Mistral, and many others. Their work empowers people like me to learn, build, and explore powerful technologies right from home.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7973811267d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Database Migration Service: Migrating Azure MySQL to Amazon RDS MySQL]]></title>
            <link>https://medium.com/@bigzaad1/aws-database-migration-service-migrating-azure-mysql-to-amazon-rds-mysql-d916eed1fd06?source=rss-4197886dd2c2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d916eed1fd06</guid>
            <category><![CDATA[database-migration]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[dms]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Alex Bigzaad]]></dc:creator>
            <pubDate>Mon, 03 Mar 2025 01:25:34 GMT</pubDate>
            <atom:updated>2025-03-05T03:54:15.406Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*5r3fvCJDMZbDUFrxbI3NaA.png" /><figcaption>Image source: opstree.com</figcaption></figure><p>Database migrations can feel like moving a house — you want everything packed up properly, transported safely, and unpacked without breaking anything. Whether you’re migrating for better performance, cost savings, or to scale effortlessly, the real challenge lies in keeping data consistent, minimizing downtime, and automating where possible. That’s where AWS Database Migration Service (AWS DMS) comes in, acting like the reliable moving crew for your data.</p><p>In this guide, we’re rolling up our sleeves and walking through the entire process of migrating a MySQL database from Microsoft Azure to Amazon RDS MySQL using AWS DMS. We’ll explore how AWS DMS works, set up migration endpoints, and verify the results using MySQL Workbench. Whether you’re learning about cloud migrations or handling one in a real-world scenario, this walkthrough will help you navigate the process with confidence.</p><h3>AWS DMS and Its Role in Migration</h3><p>AWS Database Migration Service (AWS DMS) is a fully managed service designed to migrate databases with minimal downtime. It supports two types of migrations:</p><ol><li>Homogeneous Migration — When the source and target databases are of the same type (e.g., MySQL → MySQL, PostgreSQL → PostgreSQL).</li><li>Heterogeneous Migration — When migrating between different database engines (e.g., Oracle → Amazon Aurora, SQL Server → PostgreSQL).</li></ol><p>Unlike traditional backup-and-restore methods, AWS DMS uses replication-based migration, continuously syncing data while keeping the source system online. This makes it ideal for:</p><ul><li>Minimal Downtime Migrations — Uses Change Data Capture (CDC) to replicate live data.</li><li>Cross-Cloud Database Migrations — Seamlessly moves databases from Azure, Google Cloud, or on-prem to AWS.</li><li>Schema Conversion Assistance — When migrating between different database engines, AWS DMS works alongside the AWS Schema Conversion Tool (SCT) to adjust schemas.</li></ul><h4>Migration Types in AWS DMS</h4><p>AWS DMS supports different migration approaches based on your needs:</p><ol><li>Full Load Migration — Transfers all existing data in one go (used in this lab).</li><li>Change Data Capture (CDC) — Captures real-time changes to keep the target updated.</li><li>Full Load + CDC — Best of both worlds; first migrates all data, then syncs ongoing changes.</li></ol><p>By leveraging AWS DMS, we can migrate our Azure MySQL database to Amazon RDS MySQL efficiently while ensuring data consistency and minimal disruption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sPqg7A64fcakGyC1NsUMiw.png" /><figcaption>AWS DMS Migration Flow — Data moves from the <strong>source</strong> to the <strong>target</strong> through endpoints and a replication instance. Image source: <a href="https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html">AWS DMS Documentation</a></figcaption></figure><h3>Lab Overview</h3><p>In this hands-on lab, I migrated an HR database from Microsoft Azure MySQL to Amazon RDS for MySQL, using AWS DMS. I configured:</p><ul><li><strong>Target Database</strong> → Created Amazon RDS for MySQL</li><li><strong>Target Endpoint</strong> → Amazon RDS for MySQL</li><li><strong>Source Endpoint</strong> → Azure MySQL database</li><li><strong>Replication Instance</strong> → Handles data transfer</li><li><strong>Migration Task </strong>→ Used % wildcard to migrate all tables</li><li><strong>Verification</strong> → Used MySQL Workbench to validate the migration</li></ul><h3>Step 1: Set Up the Target Database</h3><p>Before configuring AWS DMS, I needed a destination for the migrated data. So, I created an Amazon RDS MySQL instance with the following configuration:</p><ul><li>DB Instance Identifier: ccs640</li><li>Engine: MySQL</li><li>Instance type: Chosen based on workload requirements</li><li>Port: 3306 (default for MySQL)</li><li>Authentication: Defined master username and password</li><li>Storage: Configured for expected data growth</li><li>Connectivity: Ensured the instance was accessible from AWS DMS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*Ryt278XunM3RBvmuTbN0pg.png" /><figcaption>My target database (ccs640) is ready for the migration task.</figcaption></figure><h3>Step 2: Create the Target Endpoint — Amazon RDS</h3><p>Now that the target database instance (ccs640) was set up, I created a DMS target endpoint to connect to it.</p><ul><li>Endpoint Type: Target</li><li>Endpoint Identifier: ccs640taget</li><li>Engine: MySQL</li><li>Server Name: Copied the endpoint link from the RDS instance (ccs640)</li><li>Port: 3306</li><li>Authentication: Entered the RDS (ccs640) credentials for secure access</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cApcPBwDGWkW3o05y88gOA.png" /><figcaption>Target endpoint (ccs640target) is connected to Amazon RDS MySQL on port 3306, ready for migration.</figcaption></figure><h3>Step 3: Create the Source Endpoint — Azure MySQL</h3><p>Since the database already existed in Azure, my next step was to configure AWS DMS to connect to it by creating a source endpoint.</p><ul><li>Endpoint Type: Source</li><li>Endpoint Identifier: ccs640source</li><li>Engine: MySQL</li><li>Access to endpoint: Selected “Provide access information manually”</li><li>Server Name: #####mysql.mysql.database.azure.com</li><li>Port: 3306</li><li>Authentication: Provided the correct username and password</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xq4BaTbop9K_XHyoM6DM2g.png" /><figcaption>Source endpoint (ccs640source) is connected to Azure MySQL on port 3306, ready for migration.</figcaption></figure><h3>Step 4: Set Up the Replication Instance</h3><p>With both endpoints in place, I deployed a DMS replication instance — the engine responsible for moving data.</p><ul><li>Instance Name: ccs640mysql</li><li>Instance Class: Selected based on performance needs</li><li>VPC &amp; Security Group: Ensured access between source and target</li><li>Replication Engine Version: Latest version for stability</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T81sRcQ5g-Bn-LLUEXVNlw.png" /><figcaption>Replication instance is available and ready to migrate data from Azure MySQL to Amazon RDS MySQL.</figcaption></figure><p>Once the instance was active, I confirmed it could connect to both the source (Azure MySQL) and the target (Amazon RDS MySQL) for smooth data transfer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*EA-u1UJfHQqKtsE0cVhnhg.png" /><figcaption>Source Connection: ccs640source successfully connected to ccs640mysql.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*B4oBjwQTmAAGRgx4TSpbEA.png" /><figcaption>Target Connection: ccs640target successfully connected to ccs640mysql.</figcaption></figure><h3>Step 5: Create the Migration Task</h3><p>Now, it was time to define how the data should be migrated. I created a DMS migration task with the following settings:</p><ul><li>Task Identifier: ccs640Migration</li><li>Source Endpoint: ccs640source (Azure MySQL)</li><li>Target Endpoint: ccs640taget (Amazon RDS MySQL)</li><li>Replication Instance: ccs640mysql</li><li>Migration Type: Full Load (migrated all existing data)</li><li>Table Mappings: Used % wildcard to migrate all tables</li><li>Monitor: After creating and starting the task, I monitored the migration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3IXsItF-3xwIsjCvZuGbg.png" /><figcaption>Migration Task: The migration from Azure MySQL to Amazon RDS MySQL completed 100% with no errors.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A7_e-UdMPZy0vPfzTPwIqQ.png" /><figcaption>RDS instance Monitoring: System resource usage spiked during the migration, confirming data transfer activity.</figcaption></figure><h3>Step 6: Verify the Data in the Target Database</h3><p>With the migration completed, I used <strong><em>MySQL Workbench</em></strong> to check if everything made it over.</p><ul><li>Connected to Amazon RDS MySQL (ccs640)</li><li>Ran SQL queries to compare row counts and data</li><li>Confirmed that all tables and records matched the source database</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yMdVBJvLzryCVo93UXvj1Q.png" /><figcaption>Successful connection established to the CCS640 database, confirming the server is running and accessible.</figcaption></figure><p>I used the following SQL commands in MySQL Workbench to query and verify the migrated database:</p><pre>-- Show all available databases<br>SHOW DATABASES;<br><br>-- Switch to the migrated database<br>USE ccs640migration;<br><br>-- Show all tables in the selected database<br>SHOW TABLES;<br><br>-- Count the total number of rows in the &#39;country&#39; table<br>SELECT COUNT(*) FROM country;<br><br>-- Retrieve the first 10 rows from the &#39;country&#39; table<br>SELECT * FROM country LIMIT 10;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k39p1tFXAV9MnZBkfpd1jQ.png" /><figcaption>Workbench Query Results: SQL queries in MySQL Workbench verifying database migration success.</figcaption></figure><h3>Conclusion</h3><p>Migrating a database across cloud platforms might seem daunting, but with AWS DMS, it’s a structured and manageable process. In this lab, I successfully migrated an HR database from Azure MySQL to Amazon RDS MySQL, ensuring minimal downtime and data consistency.</p><p>By carefully setting up the target database first, configuring source and target endpoints, deploying the replication instance, and defining a migration task, the process flowed smoothly without missing dependencies. The final step — verification with MySQL Workbench — confirmed that the migration was successful, proving that AWS DMS is a powerful tool for seamless cross-cloud database transfers.</p><h3>References</h3><p>Amazon Web Services. (n.d.). <em>AWS Database Migration Service documentation</em>. AWS. <a href="https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html">https://docs.aws.amazon.com/dms/latest/userguide/Welcome.html</a></p><p>Amazon Web Services. (n.d.). <em>Amazon RDS for MySQL user guide</em>. AWS. <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html">https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html</a></p><p>Amazon Web Services. (n.d.). <em>AWS DMS replication instance guide</em>. AWS. <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.html">https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.html</a></p><p>Amazon Web Services. (n.d.). <em>AWS DMS endpoints guide</em>. AWS. <a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html">https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html</a></p><p>MySQL. (n.d.). <em>MySQL Workbench</em>. MySQL. <a href="https://www.mysql.com/products/workbench/">https://www.mysql.com/products/workbench/</a></p><p>Microsoft. (n.d.). <em>Azure Database for MySQL documentation</em>. Microsoft Learn. <a href="https://learn.microsoft.com/en-us/azure/mysql/">https://learn.microsoft.com/en-us/azure/mysql/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d916eed1fd06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Secure and Scalable PHP Application on AWS]]></title>
            <link>https://medium.com/@bigzaad1/deploying-a-secure-and-scalable-php-application-on-aws-7bd8594d1f54?source=rss-4197886dd2c2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bd8594d1f54</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[solutions]]></category>
            <dc:creator><![CDATA[Alex Bigzaad]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 12:05:46 GMT</pubDate>
            <atom:updated>2025-04-19T03:26:06.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this project, we will walk through the process of deploying a highly available, scalable, and secure PHP application on AWS. By the end of this guide, you will have a fully functional PHP application running on an Amazon EC2 instance, backed by a MySQL database hosted on Amazon RDS. We will also cover how to secure the application, provide high availability through a load balancer, and store sensitive information like database credentials securely using AWS Systems Manager Parameter Store.</p><p>Our goal is to deploy a PHP application for Example Social Research Organization (SRO) that meets the following requirements:</p><ul><li><strong>Secure hosting of the MySQL database</strong>: The database should be accessible only by the application and not publicly exposed.</li><li><strong>Secure access for administrative users</strong>: Administrators should be able to SSH into the EC2 instances securely.</li><li><strong>Anonymous access to web users</strong>: The application should be accessible to users over the internet.</li><li><strong>High availability</strong>: The application should be highly available, with automatic scaling to handle varying loads.</li><li><strong>Secure storage of credentials</strong>: Database connection information should be stored securely in AWS Systems Manager Parameter Store.</li></ul><p>For this project, I designed a three-tier architecture, separating the presentation (public-facing web servers), application (backend compute instances), and data (MySQL database) layers for enhanced security and performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m197IhKavLY35uw7S5vqiA.png" /><figcaption>Final Architecture: A Secure and Scalable Three-Tier Web Application on AWS</figcaption></figure><h3>Architecture Overview</h3><p>The architecture consists of the following components:</p><ul><li>VPC and Subnets: A Virtual Private Cloud (VPC) with public and private subnets across two Availability Zones (AZs) for high availability.</li><li>EC2 Instances: Running the PHP application, deployed in private subnets.</li><li>RDS MySQL Database: Hosted in private subnets, accessible only by the application.</li><li>Application Load Balancer (ALB): Distributes traffic to the EC2 instances.</li><li>Auto Scaling Group (ASG): Ensures the application scales based on demand.</li><li>AWS Systems Manager Parameter Store: Stores database credentials securely.</li><li>Security Groups: Control access to the EC2 instances, RDS, and ALB.</li><li>Optional Upgrades: Cloudfront for content delivery and Route 53 for DNS management.</li></ul><h3>Setting Up Cloud Network Infrastructure</h3><p>Cloud network infrastructure refers to the underlying networking resources that allow different cloud components to communicate securely and efficiently. It includes Virtual Private Cloud (VPC), subnets, route tables, internet gateways, NAT gateways, and security groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ElkVL79UojgEwVpOzL8Zyg.png" /><figcaption>AWS VPC Architecture for SRO-VPC with public and private subnets, route tables, and network connections.</figcaption></figure><p>To establish a secure and efficient AWS network for our PHP application and MySQL database, we implemented the following:</p><h4>1. Creating a Virtual Private Cloud (VPC)</h4><p>A VPC is a logically isolated network within AWS where we deploy all the cloud resources.</p><p><strong>Steps to Create the VPC:</strong></p><ul><li>Navigate to <em>AWS Console</em> → <em>VPC</em>.</li><li>Click <em>Create VPC</em> and enter:</li><li>VPC Name: SRO-VPC</li><li>IPv4 CIDR Block: 10.0.0.0/16 (Allows up to 65,536 IPs).</li><li>Leave other settings as default and click <em>Create VPC</em>.</li></ul><p>Enabling DNS Hostnames (After Creation):</p><ul><li>Select SRO-VPC.</li><li>Click <em>Actions</em> → <em>Edit VPC settings</em>.</li><li>Toggle Enable DNS hostnames → <em>Enabled</em>.</li></ul><p>This allows instances to receive public DNS names, useful for EC2, RDS, and services relying on domain names.</p><h4>2. Creating Public and Private Subnets</h4><p>A subnet is a range of IP addresses within a VPC that segments the network into smaller, manageable sections. I implement a three-tier architecture using six subnets across two Availability Zones (AZs) for high availability and fault tolerance.</p><p><strong>Presentation (Web) Tier → Public Subnets</strong></p><p>Hosts internet-facing components like the Application Load Balancer (ALB) and Bastion Host for external access.</p><ul><li>public-subnet-a (10.0.1.0/24, us-east-1a)</li><li>public-subnet-b (10.0.4.0/24, us-east-1b)</li></ul><p><strong>Application Tier → Private Application Subnets</strong></p><p>Houses EC2 instances running the PHP application. These instances do not have public IPs, ensuring they are isolated from direct internet access.</p><ul><li>private-subnet-app-a (10.0.2.0/24, us-east-1a)</li><li>private-subnet-app-b (10.0.5.0/24, us-east-1b)</li></ul><p><strong>Database Tier → Private Database Subnets</strong></p><p>Stores application data securely in Amazon RDS (MySQL). These subnets are isolated from public access to enhance security.</p><ul><li>private-subnet-db-a (10.0.3.0/24, us-east-1a)</li><li>private-subnet-db-b (10.0.6.0/24, us-east-1b)</li></ul><p>Note: If you want to learn why each subnet has its specific CIDR block, check out my other post: <a href="https://medium.com/@bigzaad1/understanding-cidr-blocks-in-aws-cloud-networking-31a3bd9578b8">Understanding CIDR Blocks in AWS Cloud Networking</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ru8VfWe2Z3Sxbkp8oHZz8Q.png" /><figcaption>Subnet Configuration for SRO-VPC, showing public and private subnets across two Availability Zones.</figcaption></figure><p>Steps to Create the Subnets:</p><ul><li>Navigate to <em>AWS Console</em> → <em>VPC</em> → <em>Subnets</em> → Click <em>Create Subnet</em>.</li><li>Select SRO-VPC and enter:</li><li>Subnet Name: public-subnet-a</li><li>CIDR Block: 10.0.1.0/24</li><li>Availability Zone: us-east-1a</li><li>Click <em>Create Subnet</em> to complete the setup.</li></ul><p>Repeat the steps for all six subnets based on their assigned tier.</p><h4>3. Create and Attach the Internet Gateway (IGW)</h4><p>An Internet Gateway (IGW) is an AWS-managed gateway that allows public subnets to send and receive traffic directly from the internet. Without an IGW, resources in the VPC cannot access external networks.</p><ul><li>Navigate to <em>VPC</em> → <em>Internet Gateways</em> → Click <em>Create IGW</em>.</li><li>Name it <em>SRO-IGW</em> and attach it to <em>SRO-VPC</em>.</li></ul><h4>4. Create and Associate the Public Route Table</h4><p>A public route table determines how traffic flows in and out of public subnets. It allows resources (such as an ALB or Bastion Host) to communicate with the internet via the IGW.</p><ul><li>Go to <em>VPC</em> → <em>Route Tables</em> → Click <em>Create Route Table</em>.</li><li>Name it <em>SRO-Public-RT</em>, select <em>SRO-VPC</em>, and associate it with public subnets.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZB2okAU5kV137_ffESvjSg.png" /><figcaption>Both public subnets are associated with the public route table for internet access.</figcaption></figure><ul><li>Add a route:</li><li>Destination: 0.0.0.0/0 (anywhere on the internet)</li><li>Target: SRO-IGW (the Internet Gateway)</li><li>Click <em>Save changes</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQwZ5eRTOdFL1n5v_d0Ahw.png" /><figcaption>Public route table directing traffic through an IGW to enable internet access for public subnets.</figcaption></figure><h4><strong>5. Create and Configure NAT Gateways</strong></h4><p>A NAT Gateway (NATGW) allows resources in private subnets to access the internet without exposing them to incoming traffic. This is useful for updates, API calls, and other outbound communications. A NAT Gateway must be created inside a public subnet because it needs a public IP to send traffic to the internet.</p><ul><li>Go to <em>VPC</em> → <em>NAT Gateways</em> → Click <em>Create NAT Gateway</em>.</li><li>Choose <em>public-subnet-a</em> (for AZ-a) and <em>public-subnet-b</em> (for AZ-b).</li><li>Name them <em>natgw-a</em></li><li>Allocate an <em>Elastic IP</em> to each NAT Gateway.</li><li>Click <em>Create NAT Gateway</em>.</li></ul><h4>Create and Associate the Private Route Tables</h4><p>To ensure isolation while allowing necessary outbound internet access (e.g., software updates, API calls), each tier — Application and Database — requires dedicated private route tables. The Application Tier subnets will route internet-bound traffic through the appropriate NAT Gateway, ensuring secure outbound communication without direct public exposure. Meanwhile, the Database Tier route table will not be routed to any gateway, as the database only needs to communicate internally with the Application Tier and does not require internet access.</p><p>Create Application Tier Route Table:</p><ul><li>Name: SRO-Private-RT-A</li><li>VPC: SRO-VPC</li><li>Associate with subnets: private-subnet-app-aand private-subnet-app-b</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*v7_NXvICZbRvhwlTXjML5Q.png" /><figcaption>Application subnets are associated with the SRO-Private-RT-A route table.</figcaption></figure><p>Add Routes to SRO-Private-RT-A:</p><ul><li>Destination: 0.0.0.0 /0 (anywhere on the internet)</li><li>Target NAT Gateway: natgw-a</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*NTkCu2fa-0aYazaa76nLhw.png" /><figcaption>Route table SRO-Private-RT-A is configured to route internet-bound traffic to the NATGW.</figcaption></figure><p>Create Database Tier Route Table:</p><ul><li>Name: SRO-Private-RT-B</li><li>VPC: SRO-VPC</li><li>Associate with subnets: private-subnet-db-aand private-subnet-db-b</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*EH8J1WxhNxEd7vYDv9Rg5Q.png" /><figcaption>Database subnets are associated with the SRO-Private-RT-B route table.</figcaption></figure><p>Add Routes to SRO-Private-RT-B:</p><ul><li>Destination: 10.0.0.0 /16 (Local VPC Communication)</li><li>Target: local</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*bDeTo4tUKx_7Tgwk0kTP1Q.png" /><figcaption>Route table SRO-Private-RT-B is configured to route only local traffic within the VPC.</figcaption></figure><h3>Securing AWS Infrastructure</h3><p>Security is a critical aspect of any cloud-based architecture. In this project, I implemented Security Groups, IAM Roles, and AWS Systems Manager Parameter Store to enhance security by managing access control, securing credentials, and ensuring that only authorized entities can access the web application, database, and administration interfaces. However, AWS offers additional security features that can further strengthen the security posture of the environment, such as AWS WAF, NACLs, and other advanced security services.</p><h4>1. Security Groups</h4><p>AWS Security Groups act as virtual firewalls that control inbound and outbound traffic to AWS resources. They define rules to regulate how different components of the infrastructure communicate securely. In this project, we implemented security groups to ensure only authorized access is allowed between the Load Balancer, EC2 instances, Bastion Host, and MySQL database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*reH0CCKWBsH3BjfxYYy-DQ.png" /><figcaption>Security groups in SRO-VPC defining access control rules for EC2, RDS, ALB, and Bastion Host.</figcaption></figure><p><strong>Application Load Balancer Security Group (SRO-ALB-SG)</strong></p><p>This security group allows public access to the Load Balancer so it can distribute incoming traffic to EC2 instances.</p><p>Inbound Rules:</p><ul><li>HTTPS (443) from 0.0.0.0/0 (open to the internet for web traffic).</li><li>Outbound traffic is allowed to all destinations (0.0.0.0/0).</li></ul><p><strong>EC2 Security Group (SRO-EC2-SG)</strong></p><p>This security group ensures that the EC2 instances running the PHP application receive traffic only from the Load Balancer and allow SSH access from the Bastion Host.</p><p>Inbound Rules:</p><ul><li>HTTPS (443) from SRO-ALB-SG (ensures only traffic from the Load Balancer reaches the EC2 instances).</li><li>SSH (22) access only from SRO-Bastion-SG, ensuring secure administration without exposing SSH to the public.</li></ul><p><strong>Database Security Group (SRO-DB-SG)</strong></p><p>This security group restricts access to the MySQL database, allowing connections only from the application layer (EC2 instances).</p><p>Inbound Rules:</p><ul><li>MySQL (3306) access is only allowed from the SRO-EC2-SG (prevents external access to the database).</li></ul><p><strong>Bastion Host Security Group (SRO-Bastion-SG)</strong></p><p>This security group allows secure SSH access to the Bastion Host, which is used to access private EC2 instances securely.</p><p>Inbound Rules:</p><ul><li>SSH (22) access is only allowed from Admin IP.</li></ul><h4>2. IAM Role</h4><p>An IAM (Identity and Access Management) role provides secure access to AWS services without requiring static credentials. In this project, the IAM role is essential for ensuring dynamic and secure interactions between the application and AWS services.</p><p>Instead of hardcoding database credentials within the PHP application, the role enables EC2 instances to retrieve them securely from AWS Systems Manager Parameter Store, enhancing security and best practices. Additionally, the role grants EC2 instances permission to access an Amazon S3 bucket to fetch and deploy the PHP source code automatically.</p><p>This IAM role is automatically assigned to application-tier EC2 instances upon launch, ensuring seamless integration with AWS services while maintaining a secure and scalable deployment architecture.</p><p><strong>Configuring IAM Role</strong></p><ol><li>Go to <em>AWS Console</em> → <em>IAM</em> → <em>Roles</em>.</li><li>Click <em>Create Role</em>.</li><li>Select Trusted Entity Type as AWS Service.</li><li>Choose Use Case as EC2 (Allows EC2 instances to call AWS services on your behalf.).</li><li>Attach the following policies:</li></ol><ul><li>AmazonSSMManagedInstanceCore (Allows EC2 instances to use Systems Manager services).</li><li>AmazonSSMReadOnlyAccess (Provides read-only access to Systems Manager parameters).</li><li>AmazonS3ReadOnlyAccess (Allows EC2 instances to retrieve files from S3 for automated deployment).</li><li>SecretsManagerReadWrite (Allows EC2 instances to securely retrieve secrets from AWS Secrets Manager).</li><li>AWSKeyManagementServicePowerUser (Grants decryption of secure credentials in Systems Manager and Secrets Manager).</li><li>CloudWatchLogsFullAccess (Allows EC2 instances to send logs to CloudWatch for debugging)</li></ul><p>6. Name the role SRO-Role and create it.</p><p>7. Attach the role to EC2 instances when launching them, ensuring they can securely access AWS services.</p><h4>AWS Systems Manager Parameter Store</h4><p>AWS Systems Manager Parameter Store is a managed service that allows you to securely store, manage, and retrieve configuration parameters and secrets, such as database credentials, API keys, and other sensitive information. This eliminates the need to hardcode credentials in applications, reducing security risks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I7L3vxx3KOLV8gV5aDosjw.png" /><figcaption>Database connection parameters stored in AWS Systems Manager Parameter Store for application instances.</figcaption></figure><p><strong>Steps to Store Parameters Securely</strong></p><ol><li>Navigate to <em>AWS Console</em> → <em>Systems Manager</em> → <em>Parameter Store</em>.</li><li>Click <em>Create Parameter</em>.</li><li>Enter Name (e.g., /example/username).</li><li>Select Type: SecureString (ensures encryption of sensitive data).</li><li>Enter <em>Value</em> (actual database username).</li><li>Repeat for password, endpoint, and database name.</li><li>Ensure IAM Role (SRO-Role) has permissions to access these parameters.</li></ol><h3>Preparing for Deployment</h3><p>This section focuses on setting up the infrastructure to deploy the PHP application and database efficiently. We will configure Amazon S3 for storing source code, Amazon RDS for database management, and a Launch Template for automated instance provisioning. To ensure scalability and reliability, we will also set up an Application Load Balancer, Target Group, and Auto Scaling Group. By the end, our deployment will be fully automated, secure, and highly available.</p><h4>Storing PHP Source Code in Amazon S3</h4><p>To enable automated deployment, we will store the PHP application files in Amazon S3, allowing EC2 instances to download them at launch. This approach ensures a scalable and efficient deployment process without manual uploads.</p><p>Step 1: Create the S3 Bucket</p><ul><li>Go to <em>AWS Console</em> → <em>S3</em>.</li><li>Click <em>Create Bucket</em>.</li><li>Set Bucket Name: sro-php-app-bucket-2025.</li><li>Select Region: us-east-1 (or the region of your EC2 instances).</li><li>Under <em>Block Public Access</em>, ensure all public access is <em>blocked</em>.</li><li>Under <em>Object Ownership</em>, select <em>Bucket owner enforced</em>.</li><li>Click <em>Create Bucket</em>.</li></ul><p>Step 2: Upload PHP Application Source Code</p><ul><li>Open the newly created S3 bucket.</li><li>Click <em>Upload</em> → <em>Add Files</em>.</li><li>Select Example.zip (compressed PHP application).</li><li>Click <em>Upload</em>.</li></ul><h4>Configuring the Launch Template</h4><p>To ensure automated and consistent deployment, we will configure a Launch Template that provisions EC2 instances with the required settings, security configurations, and software dependencies. This approach eliminates manual setup, enabling seamless scaling and efficient application deployment.</p><p>The Launch Template will:</p><ul><li>Automatically launch EC2 instances with pre-defined configurations.</li><li>Install and configure Apache, PHP, and required dependencies.</li><li>Securely retrieve and deploy the PHP application from Amazon S3.</li><li>Ensure instances are ready to serve traffic without manual intervention.</li></ul><p>Step 1: Create a New Launch Template</p><ul><li>Navigate to <em>AWS Console</em> → <em>EC2</em> → <em>Launch Templates</em>.</li><li>Click <em>Create Launch Template</em>.</li><li>Set Launch Template Name: SRO-PHP-App.</li><li>Select Amazon Linux 2023 as the AMI.</li><li>Choose Instance Type: t2.micro.</li><li>Set Key Pair (SSH Login): rsokey.</li><li>Do not specify a subnet (Auto Scaling will handle it).</li><li>Assign Security Group: SRO-EC2-SG.</li><li>Attach IAM Role: SRO-Role (Grants access to S3 &amp; Parameter Store).</li></ul><p>Step 2: Configure User Data for Automatic Deployment</p><ul><li>In <em>Advanced Details</em>, paste the following <em>User Data</em> script to automate instance setup and application deployment:</li></ul><pre>#!/bin/bash<br># Update system packages<br>yum update -y<br><br># Install Apache, PHP, and required dependencies<br>yum install -y httpd php php-mysqli unzip aws-cli<br><br># Start and enable Apache<br>systemctl start httpd<br>systemctl enable httpd<br><br># Navigate to the web directory<br>cd /var/www/html/<br><br># Download and extract the PHP application from S3<br>aws s3 cp s3://sro-php-app-bucket-2025/Example.zip .<br>unzip Example.zip<br><br># Move extracted files to the correct location if inside a subdirectory<br>if [ -d &quot;Example&quot; ]; then<br>  mv Example/* .<br>  rm -rf Example Example.zip<br>fi<br><br># Set correct file permissions<br>chown -R apache:apache /var/www/html/<br>chmod -R 755 /var/www/html/<br><br># Restart Apache to apply changes<br>systemctl restart httpd</pre><p>Step 3: Save and Create the Launch Template</p><ul><li>Click <em>Create Launch Template</em>.</li><li>Verify that SRO-PHP-App is successfully created.</li></ul><h4>Configuring Target Group, Load Balancer, and Auto Scaling</h4><p>To achieve high availability, fault tolerance, and automatic scaling, we will configure an Application Load Balancer (ALB), a Target Group, and an Auto Scaling Group (ASG). This setup ensures that incoming traffic is distributed efficiently across multiple EC2 instances, while Auto Scaling dynamically adjusts the number of instances based on demand.</p><p><strong>Step 1: Create a Target Group</strong></p><p>The Target Group acts as a connection point between the Application Load Balancer (ALB) and EC2 instances. It ensures traffic is directed only to healthy instances by continuously performing health checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KkWAEyaZtyZ-y33OIwYSA.png" /><figcaption>The target group reports 2 healthy instances, confirming successful health checks and proper load balancing.</figcaption></figure><p>Create Target Group:</p><ul><li>Navigate to <em>AWS Console</em> → <em>EC2</em> → <em>Target Groups</em>.</li><li>Click <em>Create Target Group</em>.</li><li>Set <em>Target Type</em>: Instances (Directs traffic to EC2 instances).</li><li>Set <em>Target Group Name</em>: SRO-App-TG.</li><li>Choose <em>Protocol</em>: HTTP, <em>Port</em>: 80.</li><li>Select the <em>VPC</em> where the application will run.</li></ul><p>Configure Health Checks:</p><ul><li>Protocol: HTTP</li><li>Path: /index.php (Ensures instances respond correctly).</li><li>Click Create Target Group.</li></ul><p>Register Targets:</p><ul><li>If EC2 instances are already running, manually select them and click Register Targets.</li><li>If using an Auto Scaling Group (ASG), instances will be registered automatically once they launch.</li></ul><p><strong>Step 2: Create an Application Load Balancer</strong></p><p>The Application Load Balancer (ALB) ensures high availability and fault tolerance by distributing incoming traffic across multiple EC2 instances. It improves performance by routing requests only to healthy instances while enabling seamless scaling through Auto Scaling Groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EmjWhm1PMMYDrZXm6q-1wQ.png" /><figcaption>The Application Load Balancer is active, forwarding traffic to two healthy EC2 instances via the target group.</figcaption></figure><p>Create Load Balancer</p><ul><li>Navigate to <em>AWS Console</em> → <em>EC2</em> → <em>Load Balancers</em>.</li><li>Click <em>Create Load Balancer</em> → <em>Application Load Balancer</em>.</li><li>Set Load Balancer Name: SRO-ALB.</li><li>Choose Scheme: Internet-facing (Makes the ALB accessible from the internet).</li><li>Select IP Address Type: IPv4.</li></ul><p>Network Settings:</p><ul><li>VPC: SRO-VPC (where the instances will run)</li><li>Public Subnets across at least two Availability Zones (for high availability).</li><li>Set Security Group: SRO-ALB-SG (Allows inbound HTTP traffic on port 80).</li></ul><p>Listeners and Routing:</p><ul><li>Protocol: HTTP</li><li>Port: 80</li><li>Target Group: Select SRO-App-TG.</li></ul><p>Click <em>Create Load Balancer</em>.</p><p><strong>Step 3: Create an Auto Scaling Group (ASG)</strong></p><p>The Auto Scaling Group (ASG) dynamically adjusts the number of running EC2 instances to match application demand. It ensures that the right number of instances are always available, providing cost efficiency, fault tolerance, and scalability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmW0l23Q9xYQ5uFywlEHYA.png" /><figcaption>The ASG uses the SRO-PHP-App launch template to provision EC2 instances with predefined configurations.</figcaption></figure><p>Create Auto Scaling Group</p><ul><li>Navigate to <em>AWS Console</em> → <em>EC2</em> → <em>Auto Scaling Groups</em>.</li><li>Click <em>Create Auto Scaling Group</em>.</li><li>Set Auto Scaling Group Name: SRO-PHP-ASG.</li><li>Launch Template: SRO-PHP-App (Ensures all instances are provisioned with the correct setup).</li><li>Select the <em>VPC</em> and <em>Public Subnets</em> (Same subnets used for the ALB).</li><li>Attach the Target Group: SRO-App-TG (Ensures new instances automatically register with the ALB).</li></ul><p>Configure Auto Scaling Policies:</p><ul><li>Desired Capacity: 2 (Ensures at least two instances run).</li><li>Minimum Instances: 2 (Prevents downtime by always maintaining two instances).</li><li>Maximum Instances: 4 (Allows scaling up to four instances based on traffic).</li></ul><p>Click <em>Create Auto Scaling Group</em>.</p><p><strong>Step 4: Create an Amazon RDS MySQL Instance</strong></p><p>Amazon RDS (Relational Database Service) simplifies database management by automating tasks such as provisioning, backups, scaling, and patching. In this guide, we will create a MySQL database instance on Amazon RDS that will serve as the backend for our PHP application.</p><p>Go to <em>AWS Console</em> → <em>RDS</em> → <em>Create Database</em></p><ul><li>Select “<em>Standard Create</em>” and choose <em>MySQL</em> as the engine.</li><li>DB Instance Identifier: srodatabase</li><li>Instance Type: db.t3.micro (adjust as needed)</li><li>Multi-AZ Deployment: Enable for high availability (optional)</li><li>Master Username: admin</li><li>Master Password: ########</li><li>IAM Database Authentication: <em>Enabled</em></li><li>Security Group Name: SRO-DB-SG (This was created earlier)</li></ul><p>Create DB Subnet Group:</p><ul><li>Go to <em>AWS Console</em> → <em>RDS</em> → <em>Subnet Groups</em></li><li>Click “<em>Create DB Subnet Group</em>”</li><li>Name: subnet-group-db</li><li>Description: Subnet group for RDS MySQL Multi-AZ</li><li>VPC: SRO-VPC</li><li>Add at least two private subnets across different Availability Zones:</li><li>Private Subnet A: private-subnet-db-a → us-east-1b</li><li>Private Subnet B: private-subnet-db-b → us-east-1a</li><li>Click “<em>Create</em>”</li></ul><p>Additional Configuration:</p><ul><li>Initial database name: srodatabase</li><li>DB parameter group: default.mysql.8.0</li><li>Automatic backup: Disable</li><li>Encryption: Enable</li></ul><p><strong>5. Creating a Bastion Host</strong></p><p>A bastion host is a publicly accessible EC2 instance that provides a secure way to connect to private EC2 instances inside a VPC . Since our application and database servers are in private subnets, we need a bastion host to act as a jump server for SSH access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dOP4zkajSNIXLkROA77pag.png" /><figcaption>SRO-Bastion security group allowing SSH (port 22) from IP 71.120.0.179/32.</figcaption></figure><ul><li>Go to <em>AWS Console</em> → <em>EC2</em> → <em>Launch Instances</em></li><li>Instance Name: SRO-Bastion</li><li>Amazon Machine Image (AMI): Amazon Linux (or Ubuntu if preferred)</li><li>Instance Type: t2.micro (free tier eligible)</li><li>Key Pair: Select an existing key pair (vockey.pem) or create a new one</li><li>VPC: SRO-VPC</li><li>Subnet: public-subnet-a</li><li>Auto-assign Public IP: <em>Enabled</em></li><li>Select SRO-Bastion-SG that was previously created</li><li>Storage: Keep default (8 GiB, gp3 SSD)</li><li>Click “<em>Launch Instance</em>”</li></ul><h3>Deploying the PHP Application</h3><p>Since we have previously configured automated deployment services such as the Launch Template, Auto Scaling Group (ASG), Target Group, and Application Load Balancer (ALB), the deployment of the PHP application and EC2 instances happens automatically once all configurations are in place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*D9xA8t5H_XPrCwrlrmAGhA.png" /><figcaption>Auto Scaling Group successfully launched EC2 instances, ensuring high availability.</figcaption></figure><p>Once the Auto Scaling Group (ASG) is triggered, the desired EC2 instances are launched, user data executes to deploy the PHP application, and the instances register with the Target Group. The Application Load Balancer (ALB) then routes incoming traffic, ensuring high availability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*r8WNDzNcPEWNVH1hW6qjrg.png" /><figcaption>Deployed PHP application is live, serving data and research queries seamlessly.</figcaption></figure><p>After deployment, health checks were performed, and the instances were marked healthy, confirming that everything is running as expected. The next step is ensuring that the RDS MySQL database is fully operational and connected to the application.</p><h3>Deploying SQL Database</h3><p>We previously created an Amazon RDS MySQL instance, ensuring it is properly configured with private subnets, security groups, and Multi-AZ deployment. Now, we will deploy our database to this RDS instance, which involves:</p><ul><li>Connecting to RDS from our private EC2 instance (PHP application server).</li><li>Transferring and importing the SQL database dump into MySQL on RDS.</li></ul><p>Since our RDS instance is private, we will first SSH into the bastion host, then connect to the private EC2 instance, and from there, establish a connection to RDS.</p><p><strong>Steps to Deploy SQL Database to RDS</strong></p><p>1️. Connect to the Bastion Host</p><p>Since the private EC2 instance is not directly accessible from the internet, we first connect to our bastion host:</p><pre>ssh -i &quot;vockey.pem&quot; ec2-user@&lt;BASTION-HOST-PUBLIC-IP&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*2K3sSIc7H25xqYHRi8yJmQ.png" /><figcaption>Successfully connected to the Bastion instance using SSH.</figcaption></figure><p>If the database dump file (Countrydatadump.sql) is stored on your local machine, you must first upload it to the bastion host:</p><pre>scp -i &quot;vockey.pem&quot; Countrydatadump.sql ec2-user@&lt;BASTION-HOST-PUBLIC-IP&gt;:~</pre><p>2. SSH from Bastion Host to Private EC2 Instance</p><p>Once inside the bastion host, connect to the private EC2 instance where the PHP application is running:</p><pre>ssh -i &quot;vockey2.pem&quot; ec2-user@&lt;PRIVATE-EC2-IP&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*b4QloeHab9yno00bbbHtyg.png" /><figcaption>Connected to the private EC2 instance via SSH from the Bastion host.</figcaption></figure><p>Then, transfer the database file (Countrydatadump.sql) from the bastion host to the private EC2 instance:</p><pre>scp -i &quot;vockey2.pem&quot; ~/Countrydatadump.sql ec2-user@&lt;PRIVATE-EC2-IP&gt;:~</pre><p>3. Verify MySQL is Installed on the EC2 Instance</p><p>To interact with MySQL on RDS, we need the MySQL client installed:</p><pre>mysql --version</pre><p>If MySQL is not installed, install it using:</p><pre>sudo yum install -y mariadb105</pre><p>4. Verify the Database Import</p><p>Connect to the RDS MySQL database using the endpoint from the AWS RDS console:</p><pre>mysql -h srodatabase.cr4ws4gacbep.us-east-1.rds.amazonaws.com -u admin -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*qkwYrklKjlUnvTQgttXcQA.png" /><figcaption>Successfully connected to the MySQL database on Amazon RDS.</figcaption></figure><p>After connecting to MySQL on RDS, verify the database name srodatabase, which was assigned during the RDS instance setup.</p><pre>SHOW DATABASES;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*4Q9fLAzex1pjYjCcdLq34Q.png" /><figcaption>Listing available databases, confirming the presence of srodatabase.</figcaption></figure><p>Select the srodatabase:</p><pre>USE srodatabase;</pre><p>Check that the tables exist:</p><pre>SHOW TABLES;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*giyzEevmkAu1hoiCNZgUKw.png" /><figcaption>Switched to srodatabase and confirmed the countrydata_final table exists.</figcaption></figure><p>To confirm that data was imported correctly:</p><pre>SELECT * FROM countrydata_final LIMIT 10;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*wNOuSy1vf0md6TIPOYBy7g.png" /><figcaption>Database query confirms successful import of country statistics into RDS.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2OvqK0yvttUedxUe0b4MYg.png" /><figcaption>The web application successfully queries the database and displays country population data.</figcaption></figure><h3>Conclusion</h3><p>In this project, we successfully deployed a secure and scalable PHP application on AWS using a well-architected three-tier architecture. By leveraging Amazon EC2, RDS MySQL, Load Balancer, Auto Scaling, and AWS Systems Manager, we ensured high availability, fault tolerance, and security for the application.</p><p>Key accomplishments include:</p><ul><li>Setting up a VPC with public and private subnets to securely isolate components.</li><li>Deploying an Amazon RDS MySQL instance for structured data storage.</li><li>Configuring EC2 instances in private subnets with automated provisioning via Launch Templates.</li><li>Implementing a Bastion Host for secure SSH access to private instances.</li><li>Using AWS Systems Manager Parameter Store for secure credential management.</li><li>Ensuring high availability and scalability through Auto Scaling and an Application Load Balancer.</li></ul><h4>Future Improvements</h4><p>While this deployment provides a solid foundation, additional enhancements could further optimize performance, security, and cost-efficiency:</p><ul><li>Amazon EFS (Elastic File System) — To enable shared storage across multiple EC2 instances for better file management.</li><li>Amazon Route 53 — To provide scalable and highly available DNS management.</li><li>Amazon CloudFront — To enhance application performance by caching content closer to users.</li></ul><p>By implementing these improvements, we can further strengthen the reliability, security, and efficiency of the application. This project demonstrates the power of AWS cloud services in creating a scalable, secure, and resilient web application architecture.</p><h3>Project Resources</h3><p>To complete this capstone project, I utilized the following resources:</p><ul><li><a href="https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/ILT-TF-200-ACACAD-20-EN/capstone-project/Countrydatadump.sql"><strong>Countrydatadump.sql</strong></a> containing a sample dataset for populating the database.</li><li><a href="https://aws-tc-largeobjects.s3.us-west-2.amazonaws.com/ILT-TF-200-ACACAD-20-EN/capstone-project/Example.zip"><strong>Example.zip</strong></a><strong> </strong>file with PHP scripts and image assets for the Example Social Research Organization website.</li></ul><h3>References</h3><ul><li>Amazon Web Services. (n.d.). <em>What is Amazon VPC?</em> Retrieved from <a href="https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html">https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html</a></li><li>Amazon Web Services. (n.d.). <em>Configuring subnets in Amazon VPC</em>. Retrieved from <a href="https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html">https://docs.aws.amazon.com/vpc/latest/userguide/configure-subnets.html</a></li><li>Amazon Web Services. (n.d.). <em>Create a launch template for an Amazon EC2 instance</em>. Retrieved from <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-launch-template.html">https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-launch-template.html</a></li><li>Amazon Web Services. (n.d.). <em>Getting started with Amazon S3 (PDF)</em>. Retrieved from <a href="https://docs.aws.amazon.com/pdfs/AmazonS3/latest/userguide/s3-userguide.pdf#GetStartedWithS3">https://docs.aws.amazon.com/pdfs/AmazonS3/latest/userguide/s3-userguide.pdf#GetStartedWithS3</a></li><li>Amazon Web Services. (n.d.). <em>Getting started with Amazon RDS (PDF)</em>. Retrieved from <a href="https://docs.aws.amazon.com/pdfs/AmazonRDS/latest/UserGuide/rds-ug.pdf#CHAP_GettingStarted">https://docs.aws.amazon.com/pdfs/AmazonRDS/latest/UserGuide/rds-ug.pdf#CHAP_GettingStarted</a></li><li>Amazon Web Services. (n.d.). <em>Create an application load balancer in AWS Elastic Load Balancing</em>. Retrieved from <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-application-load-balancer.html">https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-application-load-balancer.html</a></li><li>Amazon Web Services. (n.d.). <em>What is Amazon EC2 Auto Scaling?</em> Retrieved from <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html">https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html</a></li><li>Amazon Web Services. (n.d.). <em>IAM roles in AWS Identity and Access Management (IAM)</em>. Retrieved from <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html</a></li><li>Amazon Web Services. (n.d.). <em>Security groups for your VPC</em>. Retrieved from <a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html">https://docs.aws.amazon.com/vpc/latest/userguide/vpc-security-groups.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bd8594d1f54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding CIDR Blocks in AWS Cloud Networking]]></title>
            <link>https://medium.com/@bigzaad1/understanding-cidr-blocks-in-aws-cloud-networking-31a3bd9578b8?source=rss-4197886dd2c2------2</link>
            <guid isPermaLink="false">https://medium.com/p/31a3bd9578b8</guid>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[vpc]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cidr]]></category>
            <dc:creator><![CDATA[Alex Bigzaad]]></dc:creator>
            <pubDate>Sun, 16 Feb 2025 08:37:08 GMT</pubDate>
            <atom:updated>2025-02-16T10:25:50.564Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Efficient IP address allocation is a fundamental aspect of cloud networking, ensuring scalability, security, and performance. AWS Virtual Private Cloud (VPC) enables organizations to define their own networking environment using CIDR (Classless Inter-Domain Routing) blocks. CIDR helps allocate IP address ranges efficiently, allowing networks to be broken into smaller subnets while maintaining scalability.</p><p>This guide will cover the fundamentals of CIDR blocks, AWS best practices, and a real-world implementation scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25eanA-3FRu5j2mG-rSICw.png" /></figure><h3>What is a CIDR Block?</h3><p>CIDR (Classless Inter-Domain Routing) is a method used for efficient IP address allocation and network routing. Unlike traditional Class A, B, or C networks, CIDR provides a flexible way to divide IP address space using Variable-Length Subnet Masking (VLSM). This allows network architects to allocate only the necessary number of IP addresses per subnet, reducing wastage and improving scalability.</p><p>A CIDR block is an IP address range defined by two components:</p><ol><li>Base IP Address — The starting address of the network.</li><li>Subnet Mask (slash notation<strong>, </strong>/X<strong>)</strong> – Determines how many bits are allocated to the network and how many remain for subnetting and host allocation.</li></ol><p>An IPv4 address consists of 32 bits, divided into four octets (each octet is 8 bits):</p><pre>10.   0.   0.   0<br>00001010 00000000 00000000 00000000  (Binary Representation)</pre><p>Each bit in the subnet mask determines whether a portion of the address is used for the network, subnetting, or host allocation:</p><ul><li>Network Bits (fixed) — Define the larger network. These bits remain the same for all addresses within a network.</li><li>Subnet Bits — When dividing the network into multiple subnets, some of the host bits are repurposed to define subnets within the allocated range.</li><li>Host Bits — Used for assigning unique IP addresses to devices within a subnet.</li></ul><p>For example, CIDR block 10.0.0.0/16 means:</p><ul><li>The first 16 bits (10.0.) are reserved for the network portion.</li><li>The remaining 16 bits can be used for subnetting and host allocation.</li><li>This provides a total of 65,536 IP addresses.</li></ul><p>By adjusting the subnet mask <strong>(</strong>/X<strong>)</strong>, we can define the number of available subnets and usable IP addresses, ensuring efficient resource allocation within a VPC.</p><p>The table below provides an overview of different CIDR block sizes, the number of /24 subnets they can accommodate, and the number of usable IP addresses after AWS reserves five per subnet.</p><pre>CIDR Block    | Subnet Count (/24 per CIDR) | Usable IPs (AWS reserves 5)<br>--------------|-----------------------------|---------------------------<br>10.0.0.0/16   | 256                         | 65,531<br>10.0.0.0/17   | 128                         | 32,763<br>10.0.0.0/18   | 64                          | 16,379<br>10.0.0.0/19   | 32                          | 8,187<br>10.0.0.0/20   | 16                          | 4,091<br>10.0.0.0/21   | 8                           | 2,043<br>10.0.0.0/22   | 4                           | 1,019<br>10.0.0.0/23   | 2                           | 507<br>10.0.0.0/24   | 1                           | 251</pre><h3>Selecting the Right VPC CIDR Block</h3><p>A VPC CIDR block defines the entire IP address space for your AWS environment. AWS supports IPv4 CIDR blocks within these ranges:</p><ul><li>10.0.0.0/8 to 10.255.255.255/8 – Large-scale private networks, commonly used for enterprise environments.</li><li>172.16.0.0/12 to 172.31.255.255/12 – Typically used for medium-sized private networks.</li><li>192.168.0.0/16 to 192.168.255.255/16 – Often used for smaller networks or home offices.</li></ul><p><strong>Key Considerations for CIDR Block Selection</strong></p><ol><li>Plan for Growth: Choose a CIDR block that allows future subnet expansion and prevents IP exhaustion.</li><li>Avoid Overlapping IPs: Ensure that the CIDR block does not conflict with existing on-premises networks or other AWS VPCs.</li><li>Efficient IP Allocation: Consider the number of subnets and hosts required when selecting a CIDR block.</li><li>Subnet Segmentation: Divide the CIDR block into public, private, and reserved subnets for better organization.</li><li>Multi-Region Consistency: Use structured CIDR allocation to avoid IP conflicts across regions.</li></ol><p><strong>Example:</strong> An e-commerce company strategically allocates CIDR blocks to manage IP addressing efficiently across multiple AWS regions:</p><pre>us-east-1 (primary region)<br>VPC CIDR (10.0.0.0/16)<br>  ├── Public Subnet (10.0.1.0/24) - us-east-1a<br>  ├── Public Subnet (10.0.2.0/24) - us-east-1b<br>  ├── Private Subnet (10.0.3.0/24) - us-east-1a<br>  ├── Private Subnet (10.0.4.0/24) - us-east-1b<br>  └── Expansion (Reserved in 10.0.0.0/16)<br><br>us-west-2 (disaster recovery) <br>VPC CIDR (10.1.0.0/16)<br>  ├── Public Subnet (10.1.1.0/24) - us-west-2a<br>  ├── Public Subnet (10.1.2.0/24) - us-west-2b<br>  ├── Private Subnet (10.1.3.0/24) - us-west-2a<br>  ├── Private Subnet (10.1.4.0/24) - us-west-2b<br>  └── Expansion (Reserved in 10.1.0.0/16)</pre><p><strong>Why This CIDR Allocation is Effective</strong></p><ol><li>Optimized IP Allocation: Each region has its own non-overlapping CIDR block, ensuring proper separation and preventing IP conflicts.</li><li>Subnet Organization: Public and private subnets are clearly defined, simplifying traffic routing and security group assignments.</li><li>Scalability: Additional IP space is reserved in each VPC to support future subnet expansion.</li><li>Consistency Across Regions: A structured CIDR allocation plan maintains consistent IP addressing across multiple AWS regions.</li></ol><p>Choosing the right CIDR block ensures that your AWS network remains scalable, efficient, and well-structured for long-term growth and seamless IP management.</p><h3>Conclusion</h3><p>CIDR block planning is foundational to AWS cloud networking. Whether deploying a single-region web app, a Multi-AZ architecture, or a Multi-Region disaster recovery setup, efficient subnetting and CIDR allocation ensures security, scalability, and high availability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*0BGFZTrKw7KoR2WzvOmiFA.png" /></figure><h3>References</h3><p>Amazon Web Services. (n.d.). <em>VPC CIDR blocks</em>. AWS Documentation. Retrieved from <a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html">https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html</a></p><p>Amazon Web Services. (n.d.). <em>What is CIDR?</em>. AWS. Retrieved from <a href="https://aws.amazon.com/what-is/cidr/">https://aws.amazon.com/what-is/cidr/</a></p><p>Amazon Web Services. (n.d.). <em>Subnet sizing for VPCs</em>. AWS Documentation. Retrieved from <a href="https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html">https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31a3bd9578b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>