<?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>Forem: Kamrul Hasan</title>
    <description>The latest articles on Forem by Kamrul Hasan (@khasan2k11).</description>
    <link>https://forem.com/khasan2k11</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%2F3069917%2F85041679-ad05-4b25-922c-8672cd1221fe.png</url>
      <title>Forem: Kamrul Hasan</title>
      <link>https://forem.com/khasan2k11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/khasan2k11"/>
    <language>en</language>
    <item>
      <title>How to Remotely Shut Down All Computers on the Same Network (Windows 11)</title>
      <dc:creator>Kamrul Hasan</dc:creator>
      <pubDate>Thu, 29 Jan 2026 04:34:54 +0000</pubDate>
      <link>https://forem.com/khasan2k11/how-to-remotely-shut-down-all-computers-on-the-same-network-windows-11-4en2</link>
      <guid>https://forem.com/khasan2k11/how-to-remotely-shut-down-all-computers-on-the-same-network-windows-11-4en2</guid>
      <description>&lt;p&gt;Managing multiple computers on the same local network can be challenging—especially when you need to &lt;strong&gt;shut them down remotely&lt;/strong&gt; for maintenance, security, or power saving.&lt;/p&gt;

&lt;p&gt;In this article, I’ll show you &lt;strong&gt;built-in Windows methods&lt;/strong&gt; to remotely shut down multiple Windows 11 computers &lt;strong&gt;without using any third-party tools&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before you begin, ensure the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All computers are on the &lt;strong&gt;same LAN / subnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You have &lt;strong&gt;administrator access&lt;/strong&gt; on target computers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File and Printer Sharing&lt;/strong&gt; is enabled&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windows Firewall&lt;/strong&gt; allows remote administration&lt;/li&gt;
&lt;li&gt;Target computers are &lt;strong&gt;powered on and reachable&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔧 STEP 1: ENABLE REMOTE SHUTDOWN ON ALL PCs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1️⃣ Enable Remote Services
&lt;/h3&gt;

&lt;p&gt;On &lt;strong&gt;each target computer&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press Win + R → type services.msc &lt;/li&gt;
&lt;li&gt;Make sure these services are Running:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Remote Registry&lt;/strong&gt; → Startup type: &lt;code&gt;Automatic&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows Management Instrumentation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Server&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2️⃣ Allow Remote Shutdown in Firewall
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;strong&gt;Windows Defender Firewall&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Allow an app or feature through Windows Defender Firewall&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enable:

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Windows Management Instrumentation (WMI)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remote Service Management&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Make sure they are allowed on &lt;strong&gt;Private networks&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  3️⃣ Allow Remote Shutdown Permission
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;strong&gt;Win + R&lt;/strong&gt;, type &lt;code&gt;secpol.msc&lt;/code&gt;, press &lt;strong&gt;Enter&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to:
&lt;strong&gt;Local Policies → User Rights Assignment&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;Force shutdown from a remote system&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add:

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Administrators&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🧠 STEP 2: FIND COMPUTER NAMES OR IPs
&lt;/h2&gt;

&lt;p&gt;On each PC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hostname
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚀 STEP 3: SHUT DOWN ALL COMPUTERS (FROM ONE PC)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔹Option 1: Shutdown using CMD (one by one)
&lt;/h3&gt;

&lt;p&gt;Open CMD as Administrator on your main PC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shutdown /m \\PC1 /s /f /t 0
shutdown /m \\PC2 /s /f /t 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or using IP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shutdown /m \\192.168.1.10 /s /f /t 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔹 Option 2: Shutdown MULTIPLE PCs at once (BEST)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;code&gt;Win + R&lt;/code&gt; → type:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shutdown /i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Click &lt;strong&gt;Add&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Enter all PC names or IPs&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Shutdown&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;OK&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  ⚠️ COMMON ERRORS &amp;amp; FIX
&lt;/h3&gt;

&lt;h4&gt;
  
  
  ❌ Access is denied (5)
&lt;/h4&gt;

&lt;h4&gt;
  
  
  🔑 1. Use an Administrator Account (Mandatory)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Log in using a &lt;strong&gt;local or domain administrator&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;Command Prompt / PowerShell → Run as Administrator&lt;/strong&gt;
