<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Glory Ugochukwu</title>
    <description>The latest articles on DEV Community by Glory Ugochukwu (@glory_ugochukwu_57b6cf663).</description>
    <link>https://dev.to/glory_ugochukwu_57b6cf663</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2809845%2F2cf3f6ac-4d2b-4f81-abc4-bfa1efe27578.JPG</url>
      <title>DEV Community: Glory Ugochukwu</title>
      <link>https://dev.to/glory_ugochukwu_57b6cf663</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/glory_ugochukwu_57b6cf663"/>
    <language>en</language>
    <item>
      <title>Building a Serverless, Event Countdown Website with AWS — A Deep Dive into neocloudapp.site (A Real-World Cloud Project)</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Tue, 06 May 2025 23:49:44 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/building-a-serverless-event-countdown-website-with-aws-a-deep-dive-into-neocloudappsite-a-1mme</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/building-a-serverless-event-countdown-website-with-aws-a-deep-dive-into-neocloudappsite-a-1mme</guid>
      <description>&lt;p&gt;How I deployed a fully serverless, secure, and globally available event site using AWS, Terraform, and best cloud practices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Intro: Why I Built This Project&lt;/strong&gt;&lt;br&gt;
As part of my &lt;strong&gt;Cloud Solutions Architect training&lt;/strong&gt;, I wanted to build a real-world project that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Showcases my understanding of AWS architecture&lt;/li&gt;
&lt;li&gt;Solves a practical problem (promoting a product/event)&lt;/li&gt;
&lt;li&gt;Demonstrates serverless, secure, and scalable solutions&lt;/li&gt;
&lt;li&gt;Uses Infrastructure as Code (IaC) with Terraform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result? A production-ready landing page hosted at &lt;a href="https://neocloudapp.site" rel="noopener noreferrer"&gt;https://neocloudapp.site&lt;/a&gt; — for the launch of the NeoApp Study Portal.&lt;/p&gt;

&lt;p&gt;Let’s break it all down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is the Project About?&lt;/strong&gt;&lt;br&gt;
The NeoCloud Event Countdown Website is a serverless landing page built to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Display a live countdown to the launch of a cloud learning portal (NeoApp).&lt;/li&gt;
&lt;li&gt;Collect registration data from interested users.&lt;/li&gt;
&lt;li&gt;Demonstrate AWS service integration in a clean, production-ready format.&lt;/li&gt;
&lt;li&gt;Showcase best practices in infrastructure-as-code (IaC), security, and scalability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More than just a form and countdown timer, this project mirrors real startup infrastructure needs—without overengineering, without high cost, and without a single server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Vision Behind the Project&lt;/strong&gt;&lt;br&gt;
"Tech is evolving — and NeoCloud is preparing you to lead the future."&lt;/p&gt;

&lt;p&gt;I imagined a scenario where NeoCloud was launching a tech education product — NeoApp. We needed a simple yet professional landing page to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Announce the upcoming launch&lt;/li&gt;
&lt;li&gt;Collect waitlist emails&lt;/li&gt;
&lt;li&gt;Be accessible, secure, and modern&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdlqhfjaiwhrius7bbqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdlqhfjaiwhrius7bbqw.png" alt="Architectural diagram" width="752" height="561"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[User] ---&amp;gt; [Route 53 + CloudFront] ---&amp;gt; [S3 Static Website Hosting]&lt;br&gt;
                          |&lt;br&gt;
                [ACM SSL for HTTPS]&lt;br&gt;
                          |&lt;br&gt;
        [API Gateway] ---&amp;gt; [Lambda (Python)] ---&amp;gt; [DynamoDB]&lt;br&gt;
                                         |&lt;br&gt;
                                       [SNS Notification]&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Services Used and Why&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.  Amazon S3 + CloudFront&lt;/strong&gt;&lt;br&gt;
  Why &lt;strong&gt;S3?&lt;/strong&gt;&lt;br&gt;
   &lt;strong&gt;Amazon S3&lt;/strong&gt; is cost-effective, reliable, and provides static &lt;br&gt;
   web hosting capabilities out of the box. It's ideal for &lt;br&gt;
   HTML/CSS/JS sites and integrates with CloudFront.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public access control:&lt;/strong&gt; Carefully configured bucket policies &lt;br&gt;
   ensured the website is publicly accessible without exposing &lt;br&gt;
   the whole AWS account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CloudFront&lt;/strong&gt; adds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Global CDN performance&lt;/li&gt;
&lt;li&gt;HTTPS with ACM SSL certificates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why CloudFront?&lt;/strong&gt;&lt;br&gt;
    As a global CDN, CloudFront caches content close to users, &lt;br&gt;
   reducing latency and improving performance. It also adds an &lt;br&gt;
   extra layer of security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.  Amazon Route 53 + ACM&lt;/strong&gt;&lt;br&gt;
     Custom domain setup with DNS routing and SSL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Route 53?&lt;/strong&gt;&lt;br&gt;
  &lt;strong&gt;AWS Route 53&lt;/strong&gt; offers scalable and highly available DNS &lt;br&gt;
   services. It integrates seamlessly with other AWS resources, &lt;br&gt;
   especially S3, CloudFront, and ACM.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ACM&lt;/strong&gt; provides free SSL certificates for secure, encrypted 
