<?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: Radurga Rajendran</title>
    <description>The latest articles on DEV Community by Radurga Rajendran (@radurga).</description>
    <link>https://dev.to/radurga</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%2F2339706%2F3ffee7b1-86e7-4d99-9160-5c85bb814f7a.png</url>
      <title>DEV Community: Radurga Rajendran</title>
      <link>https://dev.to/radurga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/radurga"/>
    <language>en</language>
    <item>
      <title>Building a Secure Web Application with AWS VPC, RDS, and a Simple Registration Page</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Tue, 31 Dec 2024 09:41:51 +0000</pubDate>
      <link>https://dev.to/radurga/building-a-secure-web-application-with-aws-vpc-rds-and-a-simple-registration-page-248</link>
      <guid>https://dev.to/radurga/building-a-secure-web-application-with-aws-vpc-rds-and-a-simple-registration-page-248</guid>
      <description>&lt;p&gt;Here, we will see how to set up a &lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt; with two subnets: a &lt;strong&gt;public subnet&lt;/strong&gt; to host a web application and a &lt;strong&gt;private subnet&lt;/strong&gt; to host a secure &lt;strong&gt;RDS (Relational Database Service)&lt;/strong&gt; instance. We’ll also build a simple &lt;strong&gt;registration page&lt;/strong&gt; hosted in the public subnet, which will log user input into the RDS instance.&lt;/p&gt;

&lt;p&gt;By the end of this tutorial, you will have a functional web application where user data from a registration form is captured and stored securely in a private RDS instance.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;VPC Setup&lt;/strong&gt;: We will create a &lt;strong&gt;VPC&lt;/strong&gt; with two subnets:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnet&lt;/strong&gt;: Hosts a simple HTML-based registration page with an EC2 instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Subnet&lt;/strong&gt;: Hosts an &lt;strong&gt;RDS&lt;/strong&gt; instance (e.g., MySQL or PostgreSQL) to store registration data.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Application&lt;/strong&gt;: A simple registration page on the public subnet will allow users to input their data (e.g., name, email, and password). When submitted, this data will be logged into the &lt;strong&gt;RDS database&lt;/strong&gt; in the private subnet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The EC2 instance will be in the &lt;strong&gt;public subnet&lt;/strong&gt;, accessible from the internet.&lt;/li&gt;
&lt;li&gt;The RDS instance will reside in the &lt;strong&gt;private subnet&lt;/strong&gt;, isolated from direct public access for security purposes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Routing&lt;/strong&gt;: We will set up appropriate &lt;strong&gt;route tables&lt;/strong&gt; and &lt;strong&gt;security groups&lt;/strong&gt; to ensure the EC2 instance in the public subnet can communicate with the RDS instance in the private subnet, but the RDS instance will not be accessible from the internet.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Create a VPC with Public and Private Subnets&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create the VPC&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the &lt;strong&gt;VPC Console&lt;/strong&gt; in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create VPC&lt;/strong&gt; and enter the details:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CIDR Block&lt;/strong&gt;: &lt;code&gt;10.0.0.0/16&lt;/code&gt; (this is the range of IP addresses your VPC will use).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name&lt;/strong&gt;: Eg:&lt;code&gt;MyVPC&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create Subnets&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnet&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;CIDR Block: &lt;code&gt;10.0.1.0/24&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Name: &lt;code&gt;PublicSubnet&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Availability Zone: Choose an available zone.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Subnet&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;CIDR Block: &lt;code&gt;10.0.2.0/24&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Name: &lt;code&gt;PrivateSubnet&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Availability Zone: Choose a different zone.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create an Internet Gateway (IGW)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;VPC Console&lt;/strong&gt;, create an &lt;strong&gt;Internet Gateway&lt;/strong&gt; and attach it to your VPC.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Update the Route Table for Public Subnet&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create or modify the route table for the &lt;strong&gt;public subnet&lt;/strong&gt; to include a route to the Internet Gateway (&lt;code&gt;0.0.0.0/0&lt;/code&gt; → IGW).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Update the Route Table for Private Subnet&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create or modify the route table for the &lt;strong&gt;private subnet&lt;/strong&gt; to route traffic to the &lt;strong&gt;NAT Gateway&lt;/strong&gt; (for outbound internet access, if needed).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Launch EC2 Instance in Public Subnet for Webpage Hosting&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Launch EC2 Instance&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;EC2 Console&lt;/strong&gt;, and launch a new &lt;strong&gt;EC2 instance&lt;/strong&gt; using an &lt;strong&gt;Ubuntu&lt;/strong&gt; or &lt;strong&gt;Amazon Linux&lt;/strong&gt; AMI.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Public Subnet&lt;/strong&gt; and assign a &lt;strong&gt;public IP&lt;/strong&gt; to the instance.&lt;/li&gt;
&lt;li&gt;Attach a &lt;strong&gt;Security Group&lt;/strong&gt; that allows inbound traffic on HTTP (port 80).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Apache Web Server&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH into your EC2 instance and install Apache:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
 &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create the Registration Page&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In &lt;code&gt;/var/www/html&lt;/code&gt;, create an HTML file for the registration form (e.g., &lt;code&gt;index.html&lt;/code&gt;):
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt; &lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Registration Form&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"/register"&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
       Name: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
       Email: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
       Password: &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"Register"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
 &lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Configure Apache&lt;/strong&gt;:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Edit the Apache config files to ensure the server is serving the HTML page and can handle POST requests. You can use PHP or Python (Flask, Django) for handling backend processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Launch RDS Instance in Private Subnet&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create the RDS Instance&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;RDS Console&lt;/strong&gt;, create a new &lt;strong&gt;MySQL&lt;/strong&gt; or &lt;strong&gt;PostgreSQL&lt;/strong&gt; database instance.&lt;/li&gt;
