<?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: mahpara jabbar</title>
    <description>The latest articles on DEV Community by mahpara jabbar (@mahpara_jabbar_0521a5b816).</description>
    <link>https://dev.to/mahpara_jabbar_0521a5b816</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%2F1873789%2F10194ab2-bd0e-4c82-a0f5-1d6468a390ff.jpg</url>
      <title>DEV Community: mahpara jabbar</title>
      <link>https://dev.to/mahpara_jabbar_0521a5b816</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahpara_jabbar_0521a5b816"/>
    <language>en</language>
    <item>
      <title>Auto Scaling with an Application Load Balancer</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Sun, 22 Sep 2024 07:45:39 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/auto-scaling-with-an-application-load-balancer-5316</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/auto-scaling-with-an-application-load-balancer-5316</guid>
      <description>&lt;p&gt;This lab teaches how to set up an Auto Scaling infrastructure in AWS, including creating an AMI, configuring a load balancer, and implementing an Auto Scaling group. It demonstrates dynamic resource scaling based on demand to ensure application availability and efficient traffic distribution. The lab also tests scaling by increasing load and verifying load balancer functionality.&lt;/p&gt;

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

&lt;p&gt;Step 1: Create an AMI from Web Server 1&lt;br&gt;
Step 2: Create a Load Balancer&lt;br&gt;
Step 3: Create a Launch Template&lt;br&gt;
Step 4: Create an Auto Scaling Group&lt;br&gt;
Step 5: Verify Load Balancer Functionality&lt;br&gt;
Step 6: Test Auto Scaling&lt;br&gt;
Step 7: Terminate Web Server 1&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create an AMI from Web Server 1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Go to EC2 Dashboard:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search for EC2 in the AWS Management Console.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Select Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Instances section, find Web Server 1 (ensure it's in the Running state).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create Image:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Web Server 1.&lt;/li&gt;
&lt;li&gt;Choose Actions &amp;gt; Image and templates &amp;gt; Create image.&lt;/li&gt;
&lt;li&gt;Set Image name: Web Server AMI.&lt;/li&gt;
&lt;li&gt;Optional: Add Image description: Lab AMI for Web Server.&lt;/li&gt;
&lt;li&gt;Click Create image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note AMI ID:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the AMI ID for use when launching the Auto Scaling group later.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Navigate to Load Balancers:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the EC2 Dashboard, go to Load Balancers under the Load Balancing section.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Click Create load balancer.&lt;/li&gt;
&lt;li&gt;Choose Application Load Balancer.&lt;/li&gt;
&lt;li&gt;Set Load balancer name: LabELB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Network Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Lab VPC.&lt;/li&gt;
&lt;li&gt;Map to Public Subnet 1 and Public Subnet 2 for availability zones.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Remove the default security group.&lt;/li&gt;
&lt;li&gt;Select Web Security Group (preconfigured for HTTP access).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create Target Group:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Create target group (opens a new tab).&lt;/li&gt;
&lt;li&gt;Choose Instances as the target type.&lt;/li&gt;
&lt;li&gt;Set Target group name: lab-target-group.&lt;/li&gt;
&lt;li&gt;Click Next and Create target group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Assign Target Group to Load Balancer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Return to the Load Balancer tab and Refresh the target groups.&lt;/li&gt;
&lt;li&gt;Select lab-target-group for the Forward to action.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Click Create load balancer and copy the DNS name.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Step 3: Create a Launch Template&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access Launch Templates:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the EC2 Dashboard, go to Launch Templates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create Launch Template:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set Launch template name: lab-app-launch-template.&lt;/li&gt;
&lt;li&gt;Add a Description: A web server for the load test app.&lt;/li&gt;
&lt;li&gt;Check the box for Auto Scaling guidance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AMI and Instance Type:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the My AMIs tab and select Web Server AMI.&lt;/li&gt;
&lt;li&gt;Set the Instance type to t3.micro.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Select Web Security Group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create Template:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Create launch template.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Step 4: Create an Auto Scaling Group&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Auto Scaling Group:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select lab-app-launch-template from the launch template list.&lt;/li&gt;
&lt;li&gt;Choose Actions &amp;gt; Create Auto Scaling group.&lt;/li&gt;
&lt;li&gt;Set Auto Scaling group name: Lab Auto Scaling Group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Network Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Lab VPC.&lt;/li&gt;
&lt;li&gt;Assign Private Subnet 1 and Private Subnet 2.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Choose Attach to an existing load balancer.&lt;/li&gt;
&lt;li&gt;Select lab-target-group | HTTP.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Set Health check type to ELB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Group Size and Scaling Policy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set Desired capacity: 2.&lt;/li&gt;
&lt;li&gt;Set Minimum capacity: 2.&lt;/li&gt;
&lt;li&gt;Set Maximum capacity: 4.&lt;/li&gt;
&lt;li&gt;Enable Target tracking scaling policy for Average CPU utilization and set the target to 50%.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Add a Tag:&lt;/li&gt;
&lt;li&gt;Key: Name,&lt;/li&gt;
&lt;li&gt;Value: Lab Instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create Auto Scaling Group:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finish by clicking Create Auto Scaling group.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Step 5: Verify Load Balancer Functionality&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check Instances:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Instances in the EC2 Dashboard.&lt;/li&gt;
&lt;li&gt;Ensure two Lab Instances are running.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;In Load Balancing &amp;gt; Target Groups, find lab-target-group.&lt;/li&gt;
&lt;li&gt;Verify that both Lab Instances show a Healthy status.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Access Application:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the load balancer DNS name to check if the Load Test app is running.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Step 6: Test Auto Scaling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access CloudWatch:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the AWS Console, search for CloudWatch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Check Alarms:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Alarms, locate the AlarmHigh (CPU utilization &amp;gt; 50%).&lt;/li&gt;
&lt;li&gt;Ensure the state is OK.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Open the Load Test tab from the web application.&lt;/li&gt;
&lt;li&gt;Trigger high CPU load by selecting Load Test.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Monitor Scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In CloudWatch, check the AlarmHigh status, which should change to In alarm.&lt;/li&gt;
&lt;li&gt;Auto Scaling should add instances as CPU load increases.&lt;/li&gt;
&lt;/ul&gt;

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

</description>
      <category>autoscaling</category>
      <category>loadbalancer</category>
      <category>ami</category>
      <category>ec2instances</category>
    </item>
    <item>
      <title>Migrating to Amazon RDS</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Tue, 17 Sep 2024 10:16:50 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/migrating-to-amazon-rds-4bc</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/migrating-to-amazon-rds-4bc</guid>
      <description>&lt;p&gt;A lab on migrating to Amazon RDS typically involves transferring an existing on-premises or cloud-hosted database to Amazon's Relational Database Service (RDS). The goal is to reduce the operational burden of managing databases by leveraging AWS's managed service for automated backups, patching, monitoring, and scaling.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Create an Amazon RDS MariaDB instance by using the AWS CLI.&lt;/li&gt;
&lt;li&gt;Migrate data from a MariaDB database on an EC2 instance to an Amazon RDS MariaDB instance.&lt;/li&gt;
&lt;li&gt;Monitor the Amazon RDS instance by using Amazon CloudWatch metrics.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Creating an Amazon RDS instance by using the AWS CLI&lt;/li&gt;
&lt;li&gt;Migrating application data to the Amazon RDS instance&lt;/li&gt;
&lt;li&gt;Configuring the website to use the Amazon RDS instance&lt;/li&gt;
&lt;li&gt;Monitoring the Amazon RDS database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The application database runs in an Amazon Elastic Compute Cloud (Amazon EC2) Linux, Apache, MySQL, and PHP (LAMP) instance along with the application code. The instance has a T3 small instance type and runs in a public subnet so that internet clients can access the website. A CLI Host instance resides in the same subnet to facilitate the instance's administration by using the AWS Command Line Interface (AWS CLI).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating an Amazon RDS instance by using the AWS CLI:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure the AWS CLI.&lt;/li&gt;
&lt;li&gt;Create the following prerequisite components required to build the Amazon RDS instance:&lt;/li&gt;
&lt;li&gt;A security group firewall for the Amazon RDS instance&lt;/li&gt;
&lt;li&gt;Two private subnets and a database subnet group&lt;/li&gt;
&lt;li&gt;Create the Amazon RDS MariaDB instance.&lt;/li&gt;
&lt;li&gt;On the AWS Management Console, in the Search bar, enter and choose EC2 to open the EC2 Management Console.&lt;/li&gt;
&lt;li&gt;In the navigation pane, choose Instances.&lt;/li&gt;
&lt;li&gt;From the list of instances, select the CLI Host instance.&lt;/li&gt;
&lt;li&gt;Choose Connect.&lt;/li&gt;
&lt;li&gt;On the EC2 Instance Connect tab, choose Connect.&lt;/li&gt;
&lt;li&gt;To set up the AWS CLI profile with credentials, in the EC2 Instance Connect terminal, run the following command:
‘aws configure’&lt;/li&gt;
&lt;li&gt;Enter the user's access key and secret access key.&lt;/li&gt;
&lt;li&gt;Create Security Group: Set up CafeDatabaseSG to protect the RDS instance.&lt;/li&gt;
&lt;li&gt;Add Inbound Rule: Allow only MySQL requests (TCP protocol, port 3306) from instances in CafeSecurityGroup.&lt;/li&gt;
&lt;li&gt;Create Private Subnets: Establish two private subnets (CafeDB Private Subnet 1 and CafeDB Private Subnet 2).&lt;/li&gt;
&lt;li&gt;Create Database Subnet Group: Define a CafeDB Subnet Group for RDS, associating it with the private subnets.&lt;/li&gt;
&lt;li&gt;Create CafeDatabaseSG Security Group:
&lt;strong&gt;Run command:&lt;/strong&gt;
aws ec2 create-security-group \
--group-name CafeDatabaseSG \
--description "Security group for Cafe database" \
--vpc-id &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output: Note the GroupId for future use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create Inbound Rule for CafeDatabaseSG:&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws ec2 authorize-security-group-ingress \&lt;br&gt;
--group-id  \&lt;br&gt;
--protocol tcp --port 3306 \&lt;br&gt;
--source-group &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify Inbound Rule:&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws ec2 describe-security-groups \&lt;br&gt;
--query "SecurityGroups[*].[GroupName,GroupId,IpPermissions]" \&lt;br&gt;
--filters "Name=group-name,Values='CafeDatabaseSG'"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create CafeDB Private Subnet 1&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws ec2 create-subnet \&lt;br&gt;
--vpc-id  \&lt;br&gt;
--cidr-block 10.200.2.0/23 \&lt;br&gt;
--availability-zone &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output: Note the SubnetId for future use.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create CafeDB Private Subnet 2&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws ec2 create-subnet \&lt;br&gt;
--vpc-id  \&lt;br&gt;
--cidr-block 10.200.10.0/23 \&lt;br&gt;
--availability-zone &lt;br&gt;
Output: Note the SubnetId for future use.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create DB Subnet Group&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws rds create-db-subnet-group \&lt;br&gt;
--db-subnet-group-name "CafeDB Subnet Group" \&lt;br&gt;
--db-subnet-group-description "DB subnet group for Cafe" \&lt;br&gt;
--subnet-ids   \&lt;br&gt;
--tags "Key=Name,Value= CafeDatabaseSubnetGroup"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create the CafeDBInstance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the following command to create the MariaDB instance with the specified configuration:&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;br&gt;
aws rds create-db-instance \&lt;br&gt;
--db-instance-identifier CafeDBInstance \&lt;br&gt;
--engine mariadb \&lt;br&gt;
--engine-version 10.5.13 \&lt;br&gt;
--db-instance-class db.t3.micro \&lt;br&gt;
--allocated-storage 20 \&lt;br&gt;
--availability-zone  \&lt;br&gt;
--db-subnet-group-name "CafeDB Subnet Group" \&lt;br&gt;
--vpc-security-group-ids  \&lt;br&gt;
--no-publicly-accessible \&lt;br&gt;
--master-username root --master-user-password 'Re:Start!9'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key settings:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DB instance identifier: CafeDBInstance&lt;/li&gt;
&lt;li&gt;Engine: MariaDB (version 10.5.13)&lt;/li&gt;
&lt;li&gt;Instance class: db.t3.micro&lt;/li&gt;
&lt;li&gt;Allocated storage: 20 GB&lt;/li&gt;
&lt;li&gt;Security group: CafeDatabaseSG&lt;/li&gt;
&lt;li&gt;Username: root&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Password: Re:Start!9&lt;br&gt;
The creation of the database instance may take up to 10 minutes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitor the Status of the DB Instance&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running the creation command, monitor the status of the database by running the following command:&lt;br&gt;
&lt;strong&gt;Run command:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;aws rds describe-db-instances \&lt;br&gt;
--db-instance-identifier CafeDBInstance \&lt;br&gt;
--query "DBInstances[*].[Endpoint.Address,AvailabilityZone,PreferredBackupWindow,BackupRetentionPeriod,DBInstanceStatus]"&lt;/p&gt;

&lt;p&gt;What to watch: The command will return information such as the endpoint address, availability zone, backup window, retention period, and the status of the instance.&lt;br&gt;
Initially, the status will show as creating and then progress through modifying, backing-up, and finally to available.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Continue running the status command every few minutes until the status of the database shows available.
&lt;strong&gt;Run command:&lt;/strong&gt;
aws rds describe-db-instances \
--db-instance-identifier CafeDBInstance \
--query "DBInstances[*].[DBInstanceStatus]"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Migrating application data to the Amazon RDS instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect to the EC2 Instance (CafeInstance)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the terminal, run the following command to create a backup of the local cafe_db database:&lt;br&gt;
&lt;strong&gt;Run Command:&lt;/strong&gt;&lt;br&gt;
mysqldump --user=root --password='Re:Start!9' \&lt;br&gt;
--databases cafe_db --add-drop-database &amp;gt; cafedb-backup.sql&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Review the Backup File&lt;br&gt;
You can review the contents of the backup using the less command:&lt;br&gt;
&lt;strong&gt;Run Command:&lt;/strong&gt;&lt;br&gt;
less cafedb-backup.sql&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use arrow keys or Page Up/Down to navigate and q to quit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Restore the Backup to the Amazon RDS Database&lt;br&gt;
Run the following command to restore the backup to the RDS instance. Replace  with your actual RDS instance endpoint:&lt;br&gt;
&lt;strong&gt;Run Command&lt;/strong&gt;&lt;br&gt;
mysql --user=root --password='Re:Start!9' \&lt;br&gt;
--host= \&lt;br&gt;
&amp;lt; cafedb-backup.sql&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify the Data Migration&lt;br&gt;
Open an interactive MySQL session to the RDS instance:&lt;br&gt;
&lt;strong&gt;Run Command:&lt;/strong&gt;&lt;br&gt;
mysql --user=root --password='Re:Start!9' \&lt;br&gt;
--host= \&lt;br&gt;
cafe_db&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once inside the MySQL session, verify the data in the product table by running the following SQL query:&lt;br&gt;
sql&lt;br&gt;
&lt;strong&gt;Run Command:&lt;/strong&gt;&lt;br&gt;
select * from product;&lt;/p&gt;

&lt;p&gt;Ensure that the returned data matches the original database.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exit the MySQL Session
After verifying the data, exit the MySQL session by entering:
&lt;strong&gt;Run Command&lt;/strong&gt;
exit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: Keep the SSH window open for future tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuring the website to use the Amazon RDS instance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open AWS Systems Manager&lt;br&gt;
In the AWS Management Console, search for Systems Manager in the search bar.&lt;br&gt;
Navigate to Systems Manager.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access Parameter Store&lt;br&gt;
In the left navigation pane, choose Parameter Store.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Edit the /cafe/dbUrl Parameter&lt;br&gt;
From the My parameters list, select /cafe/dbUrl.&lt;br&gt;
Choose Edit to modify the parameter value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update the Database URL&lt;br&gt;
In the Parameter details page, replace the existing value with the RDS Instance Database Endpoint Address.&lt;br&gt;
The format should be like:&lt;br&gt;
&lt;strong&gt;Run Command:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;cafedbinstance.xxxxxxx.us-west-2.rds.amazonaws.com&lt;/p&gt;

&lt;p&gt;Click Save changes to update the parameter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test the Website&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open a new browser window and paste the CafeInstanceURL that you saved earlier (e.g., &lt;a href="http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com" rel="noopener noreferrer"&gt;http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com&lt;/a&gt;).&lt;br&gt;
The café website’s homepage should load.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the Database Connection
Go to the Order History tab on the website.
Check the number of orders displayed. It should match the number from the local database before the migration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Monitoring the Amazon RDS database&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open the Amazon RDS Console&lt;br&gt;
In the AWS Management Console, search for RDS.&lt;br&gt;
Go to the RDS Management Console.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the Database&lt;br&gt;
In the left navigation pane, choose Databases.&lt;br&gt;
From the list, select cafedbinstance.&lt;br&gt;
You will now see detailed information about the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View Monitoring Metrics&lt;br&gt;
Click on the Monitoring tab.&lt;br&gt;
This tab displays key metrics, including:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;CPUUtilization&lt;/li&gt;
&lt;li&gt;DatabaseConnections&lt;/li&gt;
&lt;li&gt;FreeStorageSpace&lt;/li&gt;
&lt;li&gt;FreeableMemory&lt;/li&gt;
&lt;li&gt;WriteIOPS&lt;/li&gt;
&lt;li&gt;ReadIOPS&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Monitor DatabaseConnections Metric&lt;br&gt;
Look for the DatabaseConnections graph. If needed, go to page 2 or 3 of the metrics charts.&lt;br&gt;
This graph tracks the number of active database connections.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect to the RDS Database&lt;br&gt;
In the CafeInstance terminal window, run the following command to open a MySQL session:&lt;br&gt;
&lt;strong&gt;Run Command&lt;/strong&gt;&lt;br&gt;
mysql --user=root --password='Re:Start!9' \&lt;br&gt;
--host= \&lt;br&gt;
cafe_db&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Replace  with your RDS instance endpoint.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run an SQL Query
Inside the MySQL session, run the following SQL query to retrieve data from the product table:
sql
&lt;strong&gt;Run Command:&lt;/strong&gt;
select * from product;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The query should return the data from the product table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Check the DatabaseConnections Graph&lt;br&gt;
In the RDS console, click the DatabaseConnections graph.&lt;br&gt;
You should now see 1 active connection from the interactive SQL session.&lt;br&gt;
If the graph does not update, wait 1 minute and click Refresh.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Close the MySQL Session&lt;br&gt;
In the CafeInstance terminal window, exit the MySQL session:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Run Command&lt;/strong&gt;&lt;br&gt;
exit&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Monitor the Connections After Disconnecting&lt;br&gt;
Wait for 1 minute, then refresh the DatabaseConnections graph in the RDS console.&lt;br&gt;
The number of connections should now show as 0.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Explore Other Metrics&lt;br&gt;
You can explore additional metrics such as CPUUtilization, FreeStorageSpace, WriteIOPS, and ReadIOPS by reviewing their graphs on the Monitoring tab.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>mysql</category>
      <category>mariadb</category>
      <category>migration</category>
      <category>ec2</category>
    </item>
    <item>
      <title>CloudWatch CPU Utilization Monitoring with SNS Alert</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Wed, 04 Sep 2024 10:14:02 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/cloudwatch-cpu-utilization-monitoring-with-sns-alert-1lgo</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/cloudwatch-cpu-utilization-monitoring-with-sns-alert-1lgo</guid>
      <description>&lt;p&gt;This lab focuses on setting up a CloudWatch alarm to monitor CPU utilization on an EC2 instance, configuring an SNS topic to receive email alerts when CPU utilization exceeds a defined threshold, and creating a CloudWatch dashboard for real-time monitoring. Additionally, it involves installing the stress tool on the EC2 instance to simulate high CPU usage for testing the alarm and notification system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch EC2 Instance.&lt;/li&gt;
&lt;li&gt;Create SNS Topic and Subscription.&lt;/li&gt;
&lt;li&gt;Create a CloudWatch Alarm.&lt;/li&gt;
&lt;li&gt;Create a CloudWatch Dashboard.&lt;/li&gt;
&lt;li&gt;Connect to EC2 and Install Stress Tool.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Launch an EC2 instance with the following specifications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instance Type: t2.nano&lt;/li&gt;
&lt;li&gt;Network: Assign a public IP.&lt;/li&gt;
&lt;li&gt;Security Group: Allow SSH (port 22) from your IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5vwb21kmunhb1fzbfplv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5vwb21kmunhb1fzbfplv.png" alt="Image description" width="800" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create SNS Topic and Subscription:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the SNS (Simple Notification Service) section in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Click on Topics &amp;gt; Create Topic.&lt;/li&gt;
&lt;li&gt;Choose Standard as the type.&lt;/li&gt;
&lt;li&gt;Provide a Name for the topic (e.g., EC2-CPU-Alerts).&lt;/li&gt;
&lt;li&gt;Click Create Topic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2za18egr24o669tg6njr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2za18egr24o669tg6njr.png" alt="Image description" width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the newly created topic, click on Create Subscription.&lt;/li&gt;
&lt;li&gt;Set the protocol to Email.&lt;/li&gt;
&lt;li&gt;Enter your email address and click Create Subscription.&lt;/li&gt;
&lt;li&gt;Confirm the subscription by checking your email and clicking on the verification link.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create a CloudWatch Alarm:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the CloudWatch section in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Select Alarms from the sidebar, then click Create Alarm.&lt;/li&gt;
&lt;li&gt;Click Select Metric.&lt;/li&gt;
&lt;li&gt;Navigate to EC2 &amp;gt; Per-Instance Metrics &amp;gt; CPUUtilization.&lt;/li&gt;
&lt;li&gt;Choose the Instance ID of your EC2 instance.&lt;/li&gt;
&lt;li&gt;Set the Statistic to Average and the Period to 1 minute.&lt;/li&gt;
&lt;li&gt;Set the Threshold Type to Static and enter 60 as the value (for greater than 60% CPU utilization).&lt;/li&gt;
&lt;li&gt;Click Next.&lt;/li&gt;
&lt;li&gt;Under Actions, choose Select an existing SNS topic and pick the topic you created earlier.&lt;/li&gt;
&lt;li&gt;Click Next.&lt;/li&gt;
&lt;li&gt;Provide an Alarm Name (e.g., High-CPU-Utilization-Alarm).&lt;/li&gt;
&lt;li&gt;Click Create Alarm.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vjm8fj93yom9pgapao6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7vjm8fj93yom9pgapao6.png" alt="Image description" width="800" height="185"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a CloudWatch Dashboard:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the CloudWatch console, navigate to Dashboards.&lt;/li&gt;
&lt;li&gt;Click Create Dashboard.&lt;/li&gt;
&lt;li&gt;Provide a Name for the dashboard (e.g., EC2-Monitoring-Dashboard).&lt;/li&gt;
&lt;li&gt;Click Add Widget.&lt;/li&gt;
&lt;li&gt;Choose Line and click Configure.&lt;/li&gt;
&lt;li&gt;Select the same metric used in your alarm (EC2 CPU Utilization).&lt;/li&gt;
&lt;li&gt;Click Create Widget.&lt;/li&gt;
&lt;li&gt;Save the dashboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuslg30pa5oeu6ah1fryb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuslg30pa5oeu6ah1fryb.png" alt="Image description" width="800" height="231"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect to EC2 and Install Stress Tool:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect your EC2 instance.&lt;/li&gt;
&lt;li&gt;Run the following commands to update the instance and install the stress tool:&lt;/li&gt;
&lt;li&gt;sudo yum update -y&lt;/li&gt;
&lt;li&gt;sudo yum install stress -y&lt;/li&gt;
&lt;li&gt;Use the stress tool to generate CPU load:&lt;/li&gt;
&lt;li&gt;stress --cpu 1 --timeout 300&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F91zuwcx4r5j2g60x6443.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F91zuwcx4r5j2g60x6443.png" alt="Image description" width="800" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CPU utilization crosses the threshold:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabr9uvds83venqpnvhef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabr9uvds83venqpnvhef.png" alt="Image description" width="800" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alarm Generated:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jvjmzltx36v2upqqtzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6jvjmzltx36v2upqqtzj.png" alt="Image description" width="800" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This lab should give you a hands-on understanding of setting up CloudWatch alarms with SNS and monitoring an EC2 instance's CPU utilization.&lt;/p&gt;

</description>
      <category>cloudwatch</category>
      <category>cpuutilization</category>
      <category>snsalert</category>
      <category>monitoring</category>
    </item>
    <item>
      <title>VPC Flow Logs Setup</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Tue, 20 Aug 2024 11:08:37 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/vpc-flow-logs-setup-3p0f</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/vpc-flow-logs-setup-3p0f</guid>
      <description>&lt;p&gt;In the VPC Flow Logs Setup lab, we will configure VPC Flow Logs in AWS to monitor and analyze network traffic within a Virtual Private Cloud (VPC). we will create a VPC with public and private subnets, launch EC2 instances, and enable Flow Logs to capture traffic data, which is then sent to CloudWatch Logs for analysis. This lab provides hands-on experience in using VPC Flow Logs for security monitoring, troubleshooting, and gaining insights into network activity in AWS.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Create a VPC&lt;/li&gt;
&lt;li&gt;Create a VPC&lt;/li&gt;
&lt;li&gt;Create an Internet Gateway&lt;/li&gt;
&lt;li&gt;Configure Route Tables&lt;/li&gt;
&lt;li&gt;Launch EC2 Instances&lt;/li&gt;
&lt;li&gt;Enable VPC Flow Logs&lt;/li&gt;
&lt;li&gt;Analyze Flow Logs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Create a VPC&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login to AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to VPC under the Networking &amp;amp; Content Delivery section.&lt;/li&gt;
&lt;li&gt;Click on Create VPC.&lt;/li&gt;
&lt;li&gt;Name tag: vpc-flowlog-lab&lt;/li&gt;
&lt;li&gt;IPv4 CIDR block: 10.0.0.0/24&lt;/li&gt;
&lt;li&gt;Leave the rest of the settings as default and click Create VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feogofbd6ryusgfflht9f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feogofbd6ryusgfflht9f.png" alt="Image description" width="800" height="162"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Subnets&lt;/strong&gt;&lt;br&gt;
In your VPC, create two subnets:&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Name tag: PublicSubnet&lt;/li&gt;
&lt;li&gt;Availability Zone: Choose any available one&lt;/li&gt;
&lt;li&gt;IPv4 CIDR block: 10.0.0.0/25&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;Name tag: PrivateSubnet&lt;/li&gt;
&lt;li&gt;Availability Zone: Same as the public subnet&lt;/li&gt;
&lt;li&gt;IPv4 CIDR block: 10.0.0.128/25&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ujip9rf7h3f7awe6ocv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ujip9rf7h3f7awe6ocv.png" alt="Image description" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create an Internet Gateway&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to Internet Gateways.&lt;/li&gt;
&lt;li&gt;Click Create internet gateway.&lt;/li&gt;
&lt;li&gt;Name tag: vpc-flowlog-igw&lt;/li&gt;
&lt;li&gt;Attach this Internet Gateway to your VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configure Route Tables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name tag: PublicRouteTable&lt;/li&gt;
&lt;li&gt;Associate it with the Public Subnet.&lt;/li&gt;
&lt;li&gt;Edit routes: Add a route with the destination 0.0.0.0/0 and the target as the Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml6luieny2gkbtwmyl75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fml6luieny2gkbtwmyl75.png" alt="Image description" width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Private Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name tag: PrivateRouteTable&lt;/li&gt;
&lt;li&gt;Associate it with the Private Subnet.&lt;/li&gt;
&lt;li&gt;No need to add any routes to the Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Launch EC2 Instances&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch an EC2 instance in the Public Subnet.&lt;/li&gt;
&lt;li&gt;Instance Type: t2.micro&lt;/li&gt;
&lt;li&gt;Security Group: Allow inbound SSH (22) and HTTP (80) traffic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Private EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch another EC2 instance in the Private Subnet.&lt;/li&gt;
&lt;li&gt;Instance Type: t2.micro&lt;/li&gt;
&lt;li&gt;Security Group: Allow inbound SSH (22) only from the Public EC2 instance's private IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Enable VPC Flow Logs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to the VPC Dashboard.&lt;/li&gt;
&lt;li&gt;Select Flow Logs under Your VPCs.&lt;/li&gt;
&lt;li&gt;Click Create flow log.&lt;/li&gt;
&lt;li&gt;Filter: Choose All to capture all traffic (you can also choose Reject or Accept depending on your needs).&lt;/li&gt;
&lt;li&gt;Destination: Choose Send to CloudWatch Logs.&lt;/li&gt;
&lt;li&gt;Log Group Name: Create a new log group (e.g., vpc-flowlog-lab-logs).&lt;/li&gt;
&lt;li&gt;IAM Role: If you don’t have a role, create one with the necessary permissions (the IAM role should allow VPC Flow Logs to publish to CloudWatch Logs).&lt;/li&gt;
&lt;li&gt;Click Create flow log.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analyze Flow Logs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to CloudWatch Logs.&lt;/li&gt;
&lt;li&gt;Find your Log Group and click on it.&lt;/li&gt;
&lt;li&gt;View the log streams to see the VPC traffic information.&lt;/li&gt;
&lt;li&gt;You can filter and analyze the logs to see traffic details, such as source/destination IPs, traffic accept/reject status, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Test Traffic Between Instances&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH into the public instance.&lt;/li&gt;
&lt;li&gt;From the public instance, try to ping the private instance using its private IP.&lt;/li&gt;
&lt;li&gt;Observe the Flow Logs in CloudWatch to see the traffic being logged.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vpc</category>
      <category>flowlog</category>
      <category>cloudwatch</category>
    </item>
    <item>
      <title>"S3 VPC Endpoint "</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Mon, 19 Aug 2024 11:31:26 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/s3-vpc-endpoint--5ele</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/s3-vpc-endpoint--5ele</guid>
      <description>&lt;p&gt;In this VPC endpoint lab, you'll set up a Virtual Private Cloud (VPC) with both public and private subnets in AWS. The goal is to configure a VPC endpoint to securely access Amazon S3 from instances within the private subnet, without routing the traffic through the internet. The public subnet will allow instances to access the internet directly.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Create a VPC with public and private subnets.&lt;/li&gt;
&lt;li&gt;Set up a VPC endpoint for Amazon S3 to allow private subnet instances to access S3 securely.&lt;/li&gt;
&lt;li&gt;Configure the route tables and security settings to ensure proper connectivity.&lt;/li&gt;
&lt;li&gt;Test the setup by accessing S3 from both public and private subnet instances.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Set Up Your VPC&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Go to the VPC Dashboard.&lt;/li&gt;
&lt;li&gt;Click Create VPC.&lt;/li&gt;
&lt;li&gt;Set a CIDR block (e.g., 10.0.0.0/24).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Create Subnets:&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Create a subnet with CIDR block 10.0.0.0/25.&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;Create another subnet with CIDR block 10.0.0.128/25.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Internet Gateway:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an Internet Gateway (IGW) and attach it to your VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Route Tables:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a route table.&lt;/li&gt;
&lt;li&gt;Add a route to the IGW (destination 0.0.0.0/0).&lt;/li&gt;
&lt;li&gt;Associate this route table with the public subnet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Private Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a route table.&lt;/li&gt;
&lt;li&gt;Do not add an internet route; keep the local route (destination 10.0.0.0/16).&lt;/li&gt;
&lt;li&gt;Associate this route table with the private subnet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. VPC Endpoints:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to VPC Endpoints and click Create Endpoint.&lt;/li&gt;
&lt;li&gt;Choose the Amazon S3 service.&lt;/li&gt;
&lt;li&gt;Select the Private Route Table to associate with the endpoint.&lt;/li&gt;
&lt;li&gt;Policy: Leave the default policy, which allows full access to S3, or customize it as needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Create an IAM Role:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the IAM Dashboard &amp;gt; Roles.&lt;/li&gt;
&lt;li&gt;Create a new role for s3.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Attach Role to EC2 Instances:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When launching instances in the private subnet, attach the IAM role you created to these instances.&lt;/li&gt;
&lt;li&gt;This role will allow instances to access S3 using the endpoint.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Launch and Configure EC2 Instances:&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Public Subnet: Launch an EC2 instance (e.g., for management or administration). Assign a public IP if needed.&lt;/li&gt;
&lt;li&gt;Private Subnet: Launch another EC2 instance. Ensure it has the IAM role attached.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Configure Security Groups:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public Instance: Configure security group rules to allow SSH (port 22) if you need to connect remotely.&lt;/li&gt;
&lt;li&gt;Private Instance: Configure security group rules to allow access from the public instance or other necessary resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9. Testing the Configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect to Instances:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH into the public instance and access the private instance using its private IP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Test S3 Access:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the AWS CLI to test S3 access from the private instance with the command aws s3 ls.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Creating a VPC with Public and Private Subnets</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Sun, 11 Aug 2024 11:28:18 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/creating-a-vpc-with-public-and-private-subnets-2ic8</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/creating-a-vpc-with-public-and-private-subnets-2ic8</guid>
      <description>&lt;p&gt;Creating a VPC with Public and Private Subnets is a fundamental AWS networking lab that helps to understand how to isolate resources within a Virtual Private Cloud (VPC) and manage their access to the internet.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Create a VPC&lt;/li&gt;
&lt;li&gt;Create Subnets&lt;/li&gt;
&lt;li&gt;Create and Attach an Internet Gateway&lt;/li&gt;
&lt;li&gt;Create Route Tables&lt;/li&gt;
&lt;li&gt;Launch an EC2 Instance in the Public Subnet&lt;/li&gt;
&lt;li&gt;Access the EC2 Instance&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Search VPC &lt;/li&gt;
&lt;li&gt;Click on Create VPC.&lt;/li&gt;
&lt;li&gt;Provide a Lab-vpc for  VPC.&lt;/li&gt;
&lt;li&gt;Select an IPv4 CIDR block (e.g., 10.0.0.0/24).&lt;/li&gt;
&lt;li&gt;Click Create VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbsgz3uc9slkcbi4y2ok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbsgz3uc9slkcbi4y2ok.png" alt="Image description" width="800" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create Subnets&lt;/strong&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Select  Subnets on the left panel and click Create subnet.&lt;/li&gt;
&lt;li&gt;Select the VPC you created earlier.&lt;/li&gt;
&lt;li&gt;Provide a Public-subnet for the subnet.&lt;/li&gt;
&lt;li&gt;Specify an Availability Zone (us-east-1a)&lt;/li&gt;
&lt;li&gt;Set the IPv4 CIDR block ( 10.0.0.0/25).&lt;/li&gt;
&lt;li&gt;Click Create Subnet.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Repeat the steps to create another subnet within the same VPC.&lt;/li&gt;
&lt;li&gt;Name this subnet (Private-Subnet.)&lt;/li&gt;
&lt;li&gt;IPv4 CIDR block (e.g., 10.0.0.128/25).&lt;/li&gt;
&lt;li&gt;Click Create Subnet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwxm68hz32va3gdz959d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiwxm68hz32va3gdz959d.png" alt="Image description" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Create and Attach an Internet Gateway&lt;/strong&gt;&lt;/p&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 VPC Dashboard, click on Internet Gateways and then Create Internet Gateway.&lt;/li&gt;
&lt;li&gt;Provide a VPC-Internet-gateway for the IGW.&lt;/li&gt;
&lt;li&gt;Click Create Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Attach the Internet Gateway to Your VPC:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After creation, select the newly created IGW.&lt;/li&gt;
&lt;li&gt;Click Actions and choose Attach to VPC.&lt;/li&gt;
&lt;li&gt;Select the VPC you created and click Attach Internet Gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Create Route Tables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Public Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to Route Tables on the left panel and click Create route table.&lt;/li&gt;
&lt;li&gt;Name it Public-Route-Table.&lt;/li&gt;
&lt;li&gt;Select the VPC which created earlier.&lt;/li&gt;
&lt;li&gt;Click Create.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Add a Route for the Internet Gateway:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the Public-Route-Table.&lt;/li&gt;
&lt;li&gt;Under Routes, click Edit routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Add a new route:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Destination: 0.0.0.0/0&lt;/li&gt;
&lt;li&gt;Target: Select your Internet Gateway (IGW) from the dropdown.&lt;/li&gt;
&lt;li&gt;Click Save routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Associate Public Subnet with the Public Route Table:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under the Subnet associations tab, click Edit subnet associations.&lt;/li&gt;
&lt;li&gt;Select your Public-Subnet and click Save associations.&lt;/li&gt;
&lt;li&gt;Repeat this process for private subnets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Launch an EC2 Instance in the Public Subnet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Launch a New EC2 Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on Launch Instance.&lt;/li&gt;
&lt;li&gt;Select an Amazon Linux 2.&lt;/li&gt;
&lt;li&gt;Choose an instance type (t2.micro)&lt;/li&gt;
&lt;li&gt;Under Network, choose the VPC you created.&lt;/li&gt;
&lt;li&gt;Under Subnet, select Public-Subnet.&lt;/li&gt;
&lt;li&gt;Ensure Auto-assign Public IP is enabled.&lt;/li&gt;
&lt;li&gt;Configure the security group to allow HTTP traffic.&lt;/li&gt;
&lt;li&gt;Click advance details and add website code in the user data.&lt;/li&gt;
&lt;li&gt;Review and launch the instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9e3el579drew8oog1e17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9e3el579drew8oog1e17.png" alt="Image description" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Access the EC2 Instance&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the Public IPv4 address and paste it on new tab.&lt;/li&gt;
&lt;li&gt;click on the Ip and remove 's' from https to http.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6oockwbhjhu6eo13h0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff6oockwbhjhu6eo13h0t.png" alt="Image description" width="800" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>subnet</category>
      <category>vpc</category>
    </item>
    <item>
      <title>Mastering the Basics: Essential Linux Commands</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Thu, 08 Aug 2024 11:20:36 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/mastering-the-basics-essential-linux-commands-1a5n</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/mastering-the-basics-essential-linux-commands-1a5n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;br&gt;
As the backbone of many servers and systems worldwide, Linux is a crucial skill for anyone in the tech industry. When I started my journey into Linux, I realized how powerful and versatile it is, especially when combined with my networking and cloud computing knowledge.&lt;br&gt;
&lt;strong&gt;What is Linux?&lt;/strong&gt;&lt;br&gt;
Linux is an open-source operating system that powers everything from personal computers to large-scale enterprise servers. Learning Linux is not just about mastering another OS; it's about gaining control and flexibility in managing systems efficiently.&lt;br&gt;
Essential Commands for Beginners:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ls - List directory contents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; ls -la lists all files, including hidden ones, with detailed information.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cd - Change directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: cd /var/logs navigates to the logs directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pwd - Print Working Directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; Running pwd in the terminal will display the full path of the current directory, such as /home/user/documents.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rm - Remove (delete) a file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; rm file.txt deletes file.txt.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mkdir - Make a new directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; mkdir new_folder creates a directory named new_folder.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rmdir - Remove an empty directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: rmdir old_folder removes old_folder if it is empty.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rm -r - Remove a directory and its contents recursively&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; rm -r old_folder deletes old_folder and everything inside it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cp - Copy Files or Directories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; cp source.txt destination.txt copies source.txt to destination.txt.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mv - Move or Rename Files or Directories
&lt;strong&gt;Example:&lt;/strong&gt; mv oldname.txt newname.txt renames oldname.txt to newname.txt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tools in Linux:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cat - File Viewing Utility&lt;/li&gt;
&lt;li&gt;touch - File Management Utility&lt;/li&gt;
&lt;li&gt;vi/vim - Text Editors&lt;/li&gt;
&lt;li&gt;nano - Simple Text Editor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;cat - File Viewing Utility:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It displays the contents of a file in the terminal, but it can do much more.&lt;/p&gt;

&lt;p&gt;Command: cat filename.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; cat notes.txt shows everything written inside notes.txt.&lt;/p&gt;

&lt;p&gt;Command:cat file1.txt &amp;gt;&amp;gt; file2.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; cat footer.txt &amp;gt;&amp;gt; report.txt adds the content of footer.txt to the end of report.txt.&lt;/p&gt;

&lt;p&gt;Command: cat &amp;gt; newfile.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; cat &amp;gt; message.txt opens input mode where you can type a message to be saved in message.txt.&lt;/p&gt;

&lt;p&gt;Command: cat file1.txt file2.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; cat header.txt body.txt prints both files' content one after the other.&lt;/p&gt;

&lt;p&gt;Command: tac filename&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; tac file1 will reverse the order of the file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;touch - File Management Utility:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used to create new empty files or update the timestamps of existing files (last accessed or modified). Creating a placeholder file or refreshing the timestamp of a file to mark it as recently modified.&lt;/p&gt;

&lt;p&gt;Command: touch filename.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;touch notes.txt creates a new empty file called notes.txt.&lt;/p&gt;

&lt;p&gt;Command: touch file1.txt file2.txt file3.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;touch project1.txt project2.txt project3.txt creates three empty files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vi/vim - Text Editors:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;vi and vim (Vi IMproved) are powerful text editors in Linux that can seem complex at first, but they offer great flexibility once get the hang of their basic commands. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Opening a File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Command: vi filename.txt or vim filename.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switching Modes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;i (Insert Mode): Press i to enter Insert mode, where you can start typing text.&lt;br&gt;
Esc (Normal Mode): Press Esc to return to Normal mode, where you can use commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inserting and Editing Text&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;i: Insert text before the cursor.&lt;br&gt;
a: Insert text after the cursor.&lt;br&gt;
o: Open a new line below the current line and enter Insert mode.&lt;br&gt;
x: Delete the character under the cursor.&lt;br&gt;
dd: Delete the entire current line.&lt;br&gt;
u: Undo the last change.&lt;br&gt;
Ctrl + r: Redo the undone change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Saving and Exiting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;w: Save the current file.&lt;br&gt;
q: Quit the editor. If there are unsaved changes, it will warn you.&lt;br&gt;
wq: Save and quit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Copy, Cut, and Paste&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;p: Paste the copied or cut text after the cursor.&lt;br&gt;
dd: Cut (delete) the current line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;nano - Simple Text Editor:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;nano is a simple and user-friendly text editor in Linux.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Opening a File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Command: nano filename.txt&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Saving and Exiting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ctrl + O (Write Out): Save the current file. Press Enter to confirm the filename.&lt;br&gt;
Ctrl + X (Exit): Exit the editor. If there are unsaved changes, it will prompt you to save before exiting.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>cli</category>
      <category>aws</category>
      <category>basic</category>
    </item>
    <item>
      <title>EC2 Instance Data Persistence and Migration</title>
      <dc:creator>mahpara jabbar</dc:creator>
      <pubDate>Tue, 06 Aug 2024 10:38:12 +0000</pubDate>
      <link>https://dev.to/mahpara_jabbar_0521a5b816/ec2-instance-data-persistence-and-migration-4glm</link>
      <guid>https://dev.to/mahpara_jabbar_0521a5b816/ec2-instance-data-persistence-and-migration-4glm</guid>
      <description>&lt;p&gt;This EC2 lab involves creating an EC2 instance with multiple volumes, accessing it via RDP, adding data to the volumes, creating an image of the instance, copying the image to a different region, and then verifying the persistence of data. &lt;br&gt;
&lt;strong&gt;Summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create an EC2 Instance&lt;/li&gt;
&lt;li&gt;- Take the RDP of the Instance&lt;/li&gt;
&lt;li&gt;- Add Files and Folders&lt;/li&gt;
&lt;li&gt;- Create an Image of the Instance&lt;/li&gt;
&lt;li&gt;- Copy the Image to a Different Region&lt;/li&gt;
&lt;li&gt;- Create an Instance from the Copied Image in the New Region&lt;/li&gt;
&lt;li&gt;- RDP into the New Instance&lt;/li&gt;
&lt;li&gt;- Check Data Persistence&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Creating an EC2 instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Microsoft Windows Server.&lt;/li&gt;
&lt;li&gt;Select t2.micro as the instance type.&lt;/li&gt;
&lt;li&gt;Root volume (C-drive): Default size 30 GB.&lt;/li&gt;
&lt;li&gt;Additional volume (D-drive): 20GB.&lt;/li&gt;
&lt;li&gt;Launching the instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruxm3il9o3z5wutczy2c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruxm3il9o3z5wutczy2c.png" alt="Image description" width="800" height="164"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:Taking the RDP of this Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select your instance, and click on Connect.&lt;/li&gt;
&lt;li&gt;Choose the RDP client tab, and note the public DNS.&lt;/li&gt;
&lt;li&gt;Decrypt the password using your PEM file&lt;/li&gt;
&lt;li&gt;Use an RDP client (like Microsoft Remote Desktop) to connect&lt;/li&gt;
&lt;li&gt;Use Administrator as the username and the decrypted password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Adding Files and Folders:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Access the C-drive and D-drive within the RDP session.&lt;/li&gt;
&lt;li&gt;Create folders and add files on both drives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Creating an Image of the Instance:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdf8ye4sdm3fwbdot6ya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdf8ye4sdm3fwbdot6ya.png" alt="Image description" width="793" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name the image and add a description.&lt;/li&gt;
&lt;li&gt;Include both volumes in the image.&lt;/li&gt;
&lt;li&gt;Wait for the image (AMI) creation to complete.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Copy the Image to a Different Region:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the destination region.&lt;/li&gt;
&lt;li&gt;Name the copied AMI and add a description.&lt;/li&gt;
&lt;li&gt;Wait for the copy process to complete.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;strong&gt;Step 6: Create an Instance from the Copied Image in that Region:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switching to the destination region(Ohio).&lt;/li&gt;
&lt;li&gt;Go to the AMIs section and select the copied AMI.&lt;/li&gt;
&lt;li&gt;Ensuring the instance type and storage configuration are appropriate then Click on Launch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbwy449bslgx363dog0n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgbwy449bslgx363dog0n.png" alt="Image description" width="779" height="133"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7: RDP into the New Instance:&lt;/strong&gt;&lt;br&gt;
Connecting it to the new instance using the same RDP process as before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8: Check Data Persistence&lt;/strong&gt;&lt;br&gt;
Verify the files and folders created in the C-drive and D-drive are present and unchanged. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>datapersistence</category>
      <category>migration</category>
    </item>
  </channel>
</rss>