access (&lt;a href="https://neocloudapp.site" rel="noopener noreferrer"&gt;https://neocloudapp.site&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why ACM?&lt;/strong&gt; AWS Certificate Manager lets us provision and &lt;br&gt;
  attach an SSL certificate (HTTPS) for free, crucial for &lt;br&gt;
  securing user data and gaining trust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. API Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;  It acts as a front door to Lambda, providing HTTP endpoints for the form to interact with. It handles authorization, rate limiting, and CORS configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in throttling and caching&lt;/li&gt;
&lt;li&gt;Seamless integration with Lambda&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. AWS Lambda (Python)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; AWS Lambda runs backend code without managing servers. For the waitlist registration, a Python Lambda function processes the form and triggers database storage and email notifications…i.e&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles backend logic:&lt;/li&gt;
&lt;li&gt;Parses form submissions&lt;/li&gt;
&lt;li&gt;Saves to DynamoDB&lt;/li&gt;
&lt;li&gt;Triggers SNS notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Serverless means:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No infrastructure management&lt;/li&gt;
&lt;li&gt;Only pays when the function runs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Amazon DynamoDB&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt; DynamoDB?&lt;br&gt;
DynamoDB is AWS’s NoSQL database, perfect for quick, low-latency access. It’s serverless, auto-scales, and requires zero maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;br&gt;
Scales automatically&lt;br&gt;
Integrated seamlessly with Lambda&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alternatives:&lt;/strong&gt; RDS (for relational data) or S3 (for flat file storage—but less queryable).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. SNS (Simple Notification Service)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Sends real-time alerts when someone submits the form (e.g., email notifications).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;br&gt;
Decouples backend logic&lt;br&gt;
Supports multiple subscribers (email, SMS, Lambda triggers)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alternatives:&lt;/strong&gt; SES (Simple Email Service) for customized email content, or Slack/API integrations for internal alerts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Terraform&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Infrastructure as Code (IaC) ensures consistency, repeatability, and automation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alternatives:&lt;/strong&gt; AWS CloudFormation (native), Pulumi (for coding IaC in languages like TypeScript/Python).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why Serverless?&lt;/strong&gt;&lt;br&gt;
I chose serverless architecture for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; Serverless apps scale automatically with demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced cost:&lt;/strong&gt; You only pay for what you use—no idle servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Less maintenance:&lt;/strong&gt; No server or OS management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed of deployment:&lt;/strong&gt; Easier to launch and iterate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Scalability, Availability, and Security&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt;&lt;br&gt;
 Every layer is serverless, meaning auto-scaling is native. it scales seamlessly without manual intervention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High Availability:&lt;/strong&gt;&lt;br&gt;
 Hosted in multiple AWS regions with S3, CRR, and CloudFront’s distributed nature. Even if one region fails, users can still access content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IAM roles&lt;/strong&gt; define strict access for each component.&lt;/li&gt;
&lt;li&gt;HTTPS via CloudFront &amp;amp; ACM secures transmission.&lt;/li&gt;
&lt;li&gt;Lambda has least-privilege permissions.&lt;/li&gt;
&lt;li&gt;No exposed servers means a smaller attack surface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step: How I Built neocloudapp.site (A Serverless Landing Page)&lt;/strong&gt;&lt;br&gt;
This project involved designing, developing, and deploying a serverless event landing page on AWS, fully automated with Terraform and secured using HTTPS. Here’s how I built it from scratch&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Purchased and Registered a Domain&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Action:&lt;/strong&gt; Bought the domain neocloud.site from a domain registrar
&lt;strong&gt;Why:&lt;/strong&gt; To use a custom, professional URL for branding and recognition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Set Up Hosted Zone in Route 53&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Action:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Created a Hosted Zone for neocloud.site in Route 53.&lt;/li&gt;
&lt;li&gt;Updated my registrar’s name servers to use Route 53 DNS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Route 53 acts as my DNS manager, letting me control how traffic is routed to AWS services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Requested an SSL Certificate via AWS Certificate Manager (ACM)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requested a free public SSL certificate for neocloud.site in 
us-east-1 (required by CloudFront).&lt;/li&gt;
&lt;li&gt;Used DNS validation to verify domain ownership automatically 
through Route 53.&lt;/li&gt;
&lt;li&gt;This certificate was later attached to the CloudFront 
distribution&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; To enable HTTPS and protect all user interactions with encryption.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Wrote the Frontend Code&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created an HTML/CSS landing page with:&lt;/li&gt;
&lt;li&gt;A hero section&lt;/li&gt;
&lt;li&gt;Benefits/features section&lt;/li&gt;
&lt;li&gt;Waitlist registration form&lt;/li&gt;
&lt;li&gt;Footer with attribution&lt;/li&gt;
&lt;li&gt;Ensured full mobile responsiveness and visual appeal.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; This is the core user interface and the first thing users see. It needs to be fast, lightweight, and modern.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Deployed the Frontend with S3 (Static Hosting)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created an S3 bucket named neocloud.site.&lt;/li&gt;
&lt;li&gt;Enabled static website hosting.&lt;/li&gt;
&lt;li&gt;Uploaded the frontend files using Terraform.&lt;/li&gt;
&lt;li&gt;Set a bucket policy to allow public read access to website content.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; S3 is perfect for hosting static sites — no server management, just upload and go.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Configured CloudFront as CDN + SSL Layer&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created a CloudFront distribution:&lt;/li&gt;
&lt;li&gt;Origin: S3 bucket&lt;/li&gt;
&lt;li&gt;Alternate domain name (CNAME): neocloud.site&lt;/li&gt;
&lt;li&gt;Attached the SSL certificate from ACM&lt;/li&gt;
&lt;li&gt;Set default root object to index.html&lt;/li&gt;
&lt;li&gt;Forced HTTPS redirect for all requests&lt;/li&gt;
&lt;li&gt;Used Terraform to automate all of this.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; CloudFront acts as a global CDN, improves performance, and adds an HTTPS layer for security&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 7: Connected Domain to CloudFront with Route 53 (A Record)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I created an Alias A Record in Route 53 that points 
the neocloud site to the CloudFront distribution.&lt;/li&gt;
&lt;li&gt;At this point, I could visit &lt;a href="https://neocloudapp.site" rel="noopener noreferrer"&gt;https://neocloudapp.site&lt;/a&gt; and see my landing page live!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; This links the domain name to the website content hosted through CloudFront.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; Created Backend Infrastructure for Form Submission.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8a. API Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up a REST API with a POST /register endpoint.&lt;/li&gt;
&lt;li&gt;Integrated it with Lambda&lt;/li&gt;
&lt;li&gt;Enabled CORS to allow browser-based requests from the 
frontend.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; API Gateway is a fully managed service for building serverless APIs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8b. Lambda Function&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrote a Python-based Lambda function that:&lt;/li&gt;
&lt;li&gt;Receives name and email from the frontend&lt;/li&gt;
&lt;li&gt;Saves them into a DynamoDB table&lt;/li&gt;
&lt;li&gt;Sends a notification to an SNS topic&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Lambda lets me run backend logic without provisioning servers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8c. DynamoDB Table&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created a table NeoAppWaitlist with:&lt;/li&gt;
&lt;li&gt;Primary Key: email&lt;/li&gt;
&lt;li&gt;Other fields: name, timestamp&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; NoSQL database with fast performance, perfect for storing simple form submissions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8d. SNS Topic&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Created an SNS topic and added my admin email as a subscriber.&lt;/li&gt;
&lt;li&gt;Lambda publishes a message when a new registration is 
submitted.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; To receive real-time notifications of new registrations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 9: Integrated Frontend with Backend&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Used JavaScript fetch() in the frontend to send form data to 
the API Gateway endpoint.&lt;/li&gt;
&lt;li&gt;Handled success and error messages dynamically in the UI.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Makes the form interactive and provides feedback to users.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 10: Wrote and Applied Terraform Scripts for Full Infrastructure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Wrote Terraform configurations to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the S3 bucket, CloudFront distribution, and Route 53 records&lt;/li&gt;
&lt;li&gt;Provision the API Gateway, Lambda function, and IAM roles&lt;/li&gt;
&lt;li&gt;Set up DynamoDB, SNS, and ACM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`terraform init
terraform plan
terraform apply`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgp6gvvo5m2tgt5phzxg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwgp6gvvo5m2tgt5phzxg.png" alt="laC" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why:&lt;/strong&gt;  Terraform ensures consistency, repeatability, and version control across environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 11: Final Testing and Debugging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Action:&lt;/p&gt;

&lt;p&gt;Visited &lt;a href="https://neocloudapp.site" rel="noopener noreferrer"&gt;https://neocloudapp.site&lt;/a&gt; to ensure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS works&lt;/li&gt;
&lt;li&gt;DNS resolves correctly&lt;/li&gt;
&lt;li&gt;Page loads globally via CloudFront&lt;/li&gt;
&lt;li&gt;Form submits correctly&lt;/li&gt;
&lt;li&gt;Data is saved in DynamoDB&lt;/li&gt;
&lt;li&gt;Email notification is triggered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Testing is crucial to validate that everything works seamlessly before sharing publicly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6b3mnzvup545er7jytb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6b3mnzvup545er7jytb.png" alt="the first look" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
This project gave me hands-on experience in building a production-grade, secure, and globally accessible event site — all without a single EC2 instance.&lt;/p&gt;

&lt;p&gt;If you're learning AWS or preparing for real-world cloud architect roles, I highly recommend building something like this.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

&lt;p&gt;Wrote this article to document my process, to help others, showcase my skills, and solidify what I’ve learned&lt;/p&gt;

&lt;p&gt;Read more of it &lt;a href="https://github.com/Glory-cloud-solution/App-Event-Countdown-Website-" rel="noopener noreferrer"&gt;https://github.com/Glory-cloud-solution/App-Event-Countdown-Website-&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cloudskills</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Seeing Cloud Differently: My Experience with the AWS Well-Architected Framework</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Thu, 24 Apr 2025 12:40:26 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/seeing-cloud-differently-my-experience-with-the-aws-well-architected-framework-2o52</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/seeing-cloud-differently-my-experience-with-the-aws-well-architected-framework-2o52</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
A few days ago, I took a class on the AWS Well-Architected Framework, and let me just say—it was one of the most insightful sessions I’ve had in my cloud journey so far. And it wasn’t just a theory-heavy lecture. We role-played real-world scenarios, walked through the pillars, and answered tough architecture questions in real time. &lt;/p&gt;

&lt;p&gt;As someone learning to become a Cloud Solutions Architect, I often get stuck asking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Am I building this the right way?”&lt;/li&gt;
&lt;li&gt;“What am I missing?”&lt;/li&gt;
&lt;li&gt;“How do I know this solution will scale, stay secure, or not break the bank?”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Turns out, AWS asked those exact questions—and built an entire framework to help answer them. Let’s talk about what it is, why it matters, and why I’ve grown to love it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the AWS Well-Architected Framework?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Well-Architected Framework (WAF)&lt;/strong&gt;  is a set of guiding principles and best practices that help architects build secure, high-performing, resilient, and efficient infrastructure in the cloud.&lt;br&gt;
It’s structured around six pillars that each represent a core area of cloud architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Operational Excellence&lt;/strong&gt; – Run and monitor systems to 
deliver business value and continuously improve processes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;– Protect information and systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability&lt;/strong&gt; – Recover quickly from failure and meet 
customer demands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Efficiency&lt;/strong&gt; – Use computing resources 
efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Optimization&lt;/strong&gt; – Avoid unnecessary costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sustainability&lt;/strong&gt;  (the newest addition)– Minimize 
environmental impact (newest pillar).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You evaluate your workloads against these pillars through Well-Architected Reviews—structured assessments that point out weaknesses and suggest improvements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why It Matters in the Real World&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s what really stood out to me: this isn’t just a checklist—it’s a mindset.&lt;br&gt;
Instead of designing reactively or building systems that only work for "today," the Well-Architected Framework forces you to think long-term. &lt;/p&gt;

&lt;p&gt;It encourages questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How will this app behave under load?&lt;/li&gt;
&lt;li&gt;What happens if a server fails?&lt;/li&gt;
&lt;li&gt;Are we logging enough to troubleshoot later?&lt;/li&gt;
&lt;li&gt;Are we paying for unused capacity?
You start to think like an architect, not just a builder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me explain this with a real-world vibe:&lt;br&gt;
Imagine your team just launched a big application on AWS. Everything works. Cool. &lt;br&gt;
But a month later:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You get hit with a $5,000 AWS bill &lt;/li&gt;
&lt;li&gt;A security group was accidentally left open to the world &lt;/li&gt;
&lt;li&gt;An EC2 instance crashes, and the app goes offline for hours.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s when you realize: “We built it. But we didn’t build it well.”&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Well-Architected Framework&lt;/strong&gt; is &lt;strong&gt;AWS&lt;/strong&gt;’s way of saying:&lt;br&gt;
“We’ve seen thousands of architectures. Here’s how to avoid common pitfalls.”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Use Cases We Explored&lt;/strong&gt;&lt;br&gt;
During our class role-play, we applied the WAF to various systems, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A university admission portal — What if students flood the system after results are released?&lt;/li&gt;
&lt;li&gt;A healthcare platform — How do you secure patient data while maintaining uptime?&lt;/li&gt;
&lt;li&gt;A government job portal — How can we build for unpredictable traffic surges without overspending?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these systems benefited from different pillars of the framework:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meet the 6 Pillars (Quick Look)&lt;/strong&gt;&lt;br&gt;
Let’s quickly break down what each pillar is really about—and how I relate to it as a learner:&lt;br&gt;
&lt;strong&gt;1. Operational Excellence&lt;/strong&gt;&lt;br&gt;
Focuses on running and monitoring systems, and continually improving.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Set up CloudWatch to monitor app health. Automate failover and patching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Security&lt;/strong&gt;&lt;br&gt;
Protect data, systems, and assets. Think least privilege and encryption everywhere.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Limit IAM permissions, encrypt S3 buckets, enable GuardDuty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Reliability&lt;/strong&gt;&lt;br&gt;
Make sure systems can recover from failure and scale to meet demand.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Use Auto Scaling Groups, multi-AZ deployments, RDS backups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Performance Efficiency&lt;/strong&gt;&lt;br&gt;
Use the right resources for the job and adapt to change.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Move from t2.micro to Graviton2 instances or Lambda where possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Cost Optimization&lt;/strong&gt;&lt;br&gt;
Avoid unnecessary spending and understand where your money goes.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Use Trusted Advisor, delete unused volumes, set up budgets, and alerts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Sustainability&lt;/strong&gt;&lt;br&gt;
Reduce environmental impact by using efficient resources and scaling wisely.&lt;br&gt;
&lt;strong&gt;Real-world:&lt;/strong&gt; Choose managed services and autoscaling to reduce energy waste.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I Love This Framework as a Solution-Driven Person&lt;/strong&gt;&lt;br&gt;
What made me truly connect with the &lt;strong&gt;WAF&lt;/strong&gt; is how solution-oriented it is.&lt;br&gt;
It doesn't just say, “Here's how you build something.”&lt;br&gt;
 It asks, “What problem are you solving, and how can we solve it better?”&lt;br&gt;
That resonates with me. I’m someone who enjoys identifying pain points and designing clean, scalable, practical solutions. This framework gave me a structured lens to evaluate not just cloud architecture, but any tech solution.&lt;/p&gt;

&lt;p&gt;In real consulting roles, AWS Solutions Architects run Well-Architected Reviews for clients. They:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ask questions about the framework&lt;/li&gt;
&lt;li&gt;Identify “high-risk” areas&lt;/li&gt;
&lt;li&gt;Recommend changes (sometimes tied to AWS credits for remediation!)
So even as a learner, understanding these pillars helps me think architecturally and ask better questions before I build.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What I Took From the Class&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It’s not about perfection—just continuous improvement.&lt;/li&gt;
&lt;li&gt;There are tools (like the Well-Architected Tool in AWS) that 
walk you through reviews.&lt;/li&gt;
&lt;li&gt;Real-life architecture isn’t about knowing all the services— 
It’s about asking the right questions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best Ways to Use the AWS Well-Architected Framework&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Design Reviews:&lt;/strong&gt; Use it as a checklist before launching a 
new system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improvement Plans:&lt;/strong&gt; Apply it to existing architectures to 
identify gaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decision-Making Tool:&lt;/strong&gt; Compare trade-offs when designing 
for performance vs. cost vs. security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Team Alignment:&lt;/strong&gt; Use the pillars to ensure everyone’s on the same page—DevOps, security, product, and business.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In 2025 and beyond, building “working” systems isn’t enough. We need scalable, secure, resilient, and cost-effective solutions. The &lt;strong&gt;AWS Well-Architected Framework&lt;/strong&gt; isn’t just for &lt;strong&gt;AWS-specific projects&lt;/strong&gt;—it’s a philosophy that applies to every &lt;strong&gt;cloud decision&lt;/strong&gt; we make.&lt;/p&gt;

&lt;p&gt;If you’re learning to design &lt;strong&gt;cloud solutions&lt;/strong&gt; like I am, the &lt;strong&gt;Well-Architected Framework&lt;/strong&gt; is like having &lt;strong&gt;AWS&lt;/strong&gt; whisper best practices in your ear. It doesn’t just make you a better builder—it helps you think like an architect.&lt;/p&gt;

&lt;p&gt;Because &lt;strong&gt;cloud&lt;/strong&gt; isn’t just about spinning up servers.&lt;br&gt;
 It’s about solving problems—the right way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s Next?&lt;/strong&gt;&lt;br&gt;
In Part 2, we’ll dig into the &lt;strong&gt;Operational Excellence pillar:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What it looks like in real cloud environments&lt;/li&gt;
&lt;li&gt;Key services (CloudWatch, Config, Systems Manager)&lt;/li&gt;
&lt;li&gt;Hands-on tips to improve observability and automation&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Networking in the Cloud: Building the Highways for Modern Applications.</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Thu, 24 Apr 2025 11:38:08 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/networking-in-the-cloud-3182</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/networking-in-the-cloud-3182</guid>
      <description>&lt;p&gt;&lt;strong&gt;Documenting My Cloud Journey – Understanding the Backbone of Cloud Infrastructure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
When I started learning about cloud computing, &lt;strong&gt;networking&lt;/strong&gt; felt like the part I was most tempted to skip. “Just give me Lambda, S3, and etc,” I thought. It was like a complex world of IPs, subnets, and protocols. But as I’ve progressed in my journey as a Cloud Solutions Architect trainee, I’ve come to see &lt;strong&gt;cloud networking&lt;/strong&gt; for what it really is: the invisible highway that connects users to applications, services to each other, and data across the globe.&lt;/p&gt;

&lt;p&gt;Everything in the cloud is talking to something else—and &lt;strong&gt;networking&lt;/strong&gt; is the language.&lt;/p&gt;

&lt;p&gt;Without understanding how services talk to each other, how they’re secured, and how traffic flows in and out of your environment, you're flying blind. So here’s a guide—an honest, example-driven introduction to &lt;strong&gt;networking in the cloud&lt;/strong&gt; and why it’s essential for resilient, secure, and scalable solutions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Cloud Networking?&lt;/strong&gt;&lt;br&gt;
Cloud networking is how resources &lt;strong&gt;(like EC2, S3, RDS, Lambda, etc.)&lt;/strong&gt; connect and communicate with each other inside the cloud, and how they connect to the outside world &lt;strong&gt;(users, on-prem infrastructure, apps, other systems)&lt;/strong&gt;. securely and efficiently.&lt;/p&gt;

&lt;p&gt;In traditional IT, this meant routers, switches, and cables. In the cloud? It’s all virtual—built using software-defined networking (SDN). You control your networking through dashboards, APIs, or Infrastructure as Code (like Terraform).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It includes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP addressing&lt;/li&gt;
&lt;li&gt;Subnets&lt;/li&gt;
&lt;li&gt;Gateways&lt;/li&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;Firewalls (security groups/NACLs)&lt;/li&gt;
&lt;li&gt;DNS&lt;/li&gt;
&lt;li&gt;Load balancing&lt;/li&gt;
&lt;li&gt;Connectivity options (VPN, Direct Connect, VPC Peering, et
c.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just like in the physical world, &lt;strong&gt;networks in the cloud&lt;/strong&gt; are designed to manage traffic flow, security, speed, and availability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Core Concepts&lt;/strong&gt;&lt;br&gt;
Here are the key &lt;strong&gt;AWS networking components&lt;/strong&gt; I’ve learned to work with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt;
Your own private network space in the cloud. You control IP ranges, subnets, route tables, and more. Think of a VPC as your private space in the AWS cloud—a walled garden where you launch your resources.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;You define&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP range (e.g., 10.0.0.0/16)&lt;/li&gt;
&lt;li&gt;Public and private subnets&lt;/li&gt;
&lt;li&gt;Internet access rules&lt;/li&gt;
&lt;li&gt;Security policies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; You launch a web server (EC2) in a &lt;strong&gt;public subnet&lt;/strong&gt; so users can access it, and a database in a &lt;strong&gt;private subnet&lt;/strong&gt; so only your app can talk to it. This keeps your DB secure and unreachable from the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Subnets (Public vs Private)&lt;/strong&gt;&lt;br&gt;
Think of these as dividing your VPC into smaller neighborhoods. You usually have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnet:&lt;/strong&gt; Resources like web servers that need internet access. Connected to the internet via an Internet Gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Subnet:&lt;/strong&gt; Databases or backend services that should stay isolated. No direct internet access—great for sensitive data or internal services.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Public subnets are like storefronts on a busy street. Private subnets are like offices behind locked doors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.  Route Tables&lt;/strong&gt;&lt;br&gt;
These are like traffic maps. They tell network packets where to go next. For example, “send internet-bound traffic to the IGW&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A public subnet's route table might say:
0.0.0.0/0 → Internet Gateway (send all internet traffic outside)&lt;/li&gt;
&lt;li&gt;A private subnet might route through a NAT Gateway instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case&lt;/strong&gt;: You need your app server in a private subnet to download updates from the internet, but you don’t want it exposed. Route it through a NAT Gateway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.  Security Groups &amp;amp; NACLs&lt;/strong&gt;&lt;br&gt;
These act like firewalls. They control who can talk to whom.&lt;br&gt;
Your cloud firewalls. Security Groups act like virtual firewalls for EC2, controlling inbound/outbound traffic. NACLs control traffic at the subnet level&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security Groups:&lt;/strong&gt; Attached to instances. Stateful (they remember connections).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NACLs (Network ACLs):&lt;/strong&gt; Attached to subnets. Stateless (rules must be explicitly set for both inbound and outbound traffic).
&lt;strong&gt;Example:&lt;/strong&gt; You allow inbound HTTP (port 80) only from the internet to your web server, and only allow traffic to your database from the app server’s IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.  Internet Gateway &amp;amp; NAT Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internet Gateway:&lt;/strong&gt; Attaches to your VPC to allow public &lt;br&gt;
  traffic (like users accessing your web app) and enables resources in public subnets to talk directly to the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NAT Gateway:&lt;/strong&gt; Let private subnets initiate connections to the &lt;br&gt;
 internet without being exposed. Is that private instances access &lt;br&gt;
 the internet for updates (like apt install), but prevent them &lt;br&gt;
 from being accessed from the outside.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Your Lambda functions or EC2 servers in private &lt;br&gt;
 Subnets need to fetch data from an external API securely—NAT &lt;br&gt;
 Gateway makes it happen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.  VPC Peering &amp;amp; Transit Gateway&lt;/strong&gt;&lt;br&gt;
What if you have multiple VPCs and they need to talk to each other?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC Peering:&lt;/strong&gt; One-to-one connection between two VPCs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transit Gateway:&lt;/strong&gt; A scalable hub-and-spoke model to connect many VPCs.
&lt;strong&gt;Real-World Example:&lt;/strong&gt; Your company has a dev environment in one VPC and prod in another. VPC peering lets them share logs or data securely.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7.  DNS with Route 53&lt;/strong&gt;&lt;br&gt;
Route 53 is AWS’s Domain Name System (DNS). It translates friendly names like &lt;code&gt;api.myapp.com&lt;/code&gt; into IP addresses.&lt;br&gt;
It also supports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Health checks&lt;/li&gt;
&lt;li&gt;Load balancing&lt;/li&gt;
&lt;li&gt;Geo-routing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; You want your customers in Europe to be routed to your European servers and US users to US servers—Route 53 handles that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Networking in the Cloud Matters&lt;/strong&gt;&lt;br&gt;
Imagine building a brilliant web app that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Times out every few minutes&lt;/li&gt;
&lt;li&gt;Gets hacked due to an open port&lt;/li&gt;
&lt;li&gt;Can’t scale because backend services are stuck in one AZ&lt;/li&gt;
&lt;li&gt;Costs a fortune because traffic is routed inefficiently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are not app problems — they’re networking problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Scenarios That Help It All Click&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streaming App Architecture&lt;/strong&gt;&lt;br&gt;
Imagine you're building a streaming platform like Netflix. You need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public subnets:&lt;/strong&gt; to host your APIs, load balancers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private subnets:&lt;/strong&gt; to run your transcoding services and databases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway:&lt;/strong&gt; to let private services fetch updates from the internet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route 53:&lt;/strong&gt; to map &lt;code&gt;video.myflix.com&lt;/code&gt; to your backend services.
Your networking design directly impacts performance, security, and costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Multi-Department VPC Setup&lt;/strong&gt;&lt;br&gt;
Your company has different departments: HR, Finance, and Engineering, each with its own VPC.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finance can’t access HR’s data.&lt;/li&gt;
&lt;li&gt;HR can share limited access with Engineering for reports.&lt;/li&gt;
&lt;li&gt;Use Transit Gateway to manage all connections from a single place.
Now you’ve created network isolation with optional interconnectivity. That's cloud networking done right.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hosting a Scalable Web App&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;EC2 in a &lt;strong&gt;public subnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Database in a &lt;strong&gt;private subnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Load Balancer to &lt;strong&gt;distribute traffic&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Security groups to restrict access to only &lt;strong&gt;port 80/443&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hybrid Cloud: Connecting AWS to On-Prem&lt;/strong&gt;&lt;br&gt;
Use VPN or AWS Direct Connect to link your on-prem servers to your VPC securely&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-Region Replication&lt;/strong&gt;&lt;br&gt;
S3 buckets in different regions communicating via VPC Peering, CRR, and Route 53&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolated Environments for Dev/Test/Prod&lt;/strong&gt;&lt;br&gt;
Separate VPCs with peering or a Transit Gateway for controlled communication&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Networking &amp;amp; Security Go Hand-in-Hand&lt;/strong&gt;&lt;br&gt;
Many security issues start as networking misconfigurations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open ports&lt;/li&gt;
&lt;li&gt;Overly permissive &lt;strong&gt;CIDR&lt;/strong&gt; ranges&lt;/li&gt;
&lt;li&gt;Unrestricted SSH access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best Practices I’ve Learned:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Principle of least privilege (0.0.0.0/0 only where necessary)&lt;/li&gt;
&lt;li&gt;Use CloudFront to reduce direct exposure of S3/static content&lt;/li&gt;
&lt;li&gt;Don’t just “accept defaults” when setting up a VPC. Understand why something is public or private.&lt;/li&gt;
&lt;li&gt;Security Groups can stack plan rules carefully to avoid unintended access.&lt;/li&gt;
&lt;li&gt;Use AWS VPC Flow Logs to monitor traffic for debugging.&lt;/li&gt;
&lt;li&gt;Practice! Build a VPC with public and private subnets, deploy EC2s, and try connecting them—it clicks faster when you do it yourself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Automation + Networking&lt;/strong&gt;&lt;br&gt;
I’ve also started using Terraform to automate network setups:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_subnet" "public" {
  vpc_id     = aws_vpc.main.id
  cidr_block = "10.0.1.0/24"
  map_public_ip_on_launch = true
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w885mkej1ghs8c8th53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6w885mkej1ghs8c8th53.png" alt="Network created via Terrafform" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Automating networking makes environments reproducible, auditable, and easy to tear down when needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Networking is Evolving&lt;/strong&gt;&lt;br&gt;
With modern tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Transit Gateway&lt;/li&gt;
&lt;li&gt;PrivateLink&lt;/li&gt;
&lt;li&gt;Global Accelerator&lt;/li&gt;
&lt;li&gt;App Mesh&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Doing it hands-on—setting up VPCs, subnets, and gateways—helped me truly understand what cloud networking is about. It’s not just IPs and rules; it’s the architecture of user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Networking is the unsung hero of cloud architecture.&lt;br&gt;
It’s not glamorous like AI, but nothing works without it.&lt;/p&gt;

&lt;p&gt;Learning it changed how I design systems:&lt;br&gt;
I now see flows, boundaries, and security layers instead of just “servers.”&lt;/p&gt;

&lt;p&gt;If you're on a similar journey—don’t skip the basics. Get hands-on. Ask why. Test everything.&lt;br&gt;
This is the foundation of everything you’ll build.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>network</category>
      <category>cloudcomputing</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Understanding Listener Rules in AWS: A Beginner-Friendly Guide with Jumia &amp; Temu Examples</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Mon, 21 Apr 2025 08:21:40 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/understanding-listener-rules-in-aws-a-beginner-friendly-guide-with-jumia-temu-examples-26f9</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/understanding-listener-rules-in-aws-a-beginner-friendly-guide-with-jumia-temu-examples-26f9</guid>
      <description>&lt;p&gt;When you visit an e-commerce website like &lt;strong&gt;Jumia or Temu&lt;/strong&gt;, have you ever wondered how your request is processed and directed to the right page? Behind the scenes, services like &lt;strong&gt;AWS Load Balancers **use&lt;/strong&gt; Listener Rules** to determine how to handle user traffic based on conditions such as &lt;strong&gt;URL paths, query strings, and host headers.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we'll break down &lt;strong&gt;listener rules&lt;/strong&gt; in AWS, explain how &lt;strong&gt;query strings&lt;/strong&gt; work, and &lt;strong&gt;use Jumia and Temu&lt;/strong&gt; as real-world examples to make the concept easier to understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What is a Load Balancer?&lt;/strong&gt;&lt;br&gt;
In the last Article, I explained that a **Load Balancer **is a service that distributes incoming traffic across multiple servers to ensure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High availability (&lt;strong&gt;prevents server overload&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;  Scalability (&lt;strong&gt;handles increasing traffic&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;  Fault tolerance (&lt;strong&gt;reroutes requests if a server fails&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, to efficiently route traffic, a **Load Balancer uses Listener Rules **to determine how requests should be processed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. What Are Listener Rules?&lt;/strong&gt;&lt;br&gt;
A** listener** is a component of a load balancer that checks for connection requests using &lt;strong&gt;rules&lt;/strong&gt;. These rules define &lt;strong&gt;condition&lt;/strong&gt;s that determine how traffic should be forwarded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Listener Rule Conditions in AWS:&lt;/strong&gt;&lt;br&gt;
  Condition Type       Example from Jumia/Temu  Use Case&lt;br&gt;
&lt;strong&gt;Path-Based Routing:&lt;/strong&gt; jumia.com.ng/cards or temu.com/fashion  Routes based on specific URL paths&lt;br&gt;
&lt;strong&gt;Host Header:&lt;/strong&gt;    app.jumia.com.ng vs deals.temu.com  Routes based on subdomains&lt;br&gt;
&lt;strong&gt;Query String:&lt;/strong&gt;   jumia.com.ng?category=electronics   Routes based on key-value pairs in the URL&lt;br&gt;
&lt;strong&gt;Source IP:&lt;/strong&gt;  Only allow users from 192.168.x.x   Restricts access based on IP addresses&lt;br&gt;
&lt;strong&gt;HTTP Header:&lt;/strong&gt;    User-Agent: Mobile  Directs mobile users differently&lt;br&gt;
&lt;strong&gt;Request Method:&lt;/strong&gt; GET, POST, PUT, DELETE  Routes requests based on HTTP methods&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Practical Examples with Jumia &amp;amp; Temu&lt;/strong&gt;&lt;br&gt;
Let’s take two real-world scenarios to illustrate how listener rules work:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Path-Based Routing on Jumia&lt;/strong&gt;&lt;br&gt;
Jumia has different sections for users. If you visit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;jumia.com.ng/cards **→ The request is forwarded to **Jumia’s shopping cart service.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;jumia.com.ng/electronics&lt;/strong&gt; → The request is forwarded to &lt;strong&gt;Jumia’s electronics page&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How AWS Listener Rules Handle This:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;load balancer detects the path&lt;/strong&gt; (/cards) in the request.&lt;/li&gt;
&lt;li&gt;If the rule states "&lt;strong&gt;Forward to Target Group A&lt;/strong&gt;", AWS routes the request to a specific set of servers handling the cart system.&lt;/li&gt;
&lt;li&gt;If the rule states "&lt;strong&gt;Redirect to another URL&lt;/strong&gt;", AWS may send users to another page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why This Matters?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Jumia can manage different sections of its site more efficiently.&lt;/li&gt;
&lt;li&gt;Users get a faster and &lt;strong&gt;more optimized experience&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 2: Query String Routing on Temu&lt;/strong&gt;&lt;br&gt;
Some websites personalize content based on &lt;strong&gt;Query Strings&lt;/strong&gt;. If you visit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;temu.com?region=US&lt;/strong&gt; → You see US-specific deals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;temu.com?region=UK&lt;/strong&gt; → You see UK-based deals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How AWS Listener Rules Handle This:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Query String&lt;/strong&gt; (?region=US) is detected in the request.&lt;/li&gt;
&lt;li&gt;The rule &lt;strong&gt;checks the value&lt;/strong&gt; (US or UK).&lt;/li&gt;
&lt;li&gt;The system &lt;strong&gt;routes the user&lt;/strong&gt; to the appropriate localized content.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why This Matters?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Temu can &lt;strong&gt;personalize experiences&lt;/strong&gt; for users based on their region.&lt;/li&gt;
&lt;li&gt;Helps in &lt;strong&gt;localized marketing and promotions.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.Hands-On Guide: Setting Up Listener Rules in AWS&lt;/strong&gt;&lt;br&gt;
Now, let’s create listener rules in AWS using the &lt;strong&gt;AWS Console.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create a Load Balancer&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;AWS Console → EC2 → Load Balancers.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Load Balancer&lt;/strong&gt; → Choose &lt;strong&gt;Application Load Balancer.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Configure the &lt;strong&gt;listener on port 80 (HTTP)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;at least two EC2 instances **as **target groups&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Add Listener Rules&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to** Listener Rules** → &lt;strong&gt;Click Add Rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add Condition&lt;/strong&gt; → Choose one:

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;Path-Based Routing&lt;/strong&gt; → /cards → Forward to &lt;strong&gt;Target Group A&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;** Query String-Based Routing** → ?region=US → Forward to &lt;strong&gt;Target Group B&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Click** Save**.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Test Your Rules&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the &lt;strong&gt;Load Balancer DNS Name&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Open a browser and test:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://your-load-balancer-DNS/cards" rel="noopener noreferrer"&gt;http://your-load-balancer-DNS/cards&lt;/a&gt; → Should redirect as per your rule.&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://your-load-balancer-DNS?region=US" rel="noopener noreferrer"&gt;http://your-load-balancer-DNS?region=US&lt;/a&gt; → Should forward as expected.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.Best Practices for Listener Rules&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use Priorities&lt;/strong&gt; – Rules execute in order, so set priority levels carefully.&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;Avoid Overlapping Rules *&lt;/em&gt;– Ensure each rule has unique conditions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Redirects Wisely&lt;/strong&gt; – Avoid unnecessary redirections that slow down performance.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Optimize Security **– Restrict access using **Source IP rules&lt;/strong&gt; where necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Advanced Hands-On Scenarios for Listener Rules in AWS&lt;/strong&gt;&lt;br&gt;
Now that we’ve covered the basics of listener rules, path-based routing, and query strings, let’s explore more advanced hands-on scenarios to deepen your understanding.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using HTTPS Listeners for Secure Traffic&lt;/strong&gt;
By default, most websites use HTTPS (port 443) to encrypt traffic. AWS Load Balancers allow us to set up an HTTPS listener to handle secure requests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Steps to Configure an HTTPS Listener&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the AWS Console → &lt;strong&gt;Load Balancers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click on your &lt;strong&gt;Application Load Balancer (ALB)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under** Listeners*&lt;em&gt;, **click Add Listener&lt;/em&gt;* → Choose &lt;strong&gt;HTTPS (443).&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attach an SSL/TLS certificate&lt;/strong&gt; (use AWS Certificate Manager if you don’t have one).&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt; and save your listener.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How This Works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When a user visits &lt;strong&gt;&lt;a href="https://yourwebsite.com" rel="noopener noreferrer"&gt;https://yourwebsite.com&lt;/a&gt;,&lt;/strong&gt; traffic is encrypted.&lt;/li&gt;
&lt;li&gt;The ALB terminates SSL and forwards the request securely.&lt;/li&gt;
&lt;li&gt;You can create &lt;strong&gt;rules&lt;/strong&gt; to allow only HTTPS traffic and redirect HTTP to HTTPS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bonus: &lt;strong&gt;Redirect HTTP to HTTPS&lt;/strong&gt;&lt;br&gt;
Add a rule under &lt;strong&gt;Listener Rules&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Condition&lt;/strong&gt;: If a request comes through HTTP (80)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action&lt;/strong&gt;: Redirect to HTTPS (443)
&lt;strong&gt;- Status Code&lt;/strong&gt;: 301 (Permanent Redirect)
&lt;strong&gt;Now all traffic will be securely redirected to HTTPS!&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.** Implementing Custom Error Responses &amp;amp; Redirects**&lt;br&gt;
Instead of displaying a generic &lt;strong&gt;"404 Not Found"&lt;/strong&gt; error when a page doesn’t exist, you can customize error responses using listener rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: Redirecting Users When a Page is Not Found&lt;/strong&gt;&lt;br&gt;
Let’s say a user visits &lt;strong&gt;jumia.com.ng/deals&lt;/strong&gt; but the page is down. Instead of showing an error, we can &lt;strong&gt;redirect them to another page.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Configure a Custom Redirect in AWS ALB&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go to Load Balancer Rules&lt;/strong&gt; → Click &lt;strong&gt;Add Rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a Condition&lt;/strong&gt; → Choose a &lt;strong&gt;Path-based condition&lt;/strong&gt; (e.g., /deals).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set the Action **→ **Choose Redirect&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter the &lt;strong&gt;new URL&lt;/strong&gt; (e.g., &lt;a href="https://jumia.com.ng/promotions" rel="noopener noreferrer"&gt;https://jumia.com.ng/promotions&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Save the rule.
&lt;strong&gt;Now, when users visit&lt;/strong&gt; /deals, &lt;strong&gt;they are automatically redirected to the promotions page instead of seeing an error!&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example: Returning a Custom Error Response&lt;/strong&gt;&lt;br&gt;
Sometimes, you may want to return a fixed response instead of redirecting users.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Condition&lt;/strong&gt;: Path /deals do not exist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action&lt;/strong&gt;: Return Fixed Response → "Sorry, this page is temporarily unavailable. Check back later!"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Status Code&lt;/strong&gt;: 503 (Service Unavailable).
&lt;strong&gt;Now, instead of a default 404 error, users will see a custom message!&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Configuring API Gateway &amp;amp; Lambda with Load Balancers&lt;/strong&gt;&lt;br&gt;
AWS API Gateway and Lambda can be integrated with ALB to create serverless applications that process user requests dynamically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario: Using API Gateway to Route Requests via Load Balancer&lt;/strong&gt;&lt;br&gt;
Imagine Jumia wants to handle customer orders using an API. Instead of directing users to different EC2 instances, we can use API Gateway and Lambda with the Load Balancer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Guide&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create an API in API Gateway&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Go to API Gateway&lt;/strong&gt; → Click &lt;strong&gt;Create API **→ Choose **HTTP API&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set the &lt;strong&gt;Endpoint&lt;/strong&gt; as your** Load Balancer’s DNS name**.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define the paths (e.g., /orders).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a Lambda Function for Handling Orders&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;AWS Lambda&lt;/strong&gt; → Click &lt;strong&gt;Create Function&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Write a function that processes orders:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def lambda_handler(event, context):
    return {
        "statusCode": 200,
        "body": "Order received successfully!"
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deploy the function and integrate it with API Gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Set Up a Listener Rule in ALB&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Condition&lt;/strong&gt;: If the path is /orders.&lt;br&gt;
&lt;strong&gt;Action&lt;/strong&gt;: Forward the request to API &lt;strong&gt;Gateway&lt;/strong&gt; instead of EC2.&lt;br&gt;
&lt;strong&gt;Now, when users visit&lt;/strong&gt; &lt;a href="https://jumia.com.ng/orders" rel="noopener noreferrer"&gt;https://jumia.com.ng/orders&lt;/a&gt;, &lt;strong&gt;the API Gateway will invoke the Lambda function, process the request, and return a response!&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using Priority to Manage Multiple Rules&lt;/strong&gt;
In AWS Load Balancers, rules are evaluated based on priority, meaning:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower priority numbers execute first&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If multiple rules&lt;/strong&gt; match, the one with the lowest number is applied.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example Scenario: Handling Multiple Condition&lt;/strong&gt;s&lt;br&gt;
Let's say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Users visiting &lt;strong&gt;jumia.com.ng/orders&lt;/strong&gt; should be routed to &lt;strong&gt;API Gateway.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Users visiting &lt;strong&gt;jumia.com.ng/deals&lt;/strong&gt; should be redirected to /&lt;strong&gt;promotions.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Users visiting &lt;strong&gt;jumia.com.ng?region=US&lt;/strong&gt; should be sent to &lt;strong&gt;US servers.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Rule Setup in AWS:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Priority    Condition     Action&lt;br&gt;
1           /orders      Forward to &lt;strong&gt;API Gateway&lt;/strong&gt;&lt;br&gt;
2           /deals       Redirect to &lt;strong&gt;/promotions&lt;/strong&gt;&lt;br&gt;
3       ?region=US      Forward to &lt;strong&gt;US-based EC2 servers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Load Balancer will process the rules in order, ensuring correct traffic routing!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
We’ve now explored multiple hands-on scenarios for AWS Listener Rules, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Using HTTPS listeners&lt;/strong&gt; for secure traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implementing custom redirects &amp;amp; error responses&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrating API Gateway &amp;amp; Lambda for dynamic routing&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managing priority for multiple listener rules&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using real-world concepts used in companies like Jumia, Temu, and Amazon to optimize traffic flow and improve user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Difference Between the Beginner and Advanced Hands-On Scenarios for Listener Rules in this article&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The beginner-level explanation of listener rules covered the basic concepts and simple configurations using practical examples like Jumia and Temu. The focus was on:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What &lt;strong&gt;listener rules&lt;/strong&gt; are and why they are important in a &lt;strong&gt;Load Balancer.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Basic conditions&lt;/strong&gt; like &lt;strong&gt;Path-based routing&lt;/strong&gt; and &lt;strong&gt;Query Strings (e.g., /cart → directs traffic to a specific target group).&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Simple &lt;strong&gt;actions&lt;/strong&gt; such as &lt;strong&gt;forwarding traffic, redirecting users, and returning error responses.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Understanding **query strings **and how they affect URL-based routing (?region=US).
This level is good for understanding how requests are processed and routed in a load balancer using basic rule-based conditions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The advanced hands-on scenarios take it further by introducing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Security Enhancements&lt;/strong&gt; – Implementing &lt;strong&gt;HTTPS listeners&lt;/strong&gt; instead of just HTTP for &lt;strong&gt;secure traffic encryption&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Error Responses &amp;amp; Redirects&lt;/strong&gt; – Handling 404 errors dynamically with &lt;strong&gt;custom messages or redirects&lt;/strong&gt; (e.g., if /deals is unavailable, redirect to /promotions).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrating API Gateway &amp;amp; Lambda&lt;/strong&gt; – Instead of routing traffic only to EC2 instances, we invoke serverless APIs dynamically.
4.** Priority-Based Rule Evaluation** – Learning how **AWS processes multiple listener rules **based on priority values.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This level simulates real-world scenarios used in cloud architectures at companies like Jumia, Amazon, and Temu, where security, automation, and flexibility are essential.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Conclusion&lt;/strong&gt;&lt;br&gt;
AWS Listener Rules are powerful tools for controlling traffic flow in a Load Balancer. By using &lt;strong&gt;Path-Based Routing&lt;/strong&gt;, &lt;strong&gt;Query Strings&lt;/strong&gt;, and &lt;strong&gt;Host Headers&lt;/strong&gt;, &lt;strong&gt;businesses like Jumia and Temu&lt;/strong&gt; can efficiently route users to the right pages.&lt;/p&gt;

&lt;p&gt;If you're practicing with &lt;strong&gt;AWS Console&lt;/strong&gt;, try setting up **custom listener rules **and experiment with different conditions. The more hands-on experience you get, the better you'll understand how AWS Load Balancers work!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connecting to an EC2 Instance: A Deep Dive into Session Manager</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Mon, 21 Apr 2025 08:09:52 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/connecting-to-an-ec2-instance-a-deep-dive-into-session-manager-1gbl</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/connecting-to-an-ec2-instance-a-deep-dive-into-session-manager-1gbl</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When working with Amazon EC2 instances, one of the first things you'll need to do is connect to your instance to manage and configure it. There are several different ways to establish a connection. AWS provides multiple ways to achieve this, each with its own advantages and considerations. One commonly used method is Secure Shell (SSH), which requires key pairs. While many are familiar with SSH via PuTTY or the browser-based EC2 Instance Connect, a more secure and centralized option exists: AWS Systems Manager Session Manager.&lt;/p&gt;

&lt;p&gt;In this article, I'll break down the different ways to connect to an EC2 instance, why Session Manager is a game-changer, and how to use it effectively. This is based on my hands-on learning, and I'll make sure to explain the reasoning behind each choice so that both beginners and those interested in cloud deployment can see the depth of understanding involved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Different Ways to Connect to an EC2 Instance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS provides multiple methods to connect to an EC2 instance, and choosing the right one depends on security, ease of use, and the level of management you want. Here are the three primary ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;EC2 Instance Connect (Browser-Based Access)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is the easiest and most direct method.&lt;/li&gt;
&lt;li&gt;Simply click Connect from the AWS Console, and a browser- 
based terminal opens.&lt;/li&gt;
&lt;li&gt;No need for SSH keys or additional configurations.&lt;/li&gt;
&lt;li&gt;However, it's only available for Amazon Linux and Ubuntu 
instances.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;SSH via PuTTY (User-Managed Access)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires downloading PuTTY and configuring it with a &lt;code&gt;.ppk&lt;/code&gt; 
private key.&lt;/li&gt;
&lt;li&gt;The key file is generated from the&lt;code&gt;.pem&lt;/code&gt; key provided when 
launching the instance.&lt;/li&gt;
&lt;li&gt;Requires opening &lt;strong&gt;inbound SSH (port 22)&lt;/strong&gt; in the security 
group, which can expose the instance to attacks if not 
managed properly.&lt;/li&gt;
&lt;li&gt;AWS does not manage PuTTY access—you handle the 
configurations and security yourself.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AWS Systems Manager Session Manager (AWS-Managed Access)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A fully AWS-managed solution.&lt;/li&gt;
&lt;li&gt;No need to open inbound SSH ports, making it more secure.&lt;/li&gt;
&lt;li&gt;Centralized access control using IAM policies.&lt;/li&gt;
&lt;li&gt;Does not require you to manage key pairs.&lt;/li&gt;
&lt;li&gt;Works with instances that have the SSM Agent installed and 
an IAM role with necessary permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What is AWS Session Manager?&lt;/strong&gt;&lt;br&gt;
AWS Session Manager is a feature of AWS Systems Manager (SSM) that enables secure shell access to EC2 instances without requiring an SSH key or opening ports. It leverages IAM roles to grant access and manage permissions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Choose Session Manager?&lt;/strong&gt;&lt;br&gt;
Unlike PuTTY, where AWS does not manage the access or security settings, Session Manager offers a hassle-free and secure way to connect to EC2 instances:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No need for inbound ports&lt;/strong&gt;: Eliminates the risk of unauthorized access through SSH.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM-based access control&lt;/strong&gt;: You can define who has permission to access which instances.
-** Centralized logging**: Session logs can be sent to Amazon S3 or CloudWatch for auditing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bastion host replacement&lt;/strong&gt;: Traditionally, to access private EC2 instances, you’d need a Bastion Host (a publicly accessible instance acting as a gateway). Session Manager removes this requirement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access from anywhere&lt;/strong&gt;: You don’t need to install additional software like PuTTY—just use the AWS Console or AWS CLI.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is a Bastion Host?&lt;/strong&gt;&lt;br&gt;
A Bastion Host is an EC2 instance used as a secure gateway to access other private instances inside a VPC. While effective, it requires proper security configurations and maintenance, unlike Session Manager, which eliminates the need for it entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Set Up Session Manager for EC2&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create an IAM Role for EC2&lt;/strong&gt;
Since Session Manager relies on IAM roles, we must create a role that grants EC2 the necessary permissions.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to &lt;strong&gt;AWS IAM Console&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select Roles &amp;gt; &lt;strong&gt;Create Role&lt;/strong&gt;.For Session Manager to work, the instance needs an IAM role with SSM permissions. Create a role with the following managed policy attached:
AmazonSSMManagedInstanceCore&lt;/li&gt;
&lt;li&gt;Under Trusted entity type, &lt;strong&gt;choose AWS service&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Under Use case, select** EC2** and click Next.&lt;/li&gt;
&lt;li&gt;Attach the policy: &lt;code&gt;AmazonSSMManagedInstanceCore&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click Next, name the role (e.g., SSM_EC2_Access), and create the role.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Attach the IAM Role to Your EC2 Instance&lt;/strong&gt;&lt;br&gt;
If you are launching a new instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the EC2 launch wizard, under Advanced Details, locate IAM 
Instance Profile.&lt;/li&gt;
&lt;li&gt;Select the IAM role (SSM_EC2_Access) created earlier.&lt;/li&gt;
&lt;li&gt;If the instance is already running:&lt;/li&gt;
&lt;li&gt;Navigate to EC2 Console &amp;gt; Instances.&lt;/li&gt;
&lt;li&gt;Select your instance and go to Actions &amp;gt; Security &amp;gt; Modify 
IAM Role.&lt;/li&gt;
&lt;li&gt;Select the SSM_EC2_Access role and save changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ensure SSM Agent is Installed&lt;/strong&gt;&lt;br&gt;
Amazon Linux and Ubuntu AMIs come with SSM Agent pre-installed. If using another OS, install the agent manually:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install -y amazon-ssm-agent  # Amazon Linux
sudo snap install amazon-ssm-agent  # Ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;For Windows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Start-Service AmazonSSMAgent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Connect to the Instance Using Session Manager&lt;/strong&gt;
Once the instance is properly configured:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;AWS Console → EC2 → Select Instance → Click on "Connect"
Select Session Manager → Click "Start session" Or&lt;/li&gt;
&lt;li&gt;Navigate to AWS Systems Manager &amp;gt; Session Manager.&lt;/li&gt;
&lt;li&gt;Click Start session.&lt;/li&gt;
&lt;li&gt;Select the instance and click Start session.&lt;/li&gt;
&lt;li&gt;You now have shell access to the EC2 instance.
Alternatively, use the AWS CLI:&lt;code&gt;aws ssm start-session --target &amp;lt;instance-id&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt;&lt;br&gt;
If you cannot connect using Session Manager, check the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure IAM role is attached to the instance.&lt;/li&gt;
&lt;li&gt;Confirm AmazonSSMManagedInstanceCore policy is included.&lt;/li&gt;
&lt;li&gt;Verify SSM Agent is installed and running. ( Ensure the EC2 Instance Has SSM Agent Installed
Most Amazon Machine Images (AMIs), including Amazon Linux 2 and Ubuntu, come with the SSM Agent pre-installed. To verify, run:&lt;code&gt;sudo systemctl status amazon-ssm-agent&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Make sure the instance has internet access or a VPC endpoint for SSM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Among the different methods of connecting to an EC2 instance, Session Manager stands out as the most secure and managed approach. Unlike PuTTY, where you must handle key configurations and security yourself, AWS manages the entire access process for you. No inbound ports need to be opened, and access is controlled centrally via IAM. If you're looking for a robust and secure way to manage your EC2 instances, Session Manager is the way to go.&lt;/p&gt;

&lt;p&gt;This is part of my hands-on cloud learning journey, and I hope it helps anyone navigating the different ways to connect to an EC2 instance. Let me know if you have any questions or if there's anything you'd like me to explore further!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Infrastructure as Code: Building a Custom Network &amp; EC2 with user data script with Terraform.</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Wed, 16 Apr 2025 00:28:18 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/infrastructure-as-code-building-a-custom-network-ec2-with-user-data-script-with-terraform-33gn</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/infrastructure-as-code-building-a-custom-network-ec2-with-user-data-script-with-terraform-33gn</guid>
      <description>&lt;p&gt;As a Cloud Solution Architect trainee, learning Infrastructure as Code (IaC) became a key priority for scaling and automating cloud environments. This week, I built and deployed a custom &lt;strong&gt;AWS network&lt;/strong&gt; using &lt;strong&gt;Terraform&lt;/strong&gt;—all from my local machine with &lt;strong&gt;VS Code&lt;/strong&gt;. In this post, I’ll walk you through how I created a VPC, public subnet, internet gateway, route table, and launched an EC2 instance that served a static website using a user data script. &lt;/p&gt;

&lt;p&gt;Whether you're just starting with Terraform or need a clear beginner use case, this is a friendly walkthrough of using Terraform and VS Code to launch infrastructure on AWS. Let’s dive in!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Summary&lt;/strong&gt;&lt;br&gt;
I used Terraform to automate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Building a custom VPC&lt;/li&gt;
&lt;li&gt;Creating a public subnet&lt;/li&gt;
&lt;li&gt;Launching an EC2 instance with a user data script&lt;/li&gt;
&lt;li&gt;Hosting a static website with Apache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
Before diving into this project, you should have:&lt;br&gt;
Basic knowledge of AWS services (EC2, VPC, Subnets, Security Groups)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Terraform installed and configured&lt;/li&gt;
&lt;li&gt;AWS CLI installed and configured with IAM credentials&lt;/li&gt;
&lt;li&gt;A code editor like VS Code(with Terraform extension)&lt;/li&gt;
&lt;li&gt;Familiarity with Linux commands&lt;/li&gt;
&lt;li&gt;AWS account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The main components are&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A VPC with public and private subnets&lt;/li&gt;
&lt;li&gt;A Security Group to allow HTTP/SSH access&lt;/li&gt;
&lt;li&gt;An EC2 Instance with Apache and a custom HTML page deployed using user_data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Architecture Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7umwhsvag7vrpvwjhfdc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7umwhsvag7vrpvwjhfdc.png" alt="Architectural view" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Folder Structure&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform-project/
├── main.tf
├── provider.tf
├── user_data.sh
├── terraform.tfstate
├── terraform.lock.hcl

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobwtg4jt6jelj3oj8qse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobwtg4jt6jelj3oj8qse.png" alt="tf file structure" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure AWS provider in provider.&lt;code&gt;tf&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Build resources in main.&lt;code&gt;tf&lt;/code&gt;:
VPC, subnet, IGW, route table, EC2 instance&lt;/li&gt;
&lt;li&gt;Use the user data script in user_data.sh to automate Apache installation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Deploy with:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform init
terraform plan
terraform apply

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Components&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC&lt;/strong&gt;: A custom Virtual Private Cloud to logically isolate my resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnet:&lt;/strong&gt; One subnet within the VPC, configured to host public-facing resources.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internet Gateway (IGW):&lt;/strong&gt; To allow internet access into the VPC.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Table&lt;/strong&gt;: Associated with the subnet to enable traffic routing through the Internet Gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EC2 Instance:&lt;/strong&gt; A virtual machine launched into the subnet, configured via a user data script to automatically install Apache and serve a static website.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How It All Connects&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;VPC&lt;/strong&gt; is the main network boundary.&lt;/li&gt;
&lt;li&gt;Inside it, I created a &lt;strong&gt;public subnet&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;Internet Gateway&lt;/strong&gt; is attached to the &lt;strong&gt;VPC&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Route Table&lt;/strong&gt; is created with a default route (0.0.0.0/0) pointing to the Internet Gateway and associated with the subnet.&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;EC2&lt;/strong&gt; instance is launched in the &lt;strong&gt;public subnet&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;user data script&lt;/strong&gt; runs on the &lt;strong&gt;instance&lt;/strong&gt; at launch, installing Apache and copying my static website files.&lt;/li&gt;
&lt;li&gt;The instance is reachable via its **public IP **because:

&lt;ul&gt;
&lt;li&gt;It’s in a public subnet.&lt;/li&gt;
&lt;li&gt;It has a public IP association enabled.&lt;/li&gt;
&lt;li&gt;The Security Group allows HTTP access on port 80.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Troubleshooting Errors:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawu7134u1h955svbomi8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawu7134u1h955svbomi8.png" alt="Errors" width="800" height="518"&gt;&lt;/a&gt;&lt;br&gt;
I got so many errors from my scripts, but I didn't give up, I kept trying &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0l3vd3h51w9v8erifuc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0l3vd3h51w9v8erifuc.png" alt="user script errors" width="800" height="526"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwt32ckcps7j7wz8sfzg7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwt32ckcps7j7wz8sfzg7.png" alt="tf" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2wgbvfbxuuml780maey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2wgbvfbxuuml780maey.png" alt="Errors fixed" width="800" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I checked the console, and my instance was running. did the same when I built a custom network. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj16v0q90mlho2obdc9jb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj16v0q90mlho2obdc9jb.png" alt="Instance running" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here's the result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkveot0opg5dh1phiqas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkveot0opg5dh1phiqas.png" alt="static website with terraform" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cleaning Up&lt;/strong&gt;&lt;br&gt;
If you want to avoid AWS charges:&lt;br&gt;
&lt;code&gt;terraform destroy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1td2muxdy1xvx0zvozf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm1td2muxdy1xvx0zvozf.png" alt="tf destroy" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Learned&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to set up infrastructure using code&lt;/li&gt;
&lt;li&gt;How to work with user data scripts for automation&lt;/li&gt;
&lt;li&gt;How to break a project into modular files&lt;/li&gt;
&lt;li&gt;How powerful and addictive Infrastructure as Code can be.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What’s Next?&lt;/strong&gt;&lt;br&gt;
I'll expand this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a private subnet.&lt;/li&gt;
&lt;li&gt;Launching EC2 in a private network.&lt;/li&gt;
&lt;li&gt;Creating and associating a NAT Gateway.&lt;/li&gt;
&lt;li&gt;Using Elastic IP for NAT.&lt;/li&gt;
&lt;li&gt;Automating more with modules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
This was my first hands-on Terraform project, and it gave me real insight into the power of infrastructure as code (IaC). Being able to provision a complete environment with a few files and commands felt like magic and was less intimidating.  Every challenge helped me grow, and I can’t wait to complete the rest of the architecture. &lt;br&gt;
If you're just starting, try building a similar setup and share your experience. Feel free to drop questions or thoughts in the comments!"&lt;/p&gt;

&lt;p&gt;Let's Connect&lt;br&gt;
I'm learning Cloud Solutions Architecture and sharing every step.&lt;br&gt;
 Follow me here and on &lt;a href="https://www.linkedin.com/in/glory-ugochukwu-customer-support-speacialist/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/glory-ugochukwu-customer-support-speacialist/&lt;/a&gt; for more beginner-friendly content!&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>aws</category>
      <category>cloud</category>
      <category>webserver</category>
    </item>
    <item>
      <title>Automating Cross-Region Replication in AWS S3 Using Lambda Triggers</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Mon, 14 Apr 2025 00:09:21 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/automating-cross-region-replication-in-aws-s3-using-lambda-triggers-18hk</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/automating-cross-region-replication-in-aws-s3-using-lambda-triggers-18hk</guid>
      <description>&lt;p&gt;When you're storing critical or sensitive data in Amazon S3, relying on a single region isn't always safe. That's where Cross-Region Replication (CRR) comes in—it helps protect your data by automatically copying objects from one region to another. While &lt;strong&gt;Amazon S3&lt;/strong&gt; offers built-in &lt;strong&gt;Cross-Region Replication (CRR)&lt;/strong&gt;, sometimes your use case demands more than just copying data—you may need &lt;strong&gt;custom logic&lt;/strong&gt;, &lt;strong&gt;logging&lt;/strong&gt;, &lt;strong&gt;security validation&lt;/strong&gt;, or &lt;strong&gt;notifications&lt;/strong&gt;. When I was introduced to Cross-Region Replication (CRR) in S3, I thought AWS handled everything internally.&lt;/p&gt;

&lt;p&gt;But then came the question: “What if I want to control that replication manually?” Maybe I want to inject logic, like logging, filtering, integrating with other AWS services, or sending a notification when a file is replicated. That’s where AWS Lambda comes in as a trigger to enable event-based CRR tailored to your needs. &lt;/p&gt;

&lt;p&gt;In this article, I’ll walk you through how to use &lt;strong&gt;AWS Lambda&lt;/strong&gt; as a trigger for cross-region replication of S3 objects. This gives you fine-grained control over what happens when files land in your bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use Lambda with CRR?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;S3 CRR&lt;/strong&gt; is powerful, but it’s also rigid. It works great for general replication. Sometimes you want more control over what gets replicated, when, and how—and Lambda gives you that power. So, if you want to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replicate &lt;em&gt;only&lt;/em&gt; certain file types?&lt;/li&gt;
&lt;li&gt;Filter by tags or extension?&lt;/li&gt;
&lt;li&gt;Perform actions &lt;strong&gt;before&lt;/strong&gt; or &lt;strong&gt;after&lt;/strong&gt; replication?&lt;/li&gt;
&lt;li&gt;Log replication activity or send email alerts?&lt;/li&gt;
&lt;li&gt;Encrypt files or trigger backup workflows?&lt;/li&gt;
&lt;li&gt;Notify admins when CRR happens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s where &lt;strong&gt;Lambda + S3 event notifications&lt;/strong&gt; shine. You can customize your logic with Python or Node.js and scale it on-demand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Use Cases&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Disaster Recovery:&lt;/strong&gt;
Say;
A bank or any company replicates transaction logs from s3://transactions-east to s3://transactions-west using Lambda. This ensures data availability and operational continuity even if a region goes down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compliance &amp;amp;Compliance-Driven Redundancy:&lt;/strong&gt;
Government regulations or Healthcare data may require data to be stored in specific regions. With Lambda, every upload can be monitored and replicated with logs saved in CloudWatch or DynamoDB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media/Content Workflows&lt;/strong&gt;
A media company stores videos in &lt;code&gt;us-east-1&lt;/code&gt; for editing, but automatically pushes final edits to an archival bucket in `us-west-2 ' triggered by uploads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Segmentation &amp;amp; Backup&lt;/strong&gt;
An e-commerce platform might replicate &lt;strong&gt;invoices&lt;/strong&gt;, but skip &lt;strong&gt;raw logs&lt;/strong&gt;—Lambda filters based on filename or tags before replication.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Architecture Overvie&lt;/strong&gt;w&lt;/p&gt;

&lt;p&gt;Here’s what we’ll use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;S3 Bucket (Source)&lt;/strong&gt; – The primary location where files are uploaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3 Bucket (Destination)&lt;/strong&gt; – A bucket in a different AWS region.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda&lt;/strong&gt; – To execute replication logic when a file is uploaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role&lt;/strong&gt; – Permissions for Lambda to access both buckets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3 Event Notification&lt;/strong&gt; – Triggers the Lambda function on file upload&lt;/li&gt;
&lt;li&gt;(Optionally) SNS – again, for visibility.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Steps to Set Up This Function&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt; Create Two Buckets in Different Regions.&lt;br&gt;
  source-bucket: my-crr-source (Region: us-east-1)&lt;br&gt;
  destination-bucket: my-crr-destination (Region: us-west-2)&lt;br&gt;
Make sure &lt;strong&gt;versioning is enabled&lt;/strong&gt; on both.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Source Bucket → Replication Rules → Create Rule&lt;/li&gt;
&lt;li&gt;Choose Destination Bucket&lt;/li&gt;
&lt;li&gt;IAM Role: Allow S3 to replicate objects&lt;/li&gt;
&lt;li&gt;Save the rule&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create IAM Role for Lambda&lt;/strong&gt;
Assign permissions:&lt;/li&gt;
&lt;li&gt;s3:GetObject&lt;/li&gt;
&lt;li&gt;s3:PutObject&lt;/li&gt;
&lt;li&gt;s3:ListBucket&lt;/li&gt;
&lt;li&gt;Trust policy for Lambda.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create an SNS Topic for Email Notification&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to SNS Console → Create Topic&lt;/li&gt;
&lt;li&gt;Topic Name: S3ReplicationNotification&lt;/li&gt;
&lt;li&gt;Type: Standard&lt;/li&gt;
&lt;li&gt;Create a Subscription&lt;/li&gt;
&lt;li&gt;Protocol: Email&lt;/li&gt;
&lt;li&gt;Enter your email address&lt;/li&gt;
&lt;li&gt;Confirm subscription (Check your email for confirmation)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Write Lambda Function&lt;/strong&gt;
Here’s a basic Python code to replicate objects on s3:ObjectCreated:* event:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
import boto3&lt;br&gt;
import os&lt;/p&gt;

&lt;p&gt;s3 = boto3.client('s3')&lt;/p&gt;

&lt;p&gt;DESTINATION_BUCKET = 'destination-bucket-name'&lt;/p&gt;

&lt;p&gt;def lambda_handler(event, context):&lt;br&gt;
    for record in event['Records']:&lt;br&gt;
        src_bucket = record['s3']['bucket']['name']&lt;br&gt;
        key = record['s3']['object']['key']&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    copy_source = {'Bucket': src_bucket, 'Key': key}

    s3.copy_object(
        CopySource=copy_source,
        Bucket=DESTINATION_BUCKET,
        Key=key
    )

return {
    'statusCode': 200,
    'body': f"Replicated {key} to {DESTINATION_BUCKET}"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;br&gt;
Deploy the Lambda Function&lt;/p&gt;

&lt;p&gt;Use the Python boto3 SDK to copy objects from the source to the destination bucket.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Set Up S3 Event Trigger for Lambda&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Lambda → Create Function → Author from Scratch&lt;/li&gt;
&lt;li&gt;Runtime: Python 3.9&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Execution Role: Attach IAM Policy with&lt;br&gt;
&lt;code&gt;AmazonS3FullAccess&lt;/code&gt;&lt;br&gt;
&lt;code&gt;AmazonSNSFullAccess&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Source Bucket → Properties → Event Notifications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create new event notification&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event Name: S3ReplicationTrigger&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event Type: PUT (File Uploads)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Destination: Lambda Function (Select the Lambda function)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Test Your Setup&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Upload a File to source-bucket-us-east-1&lt;/li&gt;
&lt;li&gt;Check Destination Bucket (File should appear there)&lt;/li&gt;
&lt;li&gt;Check Email for replication notification&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;For large files or specific object types, include filters or size checks in the Lambda code.&lt;/li&gt;
&lt;li&gt;Ensure that Lambda has access to both buckets and is deployed in the same region as the source bucket.&lt;/li&gt;
&lt;li&gt;You can extend this by integrating SNS to alert teams when a CRR is performed.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Automating EC2 Shutdown with Lambda, EventBridge &amp; SNS –</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Wed, 09 Apr 2025 00:45:55 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/automating-ec2-shutdown-with-lambda-eventbridge-sns--5g</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/automating-ec2-shutdown-with-lambda-eventbridge-sns--5g</guid>
      <description>&lt;p&gt;In cloud computing, efficiency is everything. Imagine you're managing cloud infrastructure with multiple EC2 instances running. We often deploy EC2 instances for testing, learning, or short-term tasks. Some are used for batch jobs and dev environments. Often, these instances are left running overnight, leading to unnecessary billing. What if you could automate shutting them down—say, every night at 10 PM—and even receive an email confirmation when it happens?&lt;/p&gt;

&lt;p&gt;This article walks through a real-world automation project that uses AWS Lambda, Amazon EventBridge, SNS, and Python to stop an EC2 instance on a schedule—and send an email notification when it's done.&lt;/p&gt;

&lt;p&gt;It's simple, cost-effective, and powerful. And yes, it was part of a real hands-on training session where I executed the entire workflow. Let’s dive in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Automate EC2 Shutdown?&lt;/strong&gt;&lt;br&gt;
In real cloud environments—especially dev or training setups—it's common to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forgot to stop EC2 instances after use.(I have had to pay bills due to forgotten instances running)&lt;/li&gt;
&lt;li&gt;Leave dev/test environments running overnight or over weekends. &lt;/li&gt;
&lt;li&gt;Lose track of idle instances when managing multiple resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Here’s what this automation solves: Real-World Applications &amp;amp; Why It Matters&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cost control&lt;/strong&gt;: Automatically stop dev/test environments after business hours. saving you money. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Management&lt;/strong&gt;: Free up unused compute resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational discipline&lt;/strong&gt;: Prevent unnecessary resource usage and reduce risk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operational Efficiency&lt;/strong&gt;: Reduce manual intervention and human error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;: Shut down public-facing instances during off-hours for added security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Accountability&lt;/strong&gt;: Get notified (via email) every time your automation runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Apply this pattern across environments and projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Use it as part of a broader CI/CD or infrastructure automation strategy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Scenario and Benefits&lt;/strong&gt;&lt;br&gt;
Student or Trainee environments: Avoid surprise AWS bills during self-paced learning.&lt;/p&gt;

&lt;p&gt;Dev/Test teams: Automatically shut down EC2 environments after office hours.&lt;/p&gt;

&lt;p&gt;Cloud Budgets for Startups: Enforce spending discipline without constant human effort.&lt;/p&gt;

&lt;p&gt;CI/CD Pipelines: Tear down staging environments after deployment testing.&lt;/p&gt;

&lt;p&gt;Freelancers/Consultants: Manage client projects efficiently and remotely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Services We’ll Use&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EC2 (Elastic Compute Cloud)&lt;/strong&gt; – the target of the automation (the instance you want to stop).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;IAM (Identity and Access Management)&lt;/strong&gt;– because Lambda needs permissions to stop an EC2 instance, I attached a role with ec2:StopInstances permission.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Lambda&lt;/strong&gt;– the brain of the operation. Serverless compute. where I wrote the Python function to stop the instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EventBridge (formerly CloudWatch Events)&lt;/strong&gt;– this acts like a scheduler. I used this to trigger the Lambda at a specific time or interval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SNS (Simple Notification Service)&lt;/strong&gt; – this one was optional, but I wanted to get a confirmation that “Hey, your instance has been stopped!” without going back into the console. So I used SNS to send an email notification.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What is AWS Lambda?&lt;/strong&gt; AWS Lambda is a serverless computing service where you upload your code, and AWS runs it automatically in response to events. An event-driven infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Implementation&lt;/strong&gt;&lt;br&gt;
Here are the exact steps I followed,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Launch an EC2 Instance:&lt;/strong&gt;
that we want to automatically stop.
Note the &lt;strong&gt;Instance ID&lt;/strong&gt;—you’ll use it in your &lt;strong&gt;Lambda function&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas6b6ducr0l1r382v6iu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fas6b6ducr0l1r382v6iu.png" alt="Instance created" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create an SNS Topic &amp;amp; Email Subscription&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the topic&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Amazon SNS&lt;/strong&gt; &amp;gt;** Topics** &amp;gt; &lt;strong&gt;Create topic&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Standard&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Name: StopEC2Topic.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F849ewabmgbzae7f5103b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F849ewabmgbzae7f5103b.png" alt="Topic created" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an email subscription&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Go to the &lt;strong&gt;topic **&amp;gt; **Create subscription&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; Protocol: &lt;strong&gt;Email&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; Endpoint: Your email address.&lt;/li&gt;
&lt;li&gt; Confirm the subscription from your inbox.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fim9ailo5k3o9s6jhm2ug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fim9ailo5k3o9s6jhm2ug.png" alt="subscription created" width="800" height="333"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5eew94stw4jjsahs9bk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd5eew94stw4jjsahs9bk.png" alt="Email Confirmation" width="800" height="347"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67179ggvtc4ana36895u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F67179ggvtc4ana36895u.png" alt="Subscription confirmed" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create the Lambda Function&lt;/strong&gt;&lt;br&gt;
Go to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AWS Lambda &amp;gt; Create Function&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Name: StopEC2Function&lt;/li&gt;
&lt;li&gt;Runtime: Python 3.9 or any...&lt;/li&gt;
&lt;li&gt;Execution role: Create a new role with &lt;strong&gt;basic Lambda permissions&lt;/strong&gt; or attach the role you created. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfma7xv842qe8nzfsbhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfma7xv842qe8nzfsbhq.png" alt="created lambda function" width="800" height="340"&gt;&lt;/a&gt;&lt;br&gt;
Replace code with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`import boto3

def lambda_handler(event, context):
    ec2 = boto3.client('ec2')
    sns = boto3.client('sns')

    instance_id = 'i-0123456789abcdef0'  # Replace with your Instance ID
    topic_arn = 'arn:aws:sns:region:account-id:StopInstanceTopic'  # Replace with your SNS Topic ARN

    # Stop EC2 instance
    ec2.stop_instances(InstanceIds=[instance_id])

    # Send notification
    message = f"EC2 Instance {instance_id} has been stopped successfully."
    sns.publish(TopicArn=topic_arn, Subject="EC2 Shutdown Notice", Message=message)

    return {
        'statusCode': 200,
        'body': message
    }
`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ilu8sq3o87s3xl57ysd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ilu8sq3o87s3xl57ysd.png" alt="deployed the code" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add Permissions to Lambda Role:&lt;/strong&gt;
** Update IAM Role with Required Permission**&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM &amp;gt; Roles&lt;/strong&gt;, find the role created with Lambda, and attach the following permissions:
AmazonEC2FullAccess
AmazonSNSFullAccess&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alternatively, create a role with these permissions and attach it when creating your Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Create an EventBridge Rule&lt;/strong&gt;&lt;br&gt;
  To schedule the shutdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Amazon EventBridge&lt;/strong&gt; &amp;gt; &lt;strong&gt;Rules&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create rule&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Name: StopEC2Schedule&lt;/li&gt;
&lt;li&gt;Define schedule:Choose cron expression (e.g., cron(0 22 * * ? *) for 10 PM daily)&lt;/li&gt;
&lt;li&gt;Target: Select &lt;strong&gt;Lambda Function&lt;/strong&gt;, then choose the &lt;strong&gt;Lambda&lt;/strong&gt; you created&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkaz7u8d4kma39z5ba9yt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkaz7u8d4kma39z5ba9yt.png" alt="Rule created" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Add EventBridge as a Trigger to Lambda&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go back to your &lt;strong&gt;Lambda function&lt;/strong&gt;:&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Add trigger&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;EventBridge&lt;/strong&gt; (CloudWatch Events)&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;rule&lt;/strong&gt; you just created&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fck0pd10u4ky0n39z8oiw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fck0pd10u4ky0n39z8oiw.png" alt="Added to the function" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6i685ptq342evvfkqxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6i685ptq342evvfkqxr.png" alt="Instance automatically stopped within the scheduled time" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And That’s It!&lt;/strong&gt;&lt;br&gt;
You’ve built a fully automated &lt;strong&gt;EC2 shutdown&lt;/strong&gt; system with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scheduled execution via &lt;strong&gt;EventBridge&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Logic handled in a &lt;strong&gt;Lambda function&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Email alert via &lt;strong&gt;SNS&lt;/strong&gt;
And the best part? You don’t need to keep a server running or manually intervene to execute this logic. It’s 100% serverless and scalable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bonus Tips&lt;/strong&gt;&lt;br&gt;
-You can extend this to start instances in the morning. Say, start instances at 8 AM automatically.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add multiple instance IDs if you need to manage more than one.&lt;/li&gt;
&lt;li&gt;Log actions to CloudWatch for auditing.&lt;/li&gt;
&lt;li&gt;Use Tags to identify instances for stopping (e.g., AutoStop = true).&lt;/li&gt;
&lt;li&gt;Extend this for RDS or S3 lifecycle automation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Cloud Server automation is a powerful superpower. It isn’t just for massive enterprise projects. Even small use cases like this one can save money, reduce errors, and simplify your cloud usage. This is also a great portfolio project for anyone preparing for AWS certifications or roles like Cloud Support Engineer or Solutions Architect.&lt;br&gt;
Try it, customize it, and make it yours.&lt;/p&gt;

&lt;p&gt;By: Glory Ugochukwu – AWS Solution Architect Trainee&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudcomputing</category>
      <category>automation</category>
      <category>startup</category>
    </item>
    <item>
      <title>Building a Scalable E-commerce Backend with DynamoDB, Lambda, API Gateway, and S3.</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Tue, 08 Apr 2025 22:58:44 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/building-a-scalable-e-commerce-backend-with-dynamodb-lambda-api-gateway-and-s3-2i30</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/building-a-scalable-e-commerce-backend-with-dynamodb-lambda-api-gateway-and-s3-2i30</guid>
      <description>&lt;p&gt;&lt;strong&gt;Series: AWS Serverless Projects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today’s digital era, platforms like Amazon, Temu, and Jumia handle billions of requests daily. From browsing products to adding items to a cart and uploading product images—every click requires a responsive, fault-tolerant backend architecture. Each user interaction is powered by various AWS services working in sync.&lt;/p&gt;

&lt;p&gt;In this article, I’ll walk you through how we used &lt;strong&gt;DynamoDB, AWS Lambda, API Gateway, and S3&lt;/strong&gt; to simulate a lightweight backend for an e-commerce application. This was part of my hands-on class project, where we tested our APIs using Postman.&lt;br&gt;
But before jumping into the how-to, let’s understand why and how these services are relevant—and what makes them ideal for real-world use cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DynamoDB: Why DynamoDB for E-commerce?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DynamoDB&lt;/strong&gt; is a serverless, fully managed, NoSQL database service provided by &lt;strong&gt;AWS&lt;/strong&gt;. Now, “Serverless” here doesn’t mean there are no servers—it means the cloud provider (AWS in our case) manages the servers, scalability, and infrastructure. You focus solely on writing business logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding the Data: Structured vs Unstructured and Semi-Structured Data.&lt;/strong&gt;&lt;br&gt;
Before building, let’s talk data. E-commerce platforms like Temu, Amazon, and Jumia deal with both structured and unstructured data:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structured Data&lt;/strong&gt;&lt;br&gt;
Data that fits neatly into Organized tables, rows, and columns (think Excel or SQL tables):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Examples: Users, orders, transactions.&lt;/li&gt;
&lt;li&gt;Where it lives: Can go into RDS (Relational Database Service) like MySQL or PostgreSQL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Unstructured / Semi-structured Data&lt;/strong&gt;&lt;br&gt;
Data that doesn’t follow a strict schema, i.e, doesn’t fit neatly into tables, raw formats. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Examples: Product attributes (color, size, promo details), user reviews,  images, videos, large texts, JSON documents.&lt;/li&gt;
&lt;li&gt;Where it fits: Perfect for DynamoDB—a NoSQL, key-value/document-based database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
In an e-commerce app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use DynamoDB to store product catalog and customer carts in flexible JSON format.&lt;/li&gt;
&lt;li&gt;Use RDS for structured transaction logs and payment history.
&lt;strong&gt;DynamoDB&lt;/strong&gt; is great for semi-structured data because it stores data in key-value and document formats, typically as JSON objects. It thrives in scenarios requiring high-speed access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-world E-commerce Example: Temu, Amazon, Jumia&lt;/strong&gt;&lt;br&gt;
Let’s consider an e-commerce store that sells products online:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Product and Customer Data (Structured)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Each product has a product_id, name, price, category, and Quantity.&lt;/li&gt;
&lt;li&gt;Customer records include user_id, email, and order history.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Product Images (Unstructured)&lt;/strong&gt;
Stored in S3. The connection to the database is made by storing the image URL in DynamoDB. Each file has a key, typically the product ID.

&lt;ul&gt;
&lt;li&gt;Every S3 object also has an ARN (Amazon Resource Name) for resource identification.&lt;/li&gt;
&lt;li&gt;DynamoDB links the image via a URL using the partition key (e.g., product_id).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Product Listings – Semi-structured
Stored in DynamoDB:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "productID": "12345",
  "name": "Laptop",
  "attributes": {
    "RAM": "8GB",
    "Storage": "512GB SSD",
    "Color": "Silver"
  },
  "price": 800
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cart System (Semi-Structured / Temporary)&lt;/strong&gt;
Cart contents change frequently. Storing this temporary data in a persistent database would be costly and inefficient.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Solution: Use Caching&lt;/strong&gt;&lt;br&gt;
AWS ElastiCache (Redis or Memcached) stores temporary cart data in-memory.&lt;br&gt;
This reduces database read/write load and improves performance.&lt;br&gt;
The cart data can be stored using session IDs, keyed against user_id. If a user doesn’t check out, data can be purged automatically after expiry.&lt;/p&gt;

&lt;p&gt;Example DynamoDB JSON Entry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "product_id": "P123",
  "name": "Bluetooth Speaker",
  "price": 4500,
  "category": "Electronics",
  "image_url": "https://s3.amazonaws.com/mybucket/P123.jpg"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How Does S3 Know Which Image Belongs to Which Product?&lt;/strong&gt;&lt;br&gt;
When an image is uploaded to &lt;strong&gt;S3&lt;/strong&gt;, it receives a URL and is stored under a key (often named using a product ID). In &lt;strong&gt;DynamoDB&lt;/strong&gt;, we store the image_url as part of the product record.&lt;br&gt;
The link between the product and its image is made possible using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primary Key or Partition Key (e.g., product_id)&lt;/li&gt;
&lt;li&gt;S3 Object URL&lt;/li&gt;
&lt;li&gt;Unique Identifier (ARN) for every resource&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Caching: Why and How?&lt;/strong&gt;&lt;br&gt;
E-commerce platforms experience spikes in traffic. Caching helps improve speed and reduce load.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ElastiCache (Redis): Fast, in-memory caching engine for 
temporary data like sessions, carts, or search queries.&lt;/li&gt;
&lt;li&gt;Benefits: Reduces repeated database calls, ensures low 
latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Enter ElastiCache&lt;/strong&gt;&lt;br&gt;
**ElastiCache **is an AWS in-memory data store, ideal for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shopping cart data&lt;/li&gt;
&lt;li&gt;User session data&lt;/li&gt;
&lt;li&gt;Product views&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Architecture Overview&lt;/strong&gt;&lt;br&gt;
Let’s break down how we built this in our class using Lambda, API Gateway, DynamoDB, and S3:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Component             Role&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;DynamoDB:&lt;/strong&gt;    Stores products in JSON format&lt;br&gt;
&lt;strong&gt;S3:&lt;/strong&gt;         Hosts images, connected via product ID or URL&lt;br&gt;
&lt;strong&gt;Lambda:&lt;/strong&gt;    Executes code for each API request (e.g., add, update, delete items)&lt;br&gt;
&lt;strong&gt;API Gateway:&lt;/strong&gt;  Provides HTTP endpoints to trigger Lambda.&lt;br&gt;
&lt;strong&gt;Postman:&lt;/strong&gt;   Tests the API endpoints with sample requests&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step (Based on Our Classwork)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create a DynamoDB Table&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Table name: &lt;code&gt;Products&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Partition Key: &lt;code&gt;product_id&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Additional attributes: name, price, category, image_url&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo9ki88936bboe0lligr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo9ki88936bboe0lligr8.png" alt="successfully created DynamoDB" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Upload Product Images to S3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload images with file names like &lt;code&gt;P123.jpg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Make the object publicly accessible (or use pre-signed URLs)&lt;/li&gt;
&lt;li&gt;Note the S3 URL:&lt;code&gt;https://s3.amazonaws.com/mybucket/P123.jpg&lt;/code&gt; for use in DynamoDB&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create Lambda Functions&lt;/strong&gt;&lt;br&gt;
Each function is written in Python (or Node.js) to perform:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;POST: Insert product into DynamoDB&lt;/li&gt;
&lt;li&gt;GET: Retrieve by product ID&lt;/li&gt;
&lt;li&gt;PUT: Update product data&lt;/li&gt;
&lt;li&gt;DELETE: Remove product record
Each function uses Boto3 (Python SDK) to interact with DynamoDB.
When configuring Lambda, go to permissions on the IAM role, attach DynamoDB full access, add your Python code to the Lambda function, and deploy.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdqbbggrcs9nbt6b0y4vj.png" alt="created and deployed lambda function" width="800" height="410"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Set Up API Gateway&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Create REST API&lt;/li&gt;
&lt;li&gt;Define routes: /product, /product/{id}&lt;/li&gt;
&lt;li&gt;Create and Link methods (put, post, get, delete) to respective Lambda functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8ivpjkh3l0j4rlxlym9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk8ivpjkh3l0j4rlxlym9.png" alt="created API" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffznsrznf6s2d6a0bmmwe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffznsrznf6s2d6a0bmmwe.png" alt="API" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vqufhioopegveox1rma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6vqufhioopegveox1rma.png" alt="API resources" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test with Postman&lt;/strong&gt;
Use Postman to send requests and observe live responses.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "product_id": "P123",
  "name": "Bluetooth Speaker",
  "price": 4500,
  "category": "Electronics",
  "image_url": "https://s3.amazonaws.com/mybucket/P123.jpg"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test the GET, PUT, and DELETE endpoints to complete the flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why This Architecture Works in the Real World&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability: All services are fully managed and scale 
automatically.&lt;/li&gt;
&lt;li&gt;Flexibility: DynamoDB's JSON support is perfect for evolving 
product data.&lt;/li&gt;
&lt;li&gt;Low Latency: Lambda + API Gateway = near-instant execution.&lt;/li&gt;
&lt;li&gt;Separation of Concerns: Images are stored in S3, metadata in 
DynamoDB.&lt;/li&gt;
&lt;li&gt;Secure Resource Management: Each AWS resource has an ARN and 
is defined with access via IAM.&lt;/li&gt;
&lt;li&gt;Cost-Effective: Pay only for what you use&lt;/li&gt;
&lt;li&gt;Highly Available: S3 and DynamoDB are designed for 99.99% uptime&lt;/li&gt;
&lt;li&gt;Serverless: No infrastructure management.
Multi-region setups: Use Global Tables in DynamoDB and S3 Cross-Region Replication for high availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
In today’s cloud-driven world, building a robust, serverless, and scalable backend for an e-commerce platform is not only possible but also very practical. This hands-on setup is a mini version of what happens behind the scenes when building e-commerce systems, You don’t just need a database—you need a responsive, modular architecture. DynamoDB, Lambda, S3, and API Gateway form a powerful foundation for a modern, serverless backend. Paired with in-memory services like ElastiCache, this stack supports everything from dynamic product catalogs to blazing-fast cart systems.&lt;br&gt;
Developers can build robust, responsive, and scalable e-commerce applications without managing servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try It Yourself&lt;/strong&gt;&lt;br&gt;
Want to try this architecture?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch a free-tier AWS account.&lt;/li&gt;
&lt;li&gt;Create your API Gateway and Lambda function.&lt;/li&gt;
&lt;li&gt;Connect to DynamoDB.&lt;/li&gt;
&lt;li&gt;Upload a product image to S3 and link its URL in your product item.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m documenting my learning journey, AWS, and Cloud Architecture. If you found this useful, consider following me here on Dev.to&lt;br&gt;
I’ll be sharing more hands-on AWS articles, projects, and architecture breakdowns.&lt;br&gt;
Let’s build in the cloud together!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Load Balancers: Concept, Use Cases &amp; Practical Application.</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Wed, 05 Mar 2025 18:43:32 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/understanding-load-balancers-concept-use-cases-practical-application-3ikl</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/understanding-load-balancers-concept-use-cases-practical-application-3ikl</guid>
      <description>&lt;p&gt;In today's digital landscape, where applications and services must handle millions of requests per second, ensuring availability, reliability, and efficient traffic distribution is crucial. This is where &lt;strong&gt;Load Balancers&lt;/strong&gt; come into play. A &lt;strong&gt;Load Balancer&lt;/strong&gt; acts as an intelligent traffic manager, distributing network or application traffic across multiple servers to optimize resource utilization, maximize throughput, and minimize response time. This article explores the concept, types, functionality, use cases, and a step-by-step approach to setting up a load balancer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a Load Balancer?&lt;/strong&gt;&lt;br&gt;
A &lt;strong&gt;Load Balancer&lt;/strong&gt; is a networking solution that distributes incoming traffic across multiple servers to ensure high availability, scalability, and reliability of applications. It acts as an intermediary between users and backend servers, preventing any single server from becoming overwhelmed. Load Balancers operate at different layers of the &lt;strong&gt;OSI model&lt;/strong&gt;, typically at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Layer 4 (Transport Layer):&lt;/strong&gt; Directs traffic based on IP and TCP/UDP information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 7 (Application Layer):&lt;/strong&gt; Routes traffic based on application-level data (HTTP headers, cookies, etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's break the Network Component of it down first.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Role in Network Traffic Management&lt;/strong&gt;
A load balancer sits between clients and backend servers, acting as an intermediary that routes network traffic efficiently.It ensures that no single server is overwhelmed, improving network performance and reliability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Works at Network Layers&lt;/strong&gt; (OSI Model)as mentioned above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uses Network Protocols&lt;/strong&gt;
Load balancers handle requests using protocols such as TCP, UDP, HTTP, and HTTPS. These protocols are fundamental to how devices communicate over a network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integral Part of Network Infrastructure&lt;/strong&gt;
Load balancers are deployed within a network architecture to ensure high availability, redundancy, and security.
They interact with firewalls, DNS, and backend servers, making them a crucial part of modern network infrastructure.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A load balancer is responsible for directing and managing network traffic at different layers of the OSI model,In AWS, Elastic Load Balancing (ELB) plays this role within a Virtual Private Cloud (VPC) setup, ensuring scalable and fault-tolerant network operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Load Balancers Work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a client makes a request, the Load Balancer:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Receives the request&lt;/strong&gt; – determines the best server to handle it. The Load Balancer acts as an intermediary between users and backend servers.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Distributes the request based on a configured algorithm:&lt;/strong&gt;&lt;br&gt;
-Round Robin: Assigns requests sequentially to servers.&lt;br&gt;
-Least Connections: Directs traffic to the server with the &lt;br&gt;
fewest active connections.&lt;br&gt;
-IP Hashing: Routes users to the same backend based on their IP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performs Health Checks&lt;/strong&gt;: Continuously monitors the health of servers and reroutes traffic if one fails.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Implements SSL/TLS Termination&lt;/strong&gt;: Decrypts HTTPS requests before forwarding them to backend servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Uses Sticky Sessions (Session Persistence)&lt;/strong&gt;: Ensures a user remains connected to the same server when needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Caches Content for Faster Performance&lt;/strong&gt;: In the case of ALB, caching helps improve response time and reduce load.&lt;br&gt;
For instance, global e-commerce marketplaces eg Temu, Jumia, etc use Load Balancers to distribute millions of requests across multiple backend services. During peak shopping seasons, its infrastructure scales dynamically, ensuring fast response times for users worldwide.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why Use a Load Balancer?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;High Availability &amp;amp; Fault Tolerance&lt;/strong&gt; – Automatically redirect traffic if a server becomes unhealthy. I.e If one server fails, traffic is rerouted to healthy servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Performance&lt;/strong&gt; – Balances the workload across multiple instances, reducing response time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt; – Dynamically adjust the number of servers to handle traffic spikes or reduce costs during low demand. As demand increases, additional instances can be added, and the load balancer efficiently manages them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Enhancement&lt;/strong&gt; – Acts as a protective layer, preventing direct access to backend servers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Use Cases of AWS Load Balancers&lt;/strong&gt;&lt;br&gt;
AWS Load Balancers are used in various scenarios, including:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web Applications&lt;/strong&gt;: Distributes HTTP/HTTPS traffic among multiple EC2 instances.&lt;br&gt;
&lt;strong&gt;Database Load Balancing&lt;/strong&gt;: Manages database read/write operations efficiently.&lt;br&gt;
&lt;strong&gt;Auto Scaling Integration&lt;/strong&gt;: Automatically adjusts the number of backend instances based on demand.&lt;br&gt;
&lt;strong&gt;Microservices and Containers&lt;/strong&gt;: Directs traffic between containers in AWS ECS/Kubernetes.&lt;br&gt;
&lt;strong&gt;Security and Compliance&lt;/strong&gt;: Prevents exposure of backend server IPs and protects against DDoS attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of AWS Load Balancers&lt;/strong&gt;&lt;br&gt;
AWS provides three types of Load Balancers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application Load Balancer (ALB)&lt;/strong&gt; – Best for HTTP/HTTPS traffic, Operates at OSI layer 7, the application layer&lt;br&gt;
is used for application architectures and supports advanced routing features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Network Load Balancer (NLB)&lt;/strong&gt; – Best for handling millions of requests per second at low-latency TCP/UDP connections. used for TLS offloading, UDP, and static IP addresses. Operates at OSI layer 4, the transport layer&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Classic Load Balancer (CLB)&lt;/strong&gt;– Operates at OSI layers 3 and 7, the transport and application layers &lt;br&gt;
are used if upgrading to other load balancers is not feasible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Load Balancer Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Listener&lt;/strong&gt;: Defines how the Load Balancer accepts traffic.  (e.g., HTTP, HTTPS, TCP).&lt;br&gt;
&lt;strong&gt;Target Group&lt;/strong&gt;: A collection of registered backend instances.&lt;br&gt;
&lt;strong&gt;Targets&lt;/strong&gt;: EC2 instances, Lambda functions, IP addresses, or containers.&lt;br&gt;
&lt;strong&gt;Rules&lt;/strong&gt;: Control request routing using host-based or path-based rules (for ALB).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Guide to Setting Up an AWS Load Balancer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Launch Two EC2 Instances (check steps and config in my dashboard)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch two EC2 instances with Amazon Linux or Ubuntu.&lt;/li&gt;
&lt;li&gt;Assign them to the same security group.&lt;/li&gt;
&lt;li&gt;Attach a User Data script to install a web server automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example User Data for Instance 1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
sudo yum update -y
sudo yum install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
echo "&amp;lt;h1&amp;gt;Server 1: Load Balancer Demo&amp;lt;/h1&amp;gt;" &amp;gt; /var/www/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example User Data for Instance 2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
sudo yum update -y
sudo yum install -y httpd
sudo systemctl start httpd
sudo systemctl enable httpd
echo "&amp;lt;h1&amp;gt;Server 2: Load Balancer Demo&amp;lt;/h1&amp;gt;" &amp;gt; /var/www/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpo5ob80dv8sm8nes838.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpo5ob80dv8sm8nes838.png" alt="2 instances(servers) created 4 this demo" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Configure Target Group&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9enxpg54jxvjb4l50e0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9enxpg54jxvjb4l50e0.png" alt="Create target group" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Target Groups and create a new one.&lt;/li&gt;
&lt;li&gt;Register the previously launched EC2 instances.&lt;/li&gt;
&lt;li&gt;Define a Health Check path (e.g., /index.html).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F021hr8bqzk7vg7f1qogo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F021hr8bqzk7vg7f1qogo.png" alt="Target group demo" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Create an AWS Load Balancer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to AWS Management Console &amp;gt; EC2 &amp;gt; Load Balancers.&lt;/li&gt;
&lt;li&gt;Choose Application Load Balancer (ALB).&lt;/li&gt;
&lt;li&gt;Set a Listener (HTTP/HTTPS).&lt;/li&gt;
&lt;li&gt;Select at least two availability zones for high availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk92e6df5ztdubwlz7p6v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk92e6df5ztdubwlz7p6v.png" alt="Create load balancer" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuvvxsfqxgz24shf1rj6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuvvxsfqxgz24shf1rj6y.png" alt="load balancer" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Attach the Target Group to the Load Balancer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Listeners in your Load Balancer settings.&lt;/li&gt;
&lt;li&gt;Forward traffic to the Target Group created earlier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5:  Test the Load Balancer&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Review the Load Balancer settings and create it.&lt;/li&gt;
&lt;li&gt;Copy the DNS name of the Load Balancer.&lt;/li&gt;
&lt;li&gt;Open a browser and visit &lt;a href="http://your-load-balancer-dns-name" rel="noopener noreferrer"&gt;http://your-load-balancer-dns-name&lt;/a&gt;, and refresh multiple times to see different responses from the two instances (demonstrating traffic distribution).&lt;/li&gt;
&lt;li&gt;Traffic should alternate between Server 1 and Server 2. Mine read Server 1: Load Balancer Demo, Server 2: Load Balancer Demo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NB: After creating your instances, copy your IP address and test-run your servers. here's mine&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9xpfugbavuxm1mrnz67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv9xpfugbavuxm1mrnz67.png" alt="server 1" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfmnv3jxmyfe9bdcuh93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmfmnv3jxmyfe9bdcuh93.png" alt="server 2" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
then here's my Lb &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxyn1c72fbag742ki7t0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxyn1c72fbag742ki7t0.png" alt="load balancer server1" width="800" height="450"&gt;&lt;/a&gt; refreshed and &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mtaw1o1zun3kc0wi5zb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mtaw1o1zun3kc0wi5zb.png" alt="load balancer server 2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7: Monitor and Optimize&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use AWS CloudWatch to monitor performance metrics.&lt;/li&gt;
&lt;li&gt;Enable Auto Scaling to dynamically adjust instance count.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Health Check &amp;amp; Key Considerations When Creating a Load Balancer in AWS&lt;/strong&gt;&lt;br&gt;
Setting up a Load Balancer (LB) in AWS requires careful configuration to ensure proper traffic distribution, high availability, and fault tolerance. If misconfigured, issues such as unhealthy targets, uneven traffic distribution, or instances not registering can occur. Below are crucial aspects to consider:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Selecting the Right Load Balancer Type&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;AWS provides different types of Load Balancers:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Application Load Balancer (ALB)&lt;/strong&gt; – Best for HTTP/HTTPS traffic, routes based on URLs, headers, or cookies.&lt;br&gt;
&lt;strong&gt;Network Load Balancer (NLB)&lt;/strong&gt; – Best for high-performance TCP/UDP traffic, handles millions of requests per second.&lt;br&gt;
&lt;strong&gt;Classic Load Balancer (CLB)&lt;/strong&gt; – Older generation, supports both HTTP and TCP but lacks advanced features.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Use case example&lt;/em&gt;&lt;/strong&gt;: If you are hosting a website, use an ALB. If handling financial transactions or gaming servers, use an NLB for low latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Configuring the Network Mapping&lt;/strong&gt;&lt;br&gt;
Your Load Balancer and EC2 instances must be properly mapped to ensure smooth communication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC &amp;amp; Subnet Selection&lt;/strong&gt;: The Load Balancer must be deployed in the same VPC as your EC2 instances.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zones (AZs)&lt;/strong&gt;: Distribute instances across multiple AZs to ensure high availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Subnet Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ALB&lt;/strong&gt; requires at least two public subnets in different AZs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NLB&lt;/strong&gt;can work with one or more subnets but benefits from multiple AZs.
If your Load Balancer and instances are in different subnets or AZs, some instances may not receive traffic properly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Security Groups and Firewalls&lt;/strong&gt;&lt;br&gt;
Misconfigured security groups can cause instances to appear unhealthy or fail to receive traffic.&lt;br&gt;
e.g &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F720336rth8lpup9evvnh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F720336rth8lpup9evvnh.png" alt="Unhealthy" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Load Balancer Security Group:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow inbound traffic on port 80 (HTTP) or port 443 (HTTPS).&lt;/li&gt;
&lt;li&gt;Allow requests from anywhere (0.0.0.0/0
) or a specific trusted IP range.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Instance Security Group&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow inbound traffic on the application port (e.g., 80, 443, 8080) from the Load Balancer's security group (not 0.0.0.0/0).&lt;/li&gt;
&lt;li&gt;Allow outbound traffic to the Load Balancer on the same ports.
Incorrect security group rules can cause "unhealthy target" errors, meaning your Load Balancer can't reach your instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Target Group &amp;amp; Health Checks&lt;/strong&gt;&lt;br&gt;
The target group ensures that the Load Balancer correctly forwards traffic to healthy instances.&lt;/p&gt;

&lt;p&gt;From the image below, you can see that my target group initially showed one unhealthy instance out of two total targets. After troubleshooting, I discovered the issue was due to a Subnet and Availability Zone mismatch. I reconfigured the settings, ensuring proper alignment between the load balancer, subnets, and availability zones, which resolved the issue and restored proper functionality.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ydrh653jlfxfjhqy3c4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ydrh653jlfxfjhqy3c4.png" alt="Target group healthcheck" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Target Type&lt;/strong&gt;: Choose "Instance" if routing to EC2 or "IP" for specific IP addresses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Health Check Configuration&lt;/strong&gt;:&lt;br&gt;
&lt;strong&gt;Port &amp;amp; Protocol&lt;/strong&gt;: This should match your instance's application (e.g., HTTP:80).&lt;br&gt;
&lt;strong&gt;Path:&lt;/strong&gt; Default is /, but if your app runs elsewhere (/status, /health), update it.&lt;br&gt;
&lt;strong&gt;Thresholds&lt;/strong&gt;: Set appropriate intervals and success thresholds to determine health status.&lt;br&gt;
If the health check fails, your instance won’t receive traffic! You may need to troubleshoot by checking instance logs or security settings.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. DNS &amp;amp; Domain Name Mapping&lt;/strong&gt;&lt;br&gt;
AWS Load Balancers do not have static IPs (except NLB), so you should use:&lt;/p&gt;

&lt;p&gt;AWS Route 53 to map your domain to the Load Balancer's DNS name.&lt;br&gt;
CNAME Record: If using a custom domain, configure a CNAME to point to the Load Balancer.&lt;br&gt;
If only one instance receives traffic, check whether your DNS resolution points to the correct Load Balancer and if your health checks are correctly configured.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Logging &amp;amp; Monitoring&lt;/strong&gt;&lt;br&gt;
Enable monitoring tools to detect and fix issues early:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS CloudWatch: Monitor request counts, latency, and unhealthy hosts.&lt;/li&gt;
&lt;li&gt;AWS Access Logs: Store detailed logs of incoming requests.&lt;/li&gt;
&lt;li&gt;AWS X-Ray: Helps trace request flow and detect delays.
If your Load Balancer is unresponsive, check CloudWatch metrics to identify traffic spikes, high latency, or instance failures.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Auto Scaling Considerations&lt;/strong&gt;&lt;br&gt;
To handle varying traffic loads, integrate your Load Balancer with Auto Scaling Groups (ASG):&lt;/p&gt;

&lt;p&gt;**ASG **will automatically launch new EC2 instances when traffic increases.&lt;br&gt;
Make sure new instances register with the target group upon creation.&lt;br&gt;
Without auto-scaling, your instances may overload during traffic spikes, causing performance issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Example: Troubleshooting Unhealthy Instances&lt;br&gt;
Problem:&lt;/strong&gt; You noticed only one of your two servers was receiving traffic due to an "unhealthy" target issue.&lt;br&gt;
for instance, only one of my instances was showing,&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3r2r3k4hfx2kr35xb4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3r2r3k4hfx2kr35xb4e.png" alt="1st demo" width="800" height="450"&gt;&lt;/a&gt; because of &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16qb5nyvjejiuiapdmjw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16qb5nyvjejiuiapdmjw.png" alt="unhealthy target group" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Fix:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check Target Group Health:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to EC2 Dashboard → Target Groups → Targets and check the health status.&lt;br&gt;
If an instance is marked unhealthy, hover over it to see the reason.&lt;br&gt;
Verify Health Check Settings:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure the health check path (e.g., /health) returns a 200 OK response.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use curl or a browser to test &lt;a href="http://INSTANCE-IP/health" rel="noopener noreferrer"&gt;http://INSTANCE-IP/health&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check Security Groups &amp;amp; Network ACLs:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure instances allow traffic from the Load Balancer’s security group.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify inbound rules allow traffic on ports 80/443.&lt;br&gt;
Review Subnet &amp;amp; AZ Mappings:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure the Load Balancer and instances are in the same subnets and AZs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If your instance is in us-east-1a, ensure the LB also has a subnet in us-east-1a.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check Instance Application Logs&lt;br&gt;
After troubleshooting, refresh the AWS Console and verify both instances are now receiving traffic.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpjqho6avv2z756exini.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmpjqho6avv2z756exini.png" alt="Healthy target groups" width="800" height="334"&gt;&lt;/a&gt; Both instances are now properly registered and passed health checks. The load balancer should now be distributing traffic evenly between the two targets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93chik8wwzrshn98975g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93chik8wwzrshn98975g.png" alt="server 1" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2qo6tb05s5bdzxeuvybx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2qo6tb05s5bdzxeuvybx.png" alt="server 2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setting up an AWS Load Balancer correctly requires configuring subnets, security groups, health checks, DNS settings, and target groups. If any of these are misconfigured, issues like unhealthy targets, partial traffic distribution, or inaccessible servers may occur. By carefully aligning your Load Balancer with your EC2 instances, you ensure high availability, fault tolerance, and efficient load distribution for your application. &lt;/p&gt;

&lt;p&gt;Benefits of Using AWS Load Balancer for E-commerce Marketplace&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalability – Automatically scales to handle high traffic during shopping events.&lt;/li&gt;
&lt;li&gt;High Availability – Ensures zero downtime by rerouting traffic from unhealthy instances.&lt;/li&gt;
&lt;li&gt;Security – Integrates with AWS Shield and WAF to prevent DDoS attacks.&lt;/li&gt;
&lt;li&gt;Performance Optimization – Reduces latency by routing requests to the closest healthy server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Load Balancers are a crucial component in modern IT infrastructures, Whether you are running a simple web application or a large-scale cloud deployment, implementing a proper Load Balancing strategy is essential for maintaining optimal performance, security, availability, and scalability. Companies like Temu leverage ALB and NLB to distribute massive traffic efficiently, ensuring seamless shopping experiences. By following this practical setup, you can implement load balancing in your AWS environment.&lt;/p&gt;

&lt;p&gt;Criticism and observations are highly welcome! I am still learning and practicing, so please feel free to share your suggestions and feedback on anything you noticed right or wrong in this article to help me improve. Thank you!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cloudcomputing</category>
      <category>aws</category>
      <category>elb</category>
    </item>
    <item>
      <title>Deploying a Secure Static Website Using Amazon S3 and CloudFront.</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Mon, 24 Feb 2025 01:45:23 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/deploying-a-secure-static-website-using-amazon-s3-and-cloudfront-2oml</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/deploying-a-secure-static-website-using-amazon-s3-and-cloudfront-2oml</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7p15gm2o60zbptostbu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7p15gm2o60zbptostbu5.png" alt="Architectural Dragram of S3,CloudFront &amp;amp; Users" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I explained in the last article, Amazon Simple Storage Service (S3) provides scalable and cost-effective static website hosting. However, directly exposing an S3 bucket to the public poses security risks. Instead, we integrate Amazon CloudFront, a global Content Delivery Network (CDN), to serve content securely and efficiently.&lt;/p&gt;

&lt;p&gt;This guide explains the integration between S3 and CloudFront, security best practices, and the correct policy configuration while walking you through the deployment process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Use CloudFront Instead of Public Access in S3?&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;The Security Risk of Making S3 Public&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;S3 allows static website hosting, but enabling public access means anyone on the internet can access the bucket directly. This exposes your website to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Unauthorized access and potential data leaks.&lt;/li&gt;
&lt;li&gt;Higher costs due to unnecessary direct requests to S3.&lt;/li&gt;
&lt;li&gt;No caching, leading to slower performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Best Practice: Use CloudFront as a Secure Proxy&lt;/strong&gt;&lt;br&gt;
CloudFront acts as a &lt;strong&gt;&lt;em&gt;secure intermediary&lt;/em&gt;&lt;/strong&gt; between users and S3, preventing direct access to the S3 bucket. Benefits include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Restricted S3 Access: The S3 bucket is private, and only CloudFront can fetch content.&lt;/li&gt;
&lt;li&gt; Lower Latency: CloudFront caches content at multiple edge locations worldwide, reducing load times.&lt;/li&gt;
&lt;li&gt; Enhanced Security: CloudFront enforces HTTPS, preventing unauthorized traffic.&lt;/li&gt;
&lt;li&gt; Cost Efficiency: Cached requests reduce the number of direct requests to S3, lowering costs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;CloudFront as a Global Service&lt;/strong&gt;&lt;br&gt;
Unlike S3 (a regional service), CloudFront is global, meaning it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Uses edge locations to cache content near users.&lt;/li&gt;
&lt;li&gt; Improves website performance by reducing latency.&lt;/li&gt;
&lt;li&gt; Supports automatic failover, ensuring reliability.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now, let's dive into:&lt;br&gt;
 &lt;strong&gt;Step-by-Step Guide to Deploying with S3 and CloudFront&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the AWS S3 console and create a bucket (e.g., my-secure-static-site) (check my article on S3 to see pictorial steps)&lt;/li&gt;
&lt;li&gt;Block all public access to the bucket (this is crucial).&lt;/li&gt;
&lt;li&gt;Disable static website hosting—we will use CloudFront instead.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why? Keeping the bucket private ensures no one can access it directly. Only CloudFront will serve the content securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Upload Website Files to S3&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the bucket and upload your HTML, CSS, and JS files.&lt;/li&gt;
&lt;li&gt;No need to change permissions—CloudFront will handle access.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Set Up CloudFront Distribution&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to CloudFront Console → Create Distribution.&lt;/li&gt;
&lt;li&gt;Under Origin Domain, select your S3 bucket (not the website endpoint).&lt;/li&gt;
&lt;li&gt;Restrict Bucket Access → Yes.&lt;/li&gt;
&lt;li&gt;Create a New Origin Access Control (OAC).
Why? OAC allows CloudFront to retrieve content from S3 securely without exposing the bucket.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F95xjyopkvvqumh2fhmp8.png" alt="creating CloudFront distribution" width="800" height="331"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foue1kvju2gq1adsixc7p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foue1kvju2gq1adsixc7p.png" alt="Origin Access" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6x8zlosu0h2fosbgdjj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk6x8zlosu0h2fosbgdjj.png" alt="successfully created CloudFront distribution" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Step 4: Attach the Correct Policy to S3&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After creating the distribution, navigate to S3 → Permissions → Bucket Policy.&lt;/li&gt;
&lt;li&gt;Paste the policy from CloudFront, which grants access only to the distribution.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F387dfbdtcxg38ebi1zb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F387dfbdtcxg38ebi1zb9.png" alt="cloudfront policy" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu908zqggkafsfkaz0p7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu908zqggkafsfkaz0p7s.png" alt="cloudfront policy" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Why Use CloudFront’s Policy Instead of a Public S3 Policy?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The bucket remains private—only CloudFront can fetch content.&lt;/li&gt;
&lt;li&gt;Users cannot bypass CloudFront to access files directly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Enable HTTPS and Caching&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Under CloudFront Settings, enable Viewer Protocol Policy → Redirect HTTP to HTTPS.&lt;/li&gt;
&lt;li&gt;Set Cache Behavior to improve performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;HTTPS secures data in transit.&lt;/li&gt;
&lt;li&gt;Caching reduces latency and server load.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Configure a Custom Domain (Optional)&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;If using a custom domain:&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a CNAME in Route 53 (or your DNS provider).&lt;/li&gt;
&lt;li&gt;Request an SSL certificate via AWS Certificate Manager.&lt;/li&gt;
&lt;li&gt;Attach the certificate to CloudFront.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 7: Test and Verify&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open the CloudFront distribution URL.&lt;/li&gt;
&lt;li&gt;Verify that the website loads and redirects to HTTPS. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;my website was HTML so what I did was add /index.html and here's the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosa7in2dsnadrrj5cuu1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fosa7in2dsnadrrj5cuu1.png" alt="My static website sample" width="800" height="349"&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By using I.e integrating CloudFront instead of direct S3 access, we create a secure, fast, and scalable static website hosting solution. CloudFront caches content at edge locations, reducing latency while keeping the S3 bucket private. This approach ensures better performance and cost efficiency while protecting your origin server from excessive requests.&lt;/p&gt;

&lt;p&gt;Feel Free to share your thoughts, Feedback, and observations on my article, I'm still learning and practicing, so your suggestions pointing out mistakes, offering improvements, or highlighting what I did well will greatly help me grow. Thank You! &lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
      <category>cloudfront</category>
      <category>website</category>
    </item>
    <item>
      <title>Hosting a Static Website on S3, Versioning, Lifecycle Configuration, Cross-Region Replication (CRR).</title>
      <dc:creator>Glory Ugochukwu</dc:creator>
      <pubDate>Thu, 20 Feb 2025 17:36:23 +0000</pubDate>
      <link>https://dev.to/glory_ugochukwu_57b6cf663/hosting-a-static-website-on-s3-versioning-lifecycle-configuration-cross-region-replication-crr-4ih8</link>
      <guid>https://dev.to/glory_ugochukwu_57b6cf663/hosting-a-static-website-on-s3-versioning-lifecycle-configuration-cross-region-replication-crr-4ih8</guid>
      <description>&lt;p&gt;&lt;strong&gt;Steps to host a static website on S3 and Necessary features configurations.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's my experience hosting a static website on Amazon S3 and configuring essential features like S3 Versioning, Lifecycle Configuration, and Cross-Region Replication (CRR). These configurations enhance data management, optimize costs, and ensure high availability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brief Summary of S3 before the steps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon S3: (Simple, Storage, Service).The Hard Drive of AWS&lt;/strong&gt; Stores, Retrieve and Scale effortlessly. AWS S3 is a scalable and secure cloud storage solution offered by Amazon Web Services, it allows you to store and retrieve any amount of data, at any time, providing durability, high availability, and low latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hosting Static websites e.g (blogs, product catalogs)&lt;/li&gt;
&lt;li&gt;Backup and recovery.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Hosting a Static Website on S3&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon S3 allows you to host static websites efficiently without managing servers. This is useful for personal portfolios, documentation sites, or company landing pages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Host a Static Website on S3:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create an S3 Bucket&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the AWS S3 Console.&lt;/li&gt;
&lt;li&gt;Click Create Bucket.&lt;/li&gt;
&lt;li&gt;Enter a unique bucket name.&lt;/li&gt;
&lt;li&gt;Turn off "block all block access"&lt;/li&gt;
&lt;li&gt;Enable bucket versioning&lt;/li&gt;
&lt;li&gt;Choose a region and leave the default settings.&lt;/li&gt;
&lt;li&gt;Click Create Bucket.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03h7n3bfb15up6uy0wgs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03h7n3bfb15up6uy0wgs.png" alt="S3 Bucket successful created" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Upload Website Files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the bucket and navigate to the Objects tab.&lt;/li&gt;
&lt;li&gt;Click Upload and add your index.html, error.html, and other necessary files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliydwx0m01b4gq8lu177.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliydwx0m01b4gq8lu177.png" alt="Where to upload your files" width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ezwingvsergk30jfhsd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ezwingvsergk30jfhsd.png" alt="uploading your file" width="800" height="322"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are the files that I uploaded.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdphdh58of85ykgkfqn3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdphdh58of85ykgkfqn3d.png" alt="uploaded files on my S3 bucket" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let's run some configurations. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Enable Static Website Hosting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go to the Properties tab.&lt;br&gt;
Scroll to Static website hosting and click Edit.&lt;br&gt;
Choose Enable.&lt;br&gt;
Set index.html as the Index document.&lt;br&gt;
Click Save Changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwndc9d3izq388n62xjow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwndc9d3izq388n62xjow.png" alt="Enabling Static website property features" width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Set Public Access Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the Permissions tab.&lt;/li&gt;
&lt;li&gt;Click Block Public Access and disable all restrictions.&lt;/li&gt;
&lt;li&gt;Edit the Bucket Policy to allow public access and add your bucket name.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::arn:aws:s3:::aws-s3-glory/*"
            ]
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Click Save Changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Access Your Website&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go back to the Properties tab.&lt;/li&gt;
&lt;li&gt;Copy the Static website hosting endpoint.&lt;/li&gt;
&lt;li&gt;Open it in a browser to see your hosted site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And here's our (my first static website with S3)Website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzihyum37xnbd7hh65d0d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzihyum37xnbd7hh65d0d.png" alt="My first static website with AWS S3" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Versioning &amp;amp; Enabling S3 Versioning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;S3 Versioning allows you to keep multiple versions of an object, preventing accidental deletions or overwrites.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Enable Versioning:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your bucket in the S3 Console.&lt;/li&gt;
&lt;li&gt;Go to the Properties tab.&lt;/li&gt;
&lt;li&gt;Click Edit under Bucket Versioning.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select Enable and click Save Changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Considerations:&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each object version is stored separately, which may increase storage costs.&lt;br&gt;
Suspending versioning stops new versions from being created but retains existing ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lifecycle Management:&lt;/strong&gt;&lt;br&gt;
Transition Action: This enables you to move objects between different storage classes based on a defined schedule. S3 will automatically remove all objects within a bucket when a specified date or time in an object's lifetime&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuring Lifecycle Policies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;S3 Lifecycle Configuration helps you manage object storage by transitioning data to different storage classes or automatically deleting them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Create a Lifecycle Rule:&lt;/strong&gt;&lt;br&gt;
Here's a step-by-step guide on how to implement lifecycle management within your bucket:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to your bucket and choose the "Management" tab.&lt;/li&gt;
&lt;li&gt;Click Create lifecycle rule.&lt;/li&gt;
&lt;li&gt;Enter a rule name and define the scope of its application.&lt;/li&gt;
&lt;li&gt;Configure Transition actions, such as:&lt;/li&gt;
&lt;li&gt;Move objects to S3 Infrequent Access (IA) after 30 days.&lt;/li&gt;
&lt;li&gt;Move objects to Glacier after 90 days.&lt;/li&gt;
&lt;li&gt;Configure Expiration actions, such as deleting objects after a set period.&lt;/li&gt;
&lt;li&gt;Click Create rule.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use Case: Automatically move older website logs to Glacier to save costs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Cross-Region Replication (CRR)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cross-Region Replication ensures your data is automatically copied to another region, improving disaster recovery and availability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Configure CRR:&lt;/strong&gt;&lt;br&gt;
Enable Versioning on both source and destination buckets.&lt;br&gt;
Go to your source bucket’s Management tab.&lt;br&gt;
Click Replication rules &amp;gt; Create replication rule.&lt;br&gt;
Define a rule name and select a destination bucket in a different region.&lt;br&gt;
Select an IAM Role (create a new one if needed).&lt;br&gt;
Click Save Changes.&lt;/p&gt;

&lt;p&gt;Considerations:&lt;br&gt;
Replication applies only to new objects after enabling CRR.&lt;br&gt;
Data transfer and storage costs apply to replicated objects.&lt;/p&gt;

&lt;p&gt;And that's all for my first hands-on on S3. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges Faced &amp;amp; Solutions&lt;/strong&gt; I encountered few challenges while on this,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replication Delays: CRR does not replicate old files. To fix it, I had to re-upload important objects after enabling replication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How This Task Contributes to My Learning &amp;amp; Career Growth&lt;/strong&gt;&lt;br&gt;
Configuring S3 for static website hosting and data management provided me with hands-on experience in cloud storage optimization, cost management, and disaster recovery. These are essential skills for any aspiring Cloud professionals.&lt;/p&gt;

&lt;p&gt;Through this task, I also gained deeper insights into AWS best practices, which will be valuable in enterprise-level cloud deployments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon S3 offers powerful capabilities beyond simple storage. By implementing Versioning, Lifecycle Rules, and CRR, you can enhance data durability, cost efficiency, and high availability.&lt;/p&gt;

&lt;p&gt;I highly recommend experimenting with S3’s configurations. Understanding these features will strengthen your cloud expertise and prepare you for real-world scenarios.&lt;/p&gt;

&lt;p&gt;Happy learning my fellow learners!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