&lt;li&gt;Ensure the database is &lt;strong&gt;not publicly accessible&lt;/strong&gt; (so it stays secure in the private subnet).&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;Private Subnet&lt;/strong&gt; for deployment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security Groups&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;Security Group&lt;/strong&gt; for the RDS instance that allows inbound traffic on port 3306 (for MySQL) or 5432 (for PostgreSQL) from the &lt;strong&gt;public subnet EC2 instance&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4: Connect the EC2 Web Server to RDS&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install MySQL Client on EC2&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH into your EC2 instance and install the MySQL client:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;mysql-client
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Test Database Connectivity&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test the connection to the RDS instance from the EC2 instance using the database endpoint:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; mysql &lt;span class="nt"&gt;-h&lt;/span&gt; &amp;lt;RDS-endpoint&amp;gt; &lt;span class="nt"&gt;-u&lt;/span&gt; &amp;lt;username&amp;gt; &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create the Database and Table&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once connected, create a database and table to store the registration data:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt; &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;registration_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="n"&gt;USE&lt;/span&gt; &lt;span class="n"&gt;registration_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="n"&gt;AUTO_INCREMENT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
   &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
   &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5: Handle Form Submissions and Store Data in RDS&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Backend Processing&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can use PHP, Python (Flask/Django), or Node.js to handle the form submission.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Example using PHP&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Install PHP and MySQL:
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;php libapache2-mod-php php-mysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; - Create a PHP script to handle the form submission (`register.php`):
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   ```php
   &amp;lt;?php
   if ($_SERVER["REQUEST_METHOD"] == "POST") {
       $name = $_POST['name'];
       $email = $_POST['email'];
       $password = $_POST['password'];
       // Connect to RDS MySQL database
       $conn = new mysqli("&amp;lt;RDS-endpoint&amp;gt;", "&amp;lt;username&amp;gt;", "&amp;lt;password&amp;gt;", "registration_db");
       if ($conn-&amp;gt;connect_error) {
           die("Connection failed: " . $conn-&amp;gt;connect_error);
       }
       // Insert user data into database
       $sql = "INSERT INTO users (name, email, password) VALUES ('$name', '$email', '$password')";
       if ($conn-&amp;gt;query($sql) === TRUE) {
           echo "New record created successfully";
       } else {
           echo "Error: " . $sql . "&amp;lt;br&amp;gt;" . $conn-&amp;gt;error;
       }
       $conn-&amp;gt;close();
   }
   ?&amp;gt;
   ```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; - Place this script in the &lt;code&gt;public_html&lt;/code&gt; directory and configure Apache to serve the form.&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;strong&gt;Step 6: Test the Registration Form&lt;/strong&gt;&lt;br&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Access the Webpage&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a browser and go to the &lt;strong&gt;public IP address&lt;/strong&gt; of the EC2 instance (e.g., &lt;code&gt;http://&amp;lt;EC2-Public-IP&amp;gt;&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Submit the Registration Form&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter a name, email, and password, then submit the form.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Check the &lt;strong&gt;RDS database&lt;/strong&gt; to ensure the data has been correctly inserted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MY OUTPUT:&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%2Fqzr9ajt3rjz7rlayeauo.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%2Fqzr9ajt3rjz7rlayeauo.png" alt="Image description" width="720" height="117"&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%2Fe1kwwbgye205ghyfmut2.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%2Fe1kwwbgye205ghyfmut2.png" alt="Image description" width="324" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By following these steps, we have successfully built a secure and scalable web application on AWS. The EC2 instance in the &lt;strong&gt;public subnet&lt;/strong&gt; hosts the registration page, and the &lt;strong&gt;private subnet&lt;/strong&gt; securely stores user data in an &lt;strong&gt;RDS instance&lt;/strong&gt;. We have ensured security by isolating the RDS instance from public access, using VPC subnets, and configuring appropriate security groups. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Highly Available and Secure Web Application Architecture with VPCs, Load Balancers, and Private Subnets</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Tue, 31 Dec 2024 09:29:39 +0000</pubDate>
      <link>https://dev.to/radurga/building-a-highly-available-and-secure-web-application-architecture-with-vpcs-load-balancers-3had</link>
      <guid>https://dev.to/radurga/building-a-highly-available-and-secure-web-application-architecture-with-vpcs-load-balancers-3had</guid>
      <description>&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. Single VPC with Public and Private Subnets&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In this architecture, we will use a &lt;strong&gt;single VPC&lt;/strong&gt; that consists of both &lt;strong&gt;public and private subnets&lt;/strong&gt;. Each subnet serves different purposes:&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Hosts the &lt;strong&gt;website&lt;/strong&gt; served by EC2 instances.&lt;/li&gt;
&lt;li&gt;The EC2 instances are managed by an &lt;strong&gt;Auto Scaling Group (ASG)&lt;/strong&gt; to ensure high availability and scalability.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Load Balancer (ALB)&lt;/strong&gt; distributes incoming traffic across the EC2 instances.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Hosts an &lt;strong&gt;RDS database&lt;/strong&gt;, which securely stores the data submitted via the website.&lt;/li&gt;
&lt;li&gt;The EC2 instances in the public subnet interact with the RDS instance in the private subnet via a private IP.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;private subnet&lt;/strong&gt; has a &lt;strong&gt;VPC Endpoint&lt;/strong&gt; to access &lt;strong&gt;S3&lt;/strong&gt; securely without traversing the public internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2. Route 53 Integration for Custom Domain Name&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Using &lt;strong&gt;AWS Route 53&lt;/strong&gt;, you can create a &lt;strong&gt;DNS record&lt;/strong&gt; to point to the &lt;strong&gt;Load Balancer's DNS name&lt;/strong&gt;, which allows users to access the website via a custom domain name. This step ensures that your application is accessible from a friendly, branded URL.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;3. Secure S3 Access via VPC Endpoint&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To securely interact with &lt;strong&gt;Amazon S3&lt;/strong&gt; from the EC2 instances in the private subnet, we will use an &lt;strong&gt;S3 VPC Endpoint&lt;/strong&gt;. This VPC endpoint ensures that all traffic between the EC2 instances and S3 happens entirely within the AWS network, avoiding the public internet and enhancing security.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;4. VPC Peering for Inter-VPC Communication&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;In some cases, you may want to establish communication between two VPCs for resource sharing or integration. &lt;strong&gt;VPC Peering&lt;/strong&gt; or &lt;strong&gt;Transit Gateways&lt;/strong&gt; are used to connect different VPCs, ensuring resources in one VPC can communicate with resources in another VPC securely.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Set Up the VPC and Subnets&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a VPC&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;AWS VPC Wizard&lt;/strong&gt; or &lt;strong&gt;AWS Management Console&lt;/strong&gt; to create a VPC with a CIDR block (e.g., &lt;code&gt;10.0.0.0/16&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create Subnets&lt;/strong&gt;:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnet&lt;/strong&gt;: Assign a CIDR block like &lt;code&gt;10.0.1.0/24&lt;/code&gt; to the public subnet. This subnet will host your web servers and load balancer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Subnet&lt;/strong&gt;: Assign a CIDR block like &lt;code&gt;10.0.2.0/24&lt;/code&gt; to the private subnet, where your RDS instances will reside.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Internet Gateway&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Attach an &lt;strong&gt;Internet Gateway&lt;/strong&gt; to the VPC and route traffic from the public subnet to the internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Route Table for Public Subnet&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Ensure that the public subnet has a route to the &lt;strong&gt;Internet Gateway&lt;/strong&gt; so that traffic can flow in and out.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Route Table for Private Subnet&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The private subnet should not have direct internet access. Instead, use a &lt;strong&gt;NAT Gateway&lt;/strong&gt; in the public subnet for outbound internet access from the private subnet, if required.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Set Up the Load Balancer (ALB)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create an Application Load Balancer (ALB)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;EC2 console&lt;/strong&gt;, select &lt;strong&gt;Load Balancers&lt;/strong&gt;, and create an &lt;strong&gt;Application Load Balancer&lt;/strong&gt; (ALB).&lt;/li&gt;
&lt;li&gt;Choose the &lt;strong&gt;public subnet&lt;/strong&gt; to deploy the ALB and configure listeners on port 80 (HTTP) or 443 (HTTPS).&lt;/li&gt;
&lt;li&gt;Assign security groups to the ALB to allow traffic on these ports.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create Target Groups&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create target groups for the ALB that point to your &lt;strong&gt;EC2 instances&lt;/strong&gt; or &lt;strong&gt;Auto Scaling Group&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Add EC2 Instances to the Target Group&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add EC2 instances from the &lt;strong&gt;public subnet&lt;/strong&gt; to the target group for load balancing.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Configure Auto Scaling Group (ASG)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an &lt;strong&gt;Auto Scaling Group&lt;/strong&gt; (ASG) with a launch configuration to automatically scale EC2 instances based on traffic load.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Set Up Amazon RDS in the Private Subnet&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Launch an RDS Instance&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;AWS RDS Console&lt;/strong&gt;, launch a &lt;strong&gt;RDS database instance&lt;/strong&gt; (e.g., MySQL, PostgreSQL) within the &lt;strong&gt;private subnet&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Ensure the RDS instance is &lt;strong&gt;not publicly accessible&lt;/strong&gt;, keeping it secure within the VPC.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connect EC2 to RDS&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure that your EC2 instances in the public subnet can connect to the RDS instance in the private subnet using private IPs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4: Set Up the S3 VPC Endpoint for Secure S3 Access&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a VPC Endpoint for S3&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;VPC Console&lt;/strong&gt;, navigate to &lt;strong&gt;Endpoints&lt;/strong&gt; and create a &lt;strong&gt;Gateway VPC Endpoint&lt;/strong&gt; for &lt;strong&gt;S3&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;private subnet&lt;/strong&gt; and configure the route table to ensure traffic to S3 goes through the VPC endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Configure Security Group and IAM Role&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure your EC2 instances have the necessary &lt;strong&gt;IAM roles&lt;/strong&gt; to access the S3 bucket.&lt;/li&gt;
&lt;li&gt;Attach security groups to allow outbound traffic to the S3 VPC endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5: Set Up Route 53 for Custom Domain&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a Hosted Zone&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Route 53 Console&lt;/strong&gt;, create a hosted zone for your domain (e.g., &lt;code&gt;example.com&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create Record Set for the Load Balancer&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an &lt;strong&gt;A Record&lt;/strong&gt; or &lt;strong&gt;CNAME Record&lt;/strong&gt; pointing to the &lt;strong&gt;DNS name&lt;/strong&gt; of the ALB (e.g., &lt;code&gt;mywebsite-1234567.elb.amazonaws.com&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 6: Set Up VPC Peering (Optional)&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create VPC Peering&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;If you need to connect two VPCs (e.g., for inter-VPC communication), create a &lt;strong&gt;VPC Peering Connection&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Update the route tables in both VPCs to ensure traffic can flow between the peered VPCs.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure Routes&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;In both VPCs, add routes to the &lt;strong&gt;route tables&lt;/strong&gt; that allow traffic to flow between the VPCs via the peering connection.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With the use of &lt;strong&gt;public and private subnets&lt;/strong&gt;, &lt;strong&gt;Auto Scaling Groups&lt;/strong&gt;, &lt;strong&gt;Application Load Balancers&lt;/strong&gt;, and &lt;strong&gt;VPC Endpoints&lt;/strong&gt;, We can build a resilient infrastructure. Integrating &lt;strong&gt;Route 53&lt;/strong&gt; for custom domain management and &lt;strong&gt;VPC Peering&lt;/strong&gt; for inter-VPC communication completes the solution for a fully managed, secure web application architecture on AWS.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Automating RDS Snapshot Management for Daily Testing</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Wed, 18 Dec 2024 06:07:39 +0000</pubDate>
      <link>https://dev.to/radurga/automating-rds-snapshot-management-for-daily-testing-4jpe</link>
      <guid>https://dev.to/radurga/automating-rds-snapshot-management-for-daily-testing-4jpe</guid>
      <description>&lt;p&gt;Creating a snapshot ensures you have a backup of the current RDS state. This snapshot can be used to restore the RDS instance later. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Create a Snapshot via AWS Management Console:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;RDS Dashboard&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Select the RDS instance you want to back up. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Actions&lt;/strong&gt; &amp;gt; &lt;strong&gt;Take Snapshot&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Provide a name for the snapshot (e.g., &lt;code&gt;rds-snapshot-test-date&lt;/code&gt;). &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Take Snapshot&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Automating Snapshot Creation with AWS CLI:&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws rds create-db-snapshot &lt;span class="se"&gt;\&lt;/span&gt;
    --db-snapshot-identifier rds-snapshot-test-date &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier your-rds-instance-id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Use the RDS Instance for Testing&lt;/strong&gt; &lt;br&gt;
Once the snapshot is created, continue using the RDS instance for your testing activities for the day. Ensure you document any changes made during testing, as these will not persist after restoring the instance from the snapshot. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Rename and Delete the RDS Instance&lt;/strong&gt; &lt;br&gt;
At the end of the day, rename the existing RDS instance and delete it to avoid unnecessary costs. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Rename the RDS Instance via AWS Management Console:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;RDS Dashboard&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Select the RDS instance. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Actions&lt;/strong&gt; &amp;gt; &lt;strong&gt;Modify&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Update the &lt;strong&gt;DB Instance Identifier&lt;/strong&gt; (e.g., &lt;code&gt;rds-instance-test-old&lt;/code&gt;). &lt;/li&gt;
&lt;li&gt;Save the changes and wait for the instance to update. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Steps to Delete the RDS Instance:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the renamed instance. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Actions&lt;/strong&gt; &amp;gt; &lt;strong&gt;Delete&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Optionally, skip creating a final snapshot if you already have one. &lt;/li&gt;
&lt;li&gt;Confirm the deletion. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Automating Rename and Delete via AWS CLI:&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Rename the RDS instance&lt;/span&gt;
aws rds modify-db-instance &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier your-rds-instance-id &lt;span class="se"&gt;\&lt;/span&gt;
    --new-db-instance-identifier rds-instance-test-old

&lt;span class="c"&gt;# Delete the RDS instance&lt;/span&gt;
aws rds delete-db-instance &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier rds-instance-test-old &lt;span class="se"&gt;\&lt;/span&gt;
    --skip-final-snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Restore the RDS Instance from the Snapshot&lt;/strong&gt; &lt;br&gt;
Before starting the next day’s testing, restore the RDS instance from the snapshot created earlier. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Restore an RDS Instance via AWS Management Console:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;strong&gt;Snapshots&lt;/strong&gt; section in the &lt;strong&gt;RDS Dashboard&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Select the snapshot you want to restore. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Actions&lt;/strong&gt; &amp;gt; &lt;strong&gt;Restore Snapshot&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Provide a new identifier for the RDS instance (e.g., &lt;code&gt;rds-instance-test&lt;/code&gt;). &lt;/li&gt;
&lt;li&gt;Configure additional settings if needed and click &lt;strong&gt;Restore DB Instance&lt;/strong&gt;. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Automating Restore via AWS CLI:&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws rds restore-db-instance-from-db-snapshot &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier rds-instance-test &lt;span class="se"&gt;\&lt;/span&gt;
    --db-snapshot-identifier rds-snapshot-test-date
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Optional: Automate the Process with a Script&lt;/strong&gt; &lt;br&gt;
To streamline these steps, you can use a script combining AWS CLI commands. Below is an example script:&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# Variables&lt;/span&gt;
&lt;span class="nv"&gt;RDS_INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-rds-instance-id"&lt;/span&gt;
&lt;span class="nv"&gt;SNAPSHOT_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"rds-snapshot-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%F&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;RESTORED_RDS_INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"rds-instance-test"&lt;/span&gt;

&lt;span class="c"&gt;# Step 1: Create a Snapshot&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Creating snapshot..."&lt;/span&gt;
aws rds create-db-snapshot &lt;span class="se"&gt;\&lt;/span&gt;
    --db-snapshot-identifier &lt;span class="nv"&gt;$SNAPSHOT_ID&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier &lt;span class="nv"&gt;$RDS_INSTANCE_ID&lt;/span&gt;

&lt;span class="c"&gt;# Step 2: Rename and Delete RDS Instance&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Renaming and deleting RDS instance..."&lt;/span&gt;
aws rds modify-db-instance &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier &lt;span class="nv"&gt;$RDS_INSTANCE_ID&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    --new-db-instance-identifier &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RDS_INSTANCE_ID&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;-old"&lt;/span&gt;

aws rds delete-db-instance &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RDS_INSTANCE_ID&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;-old"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    --skip-final-snapshot

&lt;span class="c"&gt;# Step 3: Restore RDS from Snapshot&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Restoring RDS instance from snapshot..."&lt;/span&gt;
aws rds restore-db-instance-from-db-snapshot &lt;span class="se"&gt;\&lt;/span&gt;
    --db-instance-identifier &lt;span class="nv"&gt;$RESTORED_RDS_INSTANCE_ID&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    --db-snapshot-identifier &lt;span class="nv"&gt;$SNAPSHOT_ID&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>**Dynamic Scaling with AWS Auto Scaling Groups via Console**</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Mon, 09 Dec 2024 06:00:15 +0000</pubDate>
      <link>https://dev.to/radurga/dynamic-scaling-with-aws-auto-scaling-groups-via-console-5bg1</link>
      <guid>https://dev.to/radurga/dynamic-scaling-with-aws-auto-scaling-groups-via-console-5bg1</guid>
      <description>&lt;p&gt;To configure an Auto Scaling Group (ASG) using the AWS Management Console. Auto Scaling Groups are an essential feature of AWS, allowing you to dynamically scale your EC2 instances based on workload demand. Here, we'll have a clear understanding of creating an ASG, configuring scaling policies, and testing the setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Introduction to Auto Scaling Groups&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;An Auto Scaling Group (ASG) ensures your application has the right number of EC2 instances running at all times. You can define scaling policies based on CloudWatch metrics, such as CPU utilization, to automatically add or remove instances. This provides cost-efficiency and ensures consistent performance.Auto Scaling Groups dynamically adjust EC2 instances based on workload. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Steps to Create an Auto Scaling Group Using the AWS Console&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 1: Create a Launch Template&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Log in to the AWS Management Console&lt;/strong&gt; and navigate to the &lt;strong&gt;EC2 Dashboard&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a Launch Template&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;Launch Templates&lt;/strong&gt; and click &lt;strong&gt;Create Launch Template&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Provide a &lt;strong&gt;Name&lt;/strong&gt; and &lt;strong&gt;Description&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Specify the &lt;strong&gt;AMI ID&lt;/strong&gt; (Amazon Machine Image) for the operating system. For example, use an Ubuntu AMI. &lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;Instance Type&lt;/strong&gt; (e.g., &lt;code&gt;t2.micro&lt;/code&gt;). &lt;/li&gt;
&lt;li&gt;Add your &lt;strong&gt;Key Pair&lt;/strong&gt; for SSH access. &lt;/li&gt;
&lt;li&gt;Configure &lt;strong&gt;Network Settings&lt;/strong&gt; (use the default VPC and a Subnet). &lt;/li&gt;
&lt;li&gt;Leave other settings as default and save the Launch Template. &lt;/li&gt;
&lt;li&gt;Launch Templates simplify EC2 instance configurations for ASG.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2: Create an Auto Scaling Group&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Auto Scaling Groups&lt;/strong&gt; under the EC2 Dashboard. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Click "Create Auto Scaling Group"&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Select Launch Template&lt;/strong&gt;: Choose the Launch Template created in Step 1. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure Group Size and Scaling Policies&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Specify the &lt;strong&gt;Minimum&lt;/strong&gt; size (e.g., 1), &lt;strong&gt;Maximum&lt;/strong&gt; size (e.g., 3), and &lt;strong&gt;Desired Capacity&lt;/strong&gt; (e.g., 1). &lt;/li&gt;
&lt;li&gt;Set scaling policies to increase or decrease capacity automatically. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose Subnets&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Select the Subnets from your VPC where the EC2 instances will run. &lt;/li&gt;
&lt;li&gt;Ensure these Subnets are public if instances need internet access. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Checks&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;EC2 health checks&lt;/strong&gt; to automatically replace unhealthy instances. &lt;/li&gt;
&lt;li&gt;Set a &lt;strong&gt;Health Check Grace Period&lt;/strong&gt; (e.g., 300 seconds). &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review and Create&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Review the settings and click &lt;strong&gt;Create Auto Scaling Group&lt;/strong&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Dynamic Scaling Policies allow automated scaling based on CloudWatch metrics like CPU utilization.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 3: Set Up Scaling Policies&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;In the ASG configuration, choose &lt;strong&gt;Dynamic Scaling Policies&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Add a policy to &lt;strong&gt;scale out&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Set the policy to add 1 instance when CPU utilization exceeds 70%. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a policy to &lt;strong&gt;scale in&lt;/strong&gt;: &lt;/p&gt;
&lt;h2&gt;
  
  
  - Set the policy to remove 1 instance when CPU utilization falls below 30%. 
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Stress Testing the Auto Scaling Group&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To test the Auto Scaling Group, you can simulate high CPU usage on one of the instances. This will trigger the scaling policy and add more instances.Stress testing helps verify that scaling policies are working as expected. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Connect to an Instance&lt;/strong&gt;: &lt;br&gt;
Use your private key to SSH into the instance.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   ssh &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"your-key.pem"&lt;/span&gt; ubuntu@&amp;lt;Instance-IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install Stress Tool&lt;/strong&gt;: 
Update the system and install the &lt;code&gt;stress&lt;/code&gt; tool.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;apt update 
   &lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;stress 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run Stress Test&lt;/strong&gt;: 
Simulate high CPU utilization to trigger the scale-out policy.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   stress &lt;span class="nt"&gt;--cpu&lt;/span&gt; 8 &lt;span class="nt"&gt;--timeout&lt;/span&gt; 600 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Monitor Scaling&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Auto Scaling Groups&lt;/strong&gt; dashboard in the AWS Console. &lt;/li&gt;
&lt;li&gt;Check the &lt;strong&gt;Activity&lt;/strong&gt; tab to observe if new instances are being launched. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;My Output&lt;/strong&gt;
&lt;/h2&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%2F62m5grw10xqv7xhzy3wo.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%2F62m5grw10xqv7xhzy3wo.png" alt="Image description" width="800" height="342"&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%2Fb1j94jci3fpijdkzpxvf.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%2Fb1j94jci3fpijdkzpxvf.png" alt="Image description" width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Configuring Auto Scaling Groups using the AWS Management Console is a straightforward process that enables dynamic scaling of EC2 instances. By following these steps, we can ensure your application is resilient, cost-efficient, and capable of handling varying workloads. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Accessing Multiple Instances via Load Balancer in AWS</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Mon, 09 Dec 2024 05:49:35 +0000</pubDate>
      <link>https://dev.to/radurga/accessing-multiple-instances-via-load-balancer-in-aws-1ehe</link>
      <guid>https://dev.to/radurga/accessing-multiple-instances-via-load-balancer-in-aws-1ehe</guid>
      <description>&lt;p&gt;When deploying scalable applications, distributing traffic efficiently across multiple instances is crucial for performance, fault tolerance, and reliability. AWS provides &lt;strong&gt;Elastic Load Balancing (ELB)&lt;/strong&gt; to simplify this process. Here,we’ll explore the concept of load balancers, target groups, security groups, and subnets, along with a step-by-step process to setting up an &lt;strong&gt;Application Load Balancer (ALB)&lt;/strong&gt; to access multiple instances.&lt;/p&gt;

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

&lt;p&gt;A &lt;strong&gt;Load Balancer&lt;/strong&gt; is a service that distributes incoming application traffic across multiple targets (e.g., EC2 instances) in one or more availability zones. It improves the availability and fault tolerance of your application by ensuring no single instance is overwhelmed by traffic. &lt;br&gt;
AWS supports three types of load balancers: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Application Load Balancer (ALB):&lt;/strong&gt; Works at Layer 7 (HTTP/HTTPS) and is ideal for web applications. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Load Balancer (NLB):&lt;/strong&gt; Operates at Layer 4 (TCP/UDP) for ultra-low latency. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway Load Balancer (GWLB):&lt;/strong&gt; Works at Layer 3 (IP) for distributing traffic to virtual appliances.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Target Groups&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Target Groups are collections of targets (e.g., EC2 instances, IPs) that receive traffic from a load balancer. &lt;/li&gt;
&lt;li&gt;You can define &lt;strong&gt;health checks&lt;/strong&gt; for targets to ensure traffic is routed only to healthy instances. It can Organize and monitor targets (EC2 instances). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Security Groups&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security Groups act as virtual firewalls for your instances and load balancers. &lt;/li&gt;
&lt;li&gt;For the load balancer, inbound rules allow traffic on ports like &lt;strong&gt;80 (HTTP)&lt;/strong&gt; or &lt;strong&gt;443 (HTTPS)&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;For the instances, inbound rules allow traffic only from the load balancer's IP or security group.&lt;/li&gt;
&lt;li&gt;It Protect resources by restricting traffic based on rules. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Subnets&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subnets are segments of a VPC that isolate resources. &lt;/li&gt;
&lt;li&gt;Load balancers require at least two &lt;strong&gt;public subnets&lt;/strong&gt; in different availability zones for high availability. &lt;/li&gt;
&lt;li&gt;EC2 instances are usually deployed in &lt;strong&gt;private subnets&lt;/strong&gt;, accessible only through the load balancer.&lt;/li&gt;
&lt;li&gt;It isolate resources; public subnets for load balancers and private subnets for instances. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Steps to Set Up a Load Balancer for Multiple Instances&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Launch EC2 Instances&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create Two or More EC2 Instances&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Use the AWS Management Console to launch multiple EC2 instances in a VPC. &lt;/li&gt;
&lt;li&gt;Place them in &lt;strong&gt;private subnets&lt;/strong&gt; across two different availability zones. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure Security Groups for Instances&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Allow traffic only from the load balancer's security group on port &lt;strong&gt;80&lt;/strong&gt; (HTTP) or &lt;strong&gt;443&lt;/strong&gt; (HTTPS). &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Target Groups&lt;/strong&gt; in the EC2 section of the console. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Target Group&lt;/strong&gt; and choose &lt;strong&gt;Instances&lt;/strong&gt; as the target type. &lt;/li&gt;
&lt;li&gt;Provide the following configurations: 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Protocol:&lt;/strong&gt; HTTP or HTTPS &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC:&lt;/strong&gt; Select the same VPC as the EC2 instances. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Check Settings:&lt;/strong&gt; Configure health checks (e.g., Path: &lt;code&gt;/&lt;/code&gt; and Port: 80). &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Register the EC2 instances as targets in this group. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Set Up a Load Balancer&lt;/strong&gt; &lt;br&gt;
&lt;strong&gt;Application Load Balancer Configuration:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;strong&gt;Load Balancers&lt;/strong&gt; section of the EC2 console. &lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Load Balancer&lt;/strong&gt; and choose &lt;strong&gt;Application Load Balancer&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Configure the following: 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; Provide a unique name for the load balancer. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheme:&lt;/strong&gt; Select &lt;strong&gt;Internet-facing&lt;/strong&gt; for public access. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Listeners:&lt;/strong&gt; Use port &lt;strong&gt;80&lt;/strong&gt; or &lt;strong&gt;443&lt;/strong&gt; (for HTTPS). &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Availability Zones:&lt;/strong&gt; Select public subnets from at least two availability zones. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;In the &lt;strong&gt;Listener and Rules&lt;/strong&gt; section, forward traffic to the target group created earlier. &lt;/li&gt;
&lt;li&gt;Save and create the load balancer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Update Security Groups&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;For the Load Balancer:

&lt;ul&gt;
&lt;li&gt;Allow inbound traffic on port &lt;strong&gt;80&lt;/strong&gt; or &lt;strong&gt;443&lt;/strong&gt; (if HTTPS). &lt;/li&gt;
&lt;li&gt;Allow inbound traffic from all IPs (or restrict by source). &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;For EC2 Instances: 

&lt;ul&gt;
&lt;li&gt;Allow inbound traffic from the load balancer's security group. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Test the Setup&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get the &lt;strong&gt;DNS name&lt;/strong&gt; of the load balancer from the AWS console. &lt;/li&gt;
&lt;li&gt;Access the DNS name in your browser to verify traffic is being distributed to your instances. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step:7 Scaling with Auto Scaling Groups&lt;/strong&gt; &lt;br&gt;
Attach an Auto Scaling Group (ASG) to the target group for dynamic scaling based on traffic demand.&lt;/p&gt;

&lt;p&gt;To access multiple EC2 instances via a load balancer in AWS, you first deploy your EC2 instances within a Virtual Private Cloud (VPC), ensuring they are in the same target network. Install and configure your desired application (e.g., a web server like Apache) on these instances. Then, create an Application Load Balancer (ALB) or Network Load Balancer (NLB) to distribute traffic. Associate the load balancer with a Target Group that includes your EC2 instances and their ports. Next, configure the load balancer's listener to route incoming traffic (e.g., HTTP or HTTPS) to the Target Group. To make the setup accessible via a domain name, map your load balancer's DNS to a custom domain using Route 53. This ensures users can access your application by visiting the domain, with the load balancer evenly distributing traffic among the EC2 instances for high availability and scalability.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;My output:&lt;/strong&gt;
&lt;/h2&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%2Fvqh2x39bd7h3zz31225k.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%2Fvqh2x39bd7h3zz31225k.png" alt="Image description" width="800" height="207"&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%2Fvzn6xu6eumw1wirlwyrq.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%2Fvzn6xu6eumw1wirlwyrq.png" alt="Image description" width="800" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Linux Basic Commands III</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Fri, 22 Nov 2024 11:17:34 +0000</pubDate>
      <link>https://dev.to/radurga/linux-basic-commands-iii-36i1</link>
      <guid>https://dev.to/radurga/linux-basic-commands-iii-36i1</guid>
      <description>&lt;p&gt;&lt;strong&gt;Process Management Commands:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ps&lt;/strong&gt; - It Display running processes.&lt;br&gt;
&lt;strong&gt;-aux:&lt;/strong&gt; - It Show all processes.&lt;br&gt;
&lt;strong&gt;top&lt;/strong&gt; - It Monitor system processes in real-time.It displays a dynamic view of system processes and their resource usage.&lt;br&gt;
&lt;strong&gt;kill&lt;/strong&gt; - It helps to Terminate a process.&lt;br&gt;
** - 9*&lt;em&gt;: Forcefully kill a process.&lt;br&gt;
**kill PID&lt;/em&gt;* -terminates the process with the specified process ID.&lt;br&gt;
&lt;strong&gt;pkill&lt;/strong&gt; - Terminate processes based on their name. &lt;br&gt;
&lt;strong&gt;pkill  **- terminates all processes with the specified name.&lt;br&gt;
**pgrep&lt;/strong&gt; - It helps to List processes based on their name.&lt;br&gt;
&lt;strong&gt;grep&lt;/strong&gt;  - It used to search for specific patterns or regular expressions in text files or streams and display matching lines.&lt;br&gt;
&lt;strong&gt;-i:&lt;/strong&gt; Ignore case distinctions while searching.&lt;br&gt;
&lt;strong&gt;-v:&lt;/strong&gt; Invert the match, displaying non-matching lines.&lt;br&gt;
&lt;strong&gt;-r or -R:&lt;/strong&gt; Recursively search directories for matching patterns.&lt;br&gt;
&lt;strong&gt;-l:&lt;/strong&gt; Print only the names of files containing matches.&lt;br&gt;
&lt;strong&gt;-n:&lt;/strong&gt; Display line numbers alongside matching lines.&lt;br&gt;
&lt;strong&gt;-w:&lt;/strong&gt; Match whole words only, rather than partial matches.&lt;br&gt;
&lt;strong&gt;-c:&lt;/strong&gt; Count the number of matching lines instead of displaying them.&lt;br&gt;
&lt;strong&gt;-e:&lt;/strong&gt; Specify multiple patterns to search for.&lt;br&gt;
&lt;strong&gt;-A:&lt;/strong&gt; Display lines after the matching line.&lt;br&gt;
&lt;strong&gt;-B:&lt;/strong&gt; Display lines before the matching line.&lt;br&gt;
&lt;strong&gt;-C:&lt;/strong&gt; Display lines both before and after the matching line.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Linux Basic Commands II</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Thu, 21 Nov 2024 14:45:06 +0000</pubDate>
      <link>https://dev.to/radurga/linux-basic-commands-ii-1deb</link>
      <guid>https://dev.to/radurga/linux-basic-commands-ii-1deb</guid>
      <description>&lt;p&gt;&lt;strong&gt;File Permission Commands:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chmod&lt;/strong&gt; - Change file permissions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;u: User/owner permissions.&lt;/li&gt;
&lt;li&gt;g: Group permissions.&lt;/li&gt;
&lt;li&gt;o: Other permissions.&lt;/li&gt;
&lt;li&gt;+: Add permissions.&lt;/li&gt;
&lt;li&gt;–: Remove permissions.&lt;/li&gt;
&lt;li&gt;=: Set permissions explicitly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Chown&lt;/strong&gt; - Change file ownership.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chgrp&lt;/strong&gt; - Change group ownership.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File Compression and Archiving Commands: &lt;br&gt;
**&lt;br&gt;
**Tar&lt;/strong&gt; - Create or extract archive files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-c: Create a new archive.&lt;/li&gt;
&lt;li&gt;-x: Extract files from an archive.&lt;/li&gt;
&lt;li&gt;-f: Specify the archive file name.&lt;/li&gt;
&lt;li&gt;-v: Verbose mode.&lt;/li&gt;
&lt;li&gt;-z: Compress the archive with gzip.&lt;/li&gt;
&lt;li&gt;-j: Compress the archive with bzip2.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Gzip&lt;/strong&gt; - for Compress files&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-d: Decompress files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Zip&lt;/strong&gt; - to Create compressed zip archives.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-r: Recursively include directories.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Basic Linux Commands</title>
      <dc:creator>Radurga Rajendran</dc:creator>
      <pubDate>Fri, 15 Nov 2024 15:08:06 +0000</pubDate>
      <link>https://dev.to/radurga/basic-linux-commands-35m0</link>
      <guid>https://dev.to/radurga/basic-linux-commands-35m0</guid>
      <description>&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;pwd&lt;/strong&gt; — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system and is denoted by a forward slash( / ). The user directory is usually something like “/home/username”.&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%2Fw8kmzv5mpef8irxj70h7.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%2Fw8kmzv5mpef8irxj70h7.png" alt="Image description" width="718" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ls — Use the “ls” command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”.&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%2Fgxzvxw4ivm8nhi3t7pwu.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%2Fgxzvxw4ivm8nhi3t7pwu.png" alt="Image description" width="800" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;cd — Use the “cd” command to go to a directory. “cd” expects directory name or path of new directory as input. &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%2F2hj0fd1n9b4bw5yh87mx.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%2F2hj0fd1n9b4bw5yh87mx.png" alt="Image description" width="800" height="151"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;mkdir &amp;amp; rmdir — Use the mkdir command when you need to create a folder or a directory.Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.&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%2Fdfzjgaanxtgmvz4rzkoa.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%2Fdfzjgaanxtgmvz4rzkoa.png" alt="Image description" width="800" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;rm – Use the rm command to delete a file.  Use “rm -r” to recursively delete all files within a specific directory.&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%2Fdhdarjuly57dekiexain.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%2Fdhdarjuly57dekiexain.png" alt="Image description" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;touch — The touch command is used to create an empty file. For example, “touch new.txt”.&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%2F5nx92wg3u0j00vcub1p1.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%2F5nx92wg3u0j00vcub1p1.png" alt="Image description" width="800" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;cp — Use the cp command to copy files through the command line.&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%2Ft620w3bon4impf7wcc0t.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%2Ft620w3bon4impf7wcc0t.png" alt="Image description" width="800" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;mv — Use the mv command to move files through the command line. We can also use the mv command to rename a file.&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%2Feruye9lbmgqn0apenpza.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%2Feruye9lbmgqn0apenpza.png" alt="Image description" width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;9.cat — Use the cat command to display the contents of a file. It is usually used to easily view programs.&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%2Fshuolsvu0fpluo47s069.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%2Fshuolsvu0fpluo47s069.png" alt="Image description" width="800" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;10.vi - You can create a new file or modify a file using this editor.&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%2F4gywpf1o6sdwxlbnyj7n.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%2F4gywpf1o6sdwxlbnyj7n.png" alt="Image description" width="800" height="75"&gt;&lt;/a&gt;&lt;/p&gt;

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