Verify admin:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  🔥 2. Disable UAC Remote Restrictions (CRITICAL)
&lt;/h4&gt;

&lt;p&gt;Windows 10/11 blocks remote admin commands by default.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;target PC&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;reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;👉 &lt;strong&gt;Restart required&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  🌐 4. Enable Required Firewall Rules
&lt;/h4&gt;

&lt;p&gt;On &lt;strong&gt;target PC&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;netsh advfirewall firewall set rule group="Windows Management Instrumentation (WMI)" new enable=yes
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or via GUI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows Defender Firewall&lt;/li&gt;
&lt;li&gt;Allow:

&lt;ul&gt;
&lt;li&gt;WMI&lt;/li&gt;
&lt;li&gt;File and Printer Sharing&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Private network ✔&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  5. Ensure Required Services Are Running
&lt;/h4&gt;

&lt;p&gt;On target PC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services.msc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure these are &lt;strong&gt;Running&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remote Procedure Call (RPC)&lt;/li&gt;
&lt;li&gt;Windows Management Instrumentation&lt;/li&gt;
&lt;li&gt;Server&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  🧪 6. Test Network &amp;amp; Credentials
&lt;/h4&gt;

&lt;p&gt;From your admin PC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping 192.168.173.155
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test admin access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;net use \\192.168.173.155\ipc$ /user:Administrator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;If asked, enter admin password.&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  🚀 7. Try Shutdown Again
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;shutdown /m \\192.168.173.155 /s /f /t 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ This should now work.&lt;/p&gt;

</description>
      <category>windows11</category>
      <category>remoteshutdown</category>
      <category>sysadmin</category>
      <category>techtips</category>
    </item>
    <item>
      <title>EC2 Auto Scaling and Load Balancing on AWS: Step-by-Step Guide</title>
      <dc:creator>Kamrul Hasan</dc:creator>
      <pubDate>Thu, 24 Apr 2025 10:28:05 +0000</pubDate>
      <link>https://forem.com/khasan2k11/ec2-auto-scaling-and-load-balancing-on-aws-step-by-step-guide-2l8p</link>
      <guid>https://forem.com/khasan2k11/ec2-auto-scaling-and-load-balancing-on-aws-step-by-step-guide-2l8p</guid>
      <description>&lt;h2&gt;
  
  
  What is auto scaling?
&lt;/h2&gt;

&lt;p&gt;Auto Scaling is a service offered by Amazon Web Services (AWS) that automatically adjusts the number of instances according to the user's application demand. With auto-scaling, high availability can be achieved for an application without incurring high costs.&lt;/p&gt;

&lt;p&gt;Auto-scaling's elastic feature lets users scale up and down application resources based on predefined criteria like the desired capacity, the minimum capacity, and the maximum capacity. This ultimately helps applications manage user traffic coming to them without disturbing the overall working of the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Load Balancing?
&lt;/h2&gt;

&lt;p&gt;A Load Balancer as the name suggests balances the load coming to an application component. In cloud platforms like Amazon Web Services (AWS), it distributes the incoming network traffic to different multiple servers. The main goal of a load balancer is to improve the availability, scalability, and reliability of applications by fairly distributing network traffic and preventing any one server from becoming overloaded. Therefore, this will improve overall application performance.&lt;/p&gt;

&lt;p&gt;The load balancer is attached to an application in such a way that it faces firstly the network traffic so that it can be able to distribute it efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS account with appropriate permissions&lt;/li&gt;
&lt;li&gt;Basic understanding of EC2 instances&lt;/li&gt;
&lt;li&gt;An existing Amazon Machine Image (AMI) or willingness to create one&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Section 1: Creating the VPC
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Accessing the VPC Dashboard
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Log into AWS&lt;/strong&gt; and navigate to the &lt;strong&gt;VPC Dashboard&lt;/strong&gt; by selecting &lt;strong&gt;Services ➔ VPC&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the left-hand menu, click &lt;strong&gt;Create VPC&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%2F9k9jozwekolevzn12258.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%2F9k9jozwekolevzn12258.png" alt="Creating the VPC" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Configure the VPC
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;On the &lt;strong&gt;Create VPC&lt;/strong&gt; page, select the &lt;strong&gt;VPC and more&lt;/strong&gt; option.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;VPC settings&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name tag auto-generation:&lt;/strong&gt; Enter a name for your VPC (e.g., &lt;code&gt;hasanWebApp&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPv4 CIDR Block:&lt;/strong&gt; Enter &lt;code&gt;10.0.0.0/16&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPv6 CIDR Block:&lt;/strong&gt; Leave this option as defalult &lt;strong&gt;No IPv6 CIDR block&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tenancy:&lt;/strong&gt; Select &lt;strong&gt;Default&lt;/strong&gt; unless dedicated hardware is needed.&lt;/li&gt;
&lt;/ul&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%2Fkimmf535z4fern4kmiii.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%2Fkimmf535z4fern4kmiii.png" alt="Configure the VPC" width="616" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Configure Subnets
&lt;/h2&gt;

&lt;p&gt;Next, you will configure three public subnets, each in a different availability zone for high availability.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Number of Availability Zones (AZs):&lt;/strong&gt; Choose &lt;code&gt;3&lt;/code&gt; to ensure high availability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Number of Public Subnets:&lt;/strong&gt; Enter &lt;code&gt;3&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customize Subnet CIDR Blocks:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public subnet CIDR block in us-east-1a:&lt;/strong&gt; 10.0.10.0/24&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public subnet CIDR block in us-east-1b:&lt;/strong&gt; 10.0.20.0/24&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public subnet CIDR block in us-east-1c:&lt;/strong&gt; 10.0.30.0/24&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT gateways ($):&lt;/strong&gt; Choose &lt;strong&gt;None&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC endpoints:&lt;/strong&gt; Choose &lt;strong&gt;None&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%2F7no9otdy9978e4fqtv0r.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%2F7no9otdy9978e4fqtv0r.png" alt="Subnet Configuration" width="611" height="820"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Configure Additional Resources
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Route Table and Internet Gateway
&lt;/h3&gt;

&lt;p&gt;AWS automatically creates an Internet Gateway and route tables when you use VPC and More. The wizard not only generates the required route table and Internet Gateway for your VPC but also sets up the necessary routes for internet-bound traffic. This ensures that instances on the public subnet can communicate with the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Section 2: Deploying an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;With the VPC setup complete, it's time to launch EC2 instances into one of the public subnets. These instances will serve as web servers for hosting your applications, allowing you to test connectivity and functionality within your newly created VPC.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Launch an EC2 Instance
&lt;/h3&gt;

&lt;p&gt;To launch an EC2 instance, follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name and Tags:&lt;/strong&gt; Assign a meaningful name to your instance (e.g., &lt;code&gt;HasanWebAppServer&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application and OS Images (Amazon Machine Image):&lt;/strong&gt; Choose the &lt;code&gt;Amazon Linux 2023 AMI&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance Type:&lt;/strong&gt; Select &lt;code&gt;t2.micro&lt;/code&gt;, which is free-tier eligible and suitable for testing and small applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key pair (login):&lt;/strong&gt; Key pair is required to securely access your instance via SSH. Choose an existing key pair or create a new one.&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%2F5cotdp67gxz7hrfaex1q.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%2F5cotdp67gxz7hrfaex1q.png" alt="Instance Details" width="800" height="500"&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%2Fwl8pbl6jbssovjh1bj0p.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%2Fwl8pbl6jbssovjh1bj0p.png" alt="Key Pair Setup" width="800" height="282"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Configure Network Settings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Select the VPC you created in the VPC section (e.g., &lt;code&gt;HasanWebApp-vpc&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnet:&lt;/strong&gt; Choose &lt;strong&gt;HasanWebApp-subnet-public1-us-east-1a&lt;/strong&gt; (e.g., &lt;code&gt;10.0.10.0/24&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-assign Public IP:&lt;/strong&gt; Ensure that this option is &lt;strong&gt;enabled&lt;/strong&gt;. This automatically assigns a public IP to the instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Firewall (security groups):&lt;/strong&gt; Create or Choose a existing Security Group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under the Network Settings section, select Create security group.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security group name - required:&lt;/strong&gt; Enter a name for your Security group (e.g., &lt;code&gt;HasanWebAppServer-sg&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inbound Rules:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Allow SSH (Port 22):&lt;/strong&gt; Enables SSH access to your instance. Select &lt;strong&gt;Source type ➔ Anywhere&lt;/strong&gt;. For you can access &lt;code&gt;0.0.0.0/0&lt;/code&gt; to allow from anywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allow HTTP (Port 80):&lt;/strong&gt; Permits web traffic to your server. Select &lt;strong&gt;Source type ➔ Anywhere&lt;/strong&gt;. To Set to &lt;code&gt;0.0.0.0/0&lt;/code&gt; to allow access from the internet.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Outbound Rules:&lt;/strong&gt; By default, the security group allows all outbound traffic. No changes are necessary unless specific outbound restrictions are required.&lt;/p&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%2Faytbtf0pmnx1hq2x2nz1.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%2Faytbtf0pmnx1hq2x2nz1.png" alt="Security Group Setup" width="800" height="253"&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%2Fuy5fom61ltmobzqpl85e.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%2Fuy5fom61ltmobzqpl85e.png" alt="Security Group Setup" width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: User Data Configuration
&lt;/h3&gt;

&lt;p&gt;Add the following User Data script under Advanced Details. This script will automatically install and start the Apache web server when the instance launches:&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
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "&amp;lt;h1&amp;gt;Hi, I am Kamrul Hasan. This is $(hostname -f)&amp;lt;/h1&amp;gt;" &amp;gt; /var/www/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Launch the Instance:
&lt;/h3&gt;

&lt;p&gt;After configuring the above settings, click &lt;strong&gt;Launch Instance&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%2Fjxzrsnz834e13dny4jps.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%2Fjxzrsnz834e13dny4jps.png" alt="Launch Instance" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Testing the EC2 Instance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open a &lt;strong&gt;web browser&lt;/strong&gt; and navigate to the &lt;strong&gt;instance's public IP&lt;/strong&gt;. You should see the message: &lt;code&gt;Hi, I am Kamrul Hasan. This is ip-10-0-10-101.ec2.internal&lt;/code&gt; displayed on the webpage, confirming that Apache is running and serving the HTML file created using the User Data script.&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%2F3to58k3s79zdtxhsmdl2.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%2F3to58k3s79zdtxhsmdl2.png" alt="Testing Web Server" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Section 3: Creating an AMI from Your Running EC2 Instance and Launch Template usig AMI
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Creating an AMI from Your Running EC2 Instance
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Go to &lt;strong&gt;EC2 Dashboard:&lt;/strong&gt; Navigate to Instances and select your running instance.
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1.1. Actions:&lt;/strong&gt; Click on Actions &amp;gt; Image and templates &amp;gt; Create Image.
&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%2Fbt4e71xegmq8gyc9s7c3.png" alt="Creating an AMI" width="800" height="202"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1.2. Image Name:&lt;/strong&gt; Provide a name for your AMI (e.g., HasanWebAppServer-ami).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1.3. Instance Volumes:&lt;/strong&gt; Review the instance storage configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1.4. Create Image:&lt;/strong&gt; Click Create Image to start the process.&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%2F26hwwkbb9cnztkvfk9fb.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%2F26hwwkbb9cnztkvfk9fb.png" alt="Creating an AMI" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a Launch Template
&lt;/h3&gt;

&lt;h4&gt;
  
  
  2. Go to &lt;strong&gt;EC2 Dashboard&lt;/strong&gt; Navigate to &lt;strong&gt;Launch Templates&lt;/strong&gt; and click &lt;strong&gt;Create Launch Template&lt;/strong&gt;.
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2.1 Launch Template Name:&lt;/strong&gt; Enter a name (e.g., &lt;code&gt;HasanWebAppServer-lt&lt;/code&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%2Fj4vsl06pghc8nrp7s59p.png" alt="Launch Template Creation" width="800" height="348"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.2 AMI ID:&lt;/strong&gt; Go to &lt;strong&gt;My AMIs&lt;/strong&gt; and enter the &lt;strong&gt;AMI ID&lt;/strong&gt; you created earlier (&lt;code&gt;HasanWebAppServer-ami&lt;/code&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%2F04zgsuk2slclpwmgwv8c.png" alt="AMI ID Selection" width="800" height="415"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.3 Instance Type:&lt;/strong&gt; Select an &lt;strong&gt;instance type&lt;/strong&gt; (e.g., &lt;code&gt;t2.micro&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.4 Key Pair:&lt;/strong&gt; Choose your existing key pair for SSH access (&lt;code&gt;aws-hasan&lt;/code&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%2Fdh1vqyhtqporzw26gt3e.png" alt="Key Pair Selection" width="800" height="265"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.5 Security Groups:&lt;/strong&gt; Attach the security group created earlier for your EC2 instances (&lt;code&gt;HasanWebAppServer-sg&lt;/code&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%2F8yxmi70kjfzz2v4z5czg.png" alt="Security Group Attachment" width="800" height="277"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.6 Auto-assign Public IP:&lt;/strong&gt; Under Advanced Network Configurations, &lt;strong&gt;enable public IP&lt;/strong&gt; assignment.&lt;/li&gt;
&lt;li&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%2F0yj0ywul232wqafziatw.png" alt="Auto-assign Public IP" width="800" height="458"&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.7 User Data:&lt;/strong&gt; Add the user data for the instances that will be created by the auto scaling group. In this demo we are adding the same user data as our existing webserver.
&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%2F30cvq6uwsmrvxj4mpz41.png" alt="Launch Template User data" width="800" height="407"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2.8 Create Template:&lt;/strong&gt; Click &lt;strong&gt;Create Launch Template&lt;/strong&gt;.
This template will serve as the blueprint for launching instances in your Auto Scaling Group.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Section 4: Setting Up Auto Scaling and Load Balancing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Setting Up Auto Scaling
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step 1: Create a New Target Group
&lt;/h4&gt;

&lt;p&gt;The ALB uses a Target Group to route traffic to specific EC2 instances. Let’s set one up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Choose a target type:&lt;/strong&gt; Select &lt;strong&gt;Instances&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target Group Name:&lt;/strong&gt; Enter a name for the target group (e.g., &lt;code&gt;HasanWebApp-TG&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocol : Port:&lt;/strong&gt; Choose &lt;code&gt;HTTP&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port:&lt;/strong&gt; Enter &lt;code&gt;80&lt;/code&gt; (for HTTP traffic).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Choose the same VPC (&lt;code&gt;HasanWebApp-vpc&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Checks:&lt;/strong&gt; Leave the default settings. The ALB will regularly check the health of your instances to ensure that only healthy instances receive traffic. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Next&lt;/strong&gt; and proceed to add &lt;strong&gt;Register targets&lt;/strong&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%2F4sw4hyspt2unn9bxlnoe.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%2F4sw4hyspt2unn9bxlnoe.png" alt="Configure Target Group" width="800" height="171"&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%2F5ktntw7xvz96t8u70j3k.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%2F5ktntw7xvz96t8u70j3k.png" alt="Configure Target Group" 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%2Faqj6ff0qy06gqkxp79g0.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%2Faqj6ff0qy06gqkxp79g0.png" alt="Configure Target Group" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Register Targets
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Register Existing Instances:&lt;/strong&gt; Manually register your existing &lt;strong&gt;HasanWebAppServer&lt;/strong&gt; EC2 instance. The Auto Scaling Group (ASG) will handle this automatically in the future. Click &lt;strong&gt;Next&lt;/strong&gt; to proceed to registering targets and creating the Target Group.&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%2F8frb9uufb3ys5o8j1k8s.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%2F8frb9uufb3ys5o8j1k8s.png" alt="Registering Existing Instance to Target Grou" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Review and Create
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Review your &lt;strong&gt;Target Group&lt;/strong&gt; configuration.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Target Group&lt;/strong&gt; to finalize the setup.&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%2Fhhmv1iet0t8bggf3i9pb.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%2Fhhmv1iet0t8bggf3i9pb.png" alt="Target Group Dashboard" width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up an Application Load Balancer (ALB)
&lt;/h3&gt;

&lt;p&gt;An ALB is essential for distributing traffic across multiple instances, ensuring that no single instance becomes overwhelmed. Here’s how to set it up:&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Create a New Load Balancer
&lt;/h4&gt;

&lt;p&gt;Click on &lt;strong&gt;Create Load Balancer&lt;/strong&gt; and select &lt;strong&gt;Application Load Balancer&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%2F5u3uryd5go3hwa54zpe4.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%2F5u3uryd5go3hwa54zpe4.png" alt="Create Application Load Balancer" width="800" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: Configure Load Balancer Settings
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; Enter a name for your load balancer (e.g., &lt;code&gt;HasanWebApp-ALB&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheme:&lt;/strong&gt; Choose &lt;strong&gt;Internet-facing&lt;/strong&gt; to make the ALB accessible over the internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IP Address Type:&lt;/strong&gt; Select &lt;code&gt;IPv4&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Choose the VPC you created earlier (e.g., &lt;code&gt;HasanWebApp-vpc&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zones:&lt;/strong&gt; Select the availability zones and subnets where your EC2 instances are deployed (in this case, the three public subnets you created: &lt;code&gt;us-east-1a (use1-az2)&lt;/code&gt;, &lt;code&gt;us-east-1b (use1-az4)&lt;/code&gt;, and &lt;code&gt;us-east-1c (use1-az6&lt;/code&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%2Fj4o0kwz8g0w2bqi99clg.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%2Fj4o0kwz8g0w2bqi99clg.png" alt="Configure Load Balancer Settings" width="800" height="265"&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%2Fg9pettvr1sasak4wmza2.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%2Fg9pettvr1sasak4wmza2.png" alt="Configure Load Balancer Settings" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 3: Configure Security Groups
&lt;/h4&gt;

&lt;p&gt;Select or create a security group for your ALB.&lt;br&gt;
To &lt;strong&gt;click&lt;/strong&gt; create a &lt;strong&gt;new security group&lt;/strong&gt; and following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security group name:&lt;/strong&gt; Enter a name for your Security group (e.g., &lt;code&gt;HasanWebAppServer-alb-sg&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Choose the &lt;strong&gt;VPC&lt;/strong&gt; you created earlier (e.g., &lt;code&gt;HasanWebApp-vpc&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inbound Rules:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Allow HTTP (Port 80):&lt;/strong&gt; Permits web traffic to your server. Select &lt;strong&gt;Source type ➔ Anywhere&lt;/strong&gt;. To Set to &lt;code&gt;0.0.0.0/0&lt;/code&gt; to allow access from the internet.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outbound Rules:&lt;/strong&gt; By default, the security group allows all outbound traffic. No changes are necessary unless specific outbound restrictions are required.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Step 4: Listeners and routing
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Protocol:&lt;/strong&gt; Choose &lt;code&gt;HTTP&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port:&lt;/strong&gt; Enter &lt;code&gt;80&lt;/code&gt;(for HTTP traffic).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Default action:&lt;/strong&gt; Choose the existing Target group (e.g., &lt;code&gt;HasanWebApp-TG&lt;/code&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%2F7p1tlskvyjvmr6s7oceg.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%2F7p1tlskvyjvmr6s7oceg.png" alt="Security Groups" width="800" height="352"&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%2Fjcmcdoxpakb3fvbeoqkw.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%2Fjcmcdoxpakb3fvbeoqkw.png" alt="Listeners and routing" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Section 5: Configuring Auto Scaling Groups (ASG)
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Step 1: Navigate to Auto Scaling
&lt;/h3&gt;

&lt;p&gt;In the AWS Management Console, go to &lt;strong&gt;EC2 Dashboard&lt;/strong&gt;, and on the left-hand menu, under &lt;strong&gt;Auto Scaling&lt;/strong&gt;, click on &lt;strong&gt;Auto Scaling Groups&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 2: Create Auto Scaling Group
&lt;/h3&gt;

&lt;p&gt;Click on Create Auto Scaling Group.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Configure Auto Scaling Group Settings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auto Scaling Group Name:&lt;/strong&gt; Enter a name for the group (e.g., &lt;code&gt;HasanWebApp-ASG&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Launch template:&lt;/strong&gt; Attach the Launch template that created earlier for your Launch Templates.
&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%2F0sgoir84kjvkgo7z6dzh.png" alt="Auto Scaling Group Settings" width="800" height="383"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Step 4: Configure Network Settings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Select your VPC (HasanWebApp-vpc).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subnets:&lt;/strong&gt; Choose the three public subnets you created (&lt;code&gt;us-east-1a&lt;/code&gt;, &lt;code&gt;us-east-1b&lt;/code&gt;, and &lt;code&gt;us-east-1c&lt;/code&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%2Fb6lmka7mwg1vrrgljrfn.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%2Fb6lmka7mwg1vrrgljrfn.png" alt="Auto Scaling Group Network Settings" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 5: Attach the Load Balancer
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Select &lt;strong&gt;Attach to an existing load balancer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Choose from your load balancer target groups&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;Application Load Balancer&lt;/strong&gt; created earlier (HasanWebApp-TG).&lt;/li&gt;
&lt;li&gt;Turn on Elastic Load Balancing health checks.&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%2F0lzk191th1m5mxjldup4.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%2F0lzk191th1m5mxjldup4.png" alt="Attach Load Balancer to Auto Scaling Group" width="800" height="294"&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%2Foohc8yiphmqkt5p5qn76.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%2Foohc8yiphmqkt5p5qn76.png" alt="Attach Load Balancer to Auto Scaling Group" width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 6: Configure Instance Numbers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Desired Capacity:&lt;/strong&gt; Set to &lt;code&gt;2&lt;/code&gt; (this means there will always be at least 1 instances running).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimum Capacity:&lt;/strong&gt; Set to &lt;code&gt;2&lt;/code&gt; (this means the ASG will never terminate the last running instance).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maximum Capacity:&lt;/strong&gt; Set to &lt;code&gt;4&lt;/code&gt; (this allows Auto Scaling to scale up to 4 instances if needed).&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%2Ffpmjfwhdbu8f32cqqizi.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%2Ffpmjfwhdbu8f32cqqizi.png" alt="Configure Instance Numbers" width="800" height="195"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 7: Configure Scaling Policies
&lt;/h3&gt;

&lt;p&gt;Now we’ll configure the scaling policies that will trigger instance creation or termination based on CPU utilization.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Policy Type:&lt;/strong&gt; Choose Target tracking scaling policy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metric type:&lt;/strong&gt; Average CPU utilization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target Value:&lt;/strong&gt; Enter 25% (this means new instances will be launched when average CPU utilization exceeds 25%, and instances will be terminated when it's below 25%). Leave any other setting at default and continue.

&lt;ul&gt;
&lt;li&gt;Under &lt;strong&gt;Additional settings&lt;/strong&gt; Enable default &lt;strong&gt;instance warmup&lt;/strong&gt; of 60s click Next to continue.&lt;/li&gt;
&lt;/ul&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%2Fpgzqc7h68okjv2xjs5re.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%2Fpgzqc7h68okjv2xjs5re.png" alt="Auto Scaling Policies" width="800" height="352"&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%2Fc2qo1hymnsc2xtstjakm.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%2Fc2qo1hymnsc2xtstjakm.png" alt="instance warmup" width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 8: Review and Create
&lt;/h3&gt;

&lt;p&gt;Review the configuration, then click &lt;strong&gt;Create Auto Scaling 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%2Fw2l2xbcvjh0r96x1p1mk.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%2Fw2l2xbcvjh0r96x1p1mk.png" alt="Auto scaling group dashboard" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The ASG will now automatically adjust the number of instances based on CPU utilization and distribute traffic across them using the ALB. We can evaluate this by testing the auto scaling using CPU stress.&lt;/p&gt;
&lt;h2&gt;
  
  
  Section 6: Testing Auto Scaling
&lt;/h2&gt;

&lt;p&gt;To verify that your Auto Scaling setup is functioning correctly, you can simulate high traffic or load on the instances to trigger the creation of new instances.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Connect to an EC2 Instance
&lt;/h3&gt;

&lt;p&gt;SSH into Your EC2 Instance using EC2 Connect or the AWS CLI with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -i /path/to/your-key.pem ec2-user@&amp;lt;Public-IP-of-EC2-Instance&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Install the Stress Tool
&lt;/h3&gt;

&lt;p&gt;Install the stress tool to simulate high CPU load:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install -y stress
&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%2Fum3y763ll5lorbdsehul.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%2Fum3y763ll5lorbdsehul.png" alt="Installing the Stress Tool" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Simulate High CPU Load
&lt;/h3&gt;

&lt;p&gt;Run the stress command to simulate high CPU load for a set period (e.g., 100 seconds):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stress -c 1 -i 1 -m 1 --vm-bytes 128M -t 100s
&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%2F97zqr5ml2u5pht29wa7a.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%2F97zqr5ml2u5pht29wa7a.png" alt="Simulating CPU Load" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command generates CPU load on one core (since t2.micro has just 1 vCPU) for 100 seconds. As a result, the CPU utilization should exceed the 25% threshold set in the Auto Scaling Group (ASG), triggering the ASG to launch new instances to handle the increased load.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Verify Auto Scaling
&lt;/h3&gt;

&lt;p&gt;In this section, we will verify that Auto Scaling is functioning as expected by simulating a CPU load, monitoring the Auto Scaling Group (ASG) activity, and checking the Load Balancer's traffic distribution across instances.&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Monitor Auto Scaling Group Activity
&lt;/h4&gt;

&lt;p&gt;Once you've triggered a high CPU load using the stress tool, Auto Scaling should kick in when the CPU utilization exceeds the threshold of 25%. You can monitor the ASG activity to confirm that new instances are being launched.&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%2Fpxqp58n4n6vfsmnya5gs.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%2Fpxqp58n4n6vfsmnya5gs.png" alt="Auto Scaling Group Activity" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This activity confirms that Auto Scaling is working as intended, scaling the number of instances up in response to increased CPU usage.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Monitor Instance CPU Usage
&lt;/h4&gt;

&lt;p&gt;Next, we can validate the specific CPU spike caused by the stress tool. The CPU usage of the instance will show a spike above 25%, which is what triggered the Auto Scaling.&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%2Fw8my2h0pgez595vb46zp.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%2Fw8my2h0pgez595vb46zp.png" alt="EC2 Instance CPU Monitoring" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This shows that the instance was overloaded, which triggered the ASG to create additional instances.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Verify Load Balancer Traffic Distribution
&lt;/h4&gt;

&lt;p&gt;Open a Web Browser and navigate to the DNS name of your Application Load Balancer (ALB).&lt;br&gt;
Refresh the page multiple times and observe the IP addresses assigned to the different EC2 instances.&lt;br&gt;
You should see the IP address change between two or more instances, confirming that the Load Balancer is properly distributing traffic across multiple servers in the target group.&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%2F9q111q62er4udr4h9hjz.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%2F9q111q62er4udr4h9hjz.png" alt="Load Balancer Distributing Traffic" width="800" height="331"&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%2Fy6hnn9tt05x7secxctsl.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%2Fy6hnn9tt05x7secxctsl.png" alt="Load Balancer Distributing Traffic" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This demonstrates that the Load Balancer is effectively balancing incoming requests across the instances, ensuring high availability.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Terminate Instances and Verify Auto Scaling
&lt;/h4&gt;

&lt;p&gt;To further test the ASG's functionality, you can terminate or stop all running instances and observe how the ASG automatically replaces them to maintain the desired number of instances.&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%2Fhxpqckg6xhyc2ktf9674.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%2Fhxpqckg6xhyc2ktf9674.png" alt="All running Instances manually stopped or Terminated" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This confirms that the ASG is functioning correctly by ensuring that there is always at least one instance running, even if instances are terminated or fail.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>cloud</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
