<?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: Yvonne</title>
    <description>The latest articles on DEV Community by Yvonne (@youngtech).</description>
    <link>https://dev.to/youngtech</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%2F1263692%2Feeeef9f8-2959-432f-a468-8793c9b39e2f.jpg</url>
      <title>DEV Community: Yvonne</title>
      <link>https://dev.to/youngtech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/youngtech"/>
    <language>en</language>
    <item>
      <title>How to Change Directory Permissions in Linux (and Why It Matters)</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Tue, 17 Feb 2026 01:33:00 +0000</pubDate>
      <link>https://dev.to/youngtech/how-to-change-directory-permissions-in-linux-and-why-it-matters-37b</link>
      <guid>https://dev.to/youngtech/how-to-change-directory-permissions-in-linux-and-why-it-matters-37b</guid>
      <description>&lt;p&gt;One of the most common tasks in Linux administration is changing directory permissions. You may need to secure sensitive data or set up a shared workspace for your team. Understanding Linux permissions is crucial to managing files and directories.&lt;/p&gt;

&lt;p&gt;Here’s a walkthrough showing how to share a folder with your team by assigning it to the devteam group and applying the correct permissions. This example assumes the devteam group already exists. &lt;/p&gt;

&lt;p&gt;(I’ll cover how to create a group and add members in an upcoming post.)&lt;/p&gt;

&lt;h1&gt;
  
  
  Index
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;Check the current permissions&lt;/li&gt;
&lt;li&gt;Assign the directory to the team group&lt;/li&gt;
&lt;li&gt;Give the owner and group full access&lt;/li&gt;
&lt;li&gt;Confirm the setup&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Check the current permissions
&lt;/h2&gt;

&lt;p&gt;Before changing anything, check the directory permissions:&lt;br&gt;
&lt;code&gt;ls -ld sharedfiles&lt;/code&gt; - Where the directory name is "&lt;strong&gt;sharedfiles&lt;/strong&gt;"&lt;/p&gt;

&lt;p&gt;You'll see:&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%2Fdlubed5ztb3zfs3na6mk.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%2Fdlubed5ztb3zfs3na6mk.png" alt=" " width="800" height="66"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This tells you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Owner: read, write, execute &lt;strong&gt;(rwx)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Group: read, execute &lt;strong&gt;(r-x)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Others: read, execute &lt;strong&gt;(r-x)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Assign the directory to the team group
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;chgrp devteam sharedfiles&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Give the owner and group full access
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;chmod 770 sharedfiles&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;770&lt;/code&gt; is a permission setting that gives full access to the owner and the group, and no access to anyone else.&lt;/p&gt;

&lt;p&gt;7 (owner) → read, write, execute&lt;/p&gt;

&lt;p&gt;7 (group) → read, write, execute&lt;/p&gt;

&lt;p&gt;0 (others) → no permissions at all&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Confirm the changes
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;ls -ld sharedfiles&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F85tmvadbq03w3kg0psll.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%2F85tmvadbq03w3kg0psll.png" alt=" " width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;You (the owner) can read/write/execute&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your team (devteam) can read/write/execute&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No one else can access the folder&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;This is how shared project directories, departmental folders, and collaboration workspaces are secured in production environments. There are other ways to do this on a more granular level using ACL permissions, and I'll leave that for another post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Imagine you’re supporting a development team that needs a shared directory where everyone can collaborate, but you don’t want other users on the system to access or modify the files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonne-young/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
      <category>rhcsa</category>
    </item>
    <item>
      <title>Tighten Security on EC2 Instances: Fast and Simple</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Tue, 15 Apr 2025 07:08:23 +0000</pubDate>
      <link>https://dev.to/youngtech/tighten-security-on-ec2-instances-fast-and-simple-34bj</link>
      <guid>https://dev.to/youngtech/tighten-security-on-ec2-instances-fast-and-simple-34bj</guid>
      <description>&lt;p&gt;When you're managing EC2 instances across your infrastructure, it's easy to get caught up in launching, tagging, and tweaking, but security should always be on your mind. A single open port or misconfigured rule can be all it takes for trouble to find you.&lt;/p&gt;

&lt;p&gt;The good news is that you don’t need to be a security expert to take a few quick steps that make your EC2 environment safer. Today, I’ll show you three simple AWS CLI commands you can run to help lock things down fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Index
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;List All Open Security Group Ports&lt;/li&gt;
&lt;li&gt;Restrict SSH Access to a Specific IP&lt;/li&gt;
&lt;li&gt;Enable Detailed Monitoring for EC2 Instances &lt;/li&gt;
&lt;li&gt;Business Use Case&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. List All Open Security Group Ports
&lt;/h2&gt;

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

&lt;p&gt;&lt;code&gt;aws ec2 describe-security-groups \&lt;br&gt;
  --query "SecurityGroups[*].{Name:GroupName,ID:GroupId,Inbound:IpPermissions}" \&lt;br&gt;
  --output table&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note: the &lt;code&gt;--output&lt;/code&gt; options for this command are text, table or yaml.  For scripting or automation, you can use &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;text&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Running this command gives you an output of tables of the security groups that helps you spot overly open rules (like &lt;code&gt;0.0.0.0/0&lt;/code&gt; on port 22).&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%2F5nwqqysefwnhyxvkm0fj.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%2F5nwqqysefwnhyxvkm0fj.png" alt="Image description" width="798" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; You can quickly review inbound rule across all groups without accessing the AWS Management Console.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Restrict SSH Access to a Specific IP
&lt;/h2&gt;

&lt;p&gt;Change the SSH (&lt;code&gt;port 22&lt;/code&gt;) rule to allow access only from your IP, not the whole world.&lt;br&gt;&lt;br&gt;
When you run the two commands, you change the IP address from "any IP address" to "your IP address". That means that incoming traffic comes from your IP address only, and not all outside traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&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 ec2 revoke-security-group-ingress &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--group-id&lt;/span&gt; sg-0123456789abcdef0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--protocol&lt;/span&gt; tcp &lt;span class="nt"&gt;--port&lt;/span&gt; 22 &lt;span class="nt"&gt;--cidr&lt;/span&gt; 0.0.0.0/0

aws ec2 authorize-security-group-ingress &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--group-id&lt;/span&gt; sg-0123456789abcdef0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--protocol&lt;/span&gt; tcp &lt;span class="nt"&gt;--port&lt;/span&gt; 22 &lt;span class="nt"&gt;--cidr&lt;/span&gt; YOUR.IP.ADDRESS.0/32
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;0.0.0.0/0&lt;/code&gt; means allow access from anywhere on the internet. This tells AWS that any IP address in the world can reach this port on this server.&lt;/li&gt;
&lt;li&gt;It's okay to use &lt;code&gt;0.0.0.0/0&lt;/code&gt; for public-facing services like: Web servers (&lt;code&gt;port 80/443&lt;/code&gt;) or APIs meant to be public.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; This locks down SSH access to our machine only.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Enable Detailed Monitoring for EC2 Instances
&lt;/h2&gt;

&lt;p&gt;Enable CloudWatch detailed monitoring on an instance so you can detect unusual spikes in activity.&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 monitor-instances --instance-ids i-0123456789abcdef0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After running the command monitoring confirmed &lt;strong&gt;enabled&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F81misxfmt7qx9hqpsauh.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%2F81misxfmt7qx9hqpsauh.png" alt="Image description" width="800" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; Helps detect brute-force login attempts, CPU spikes, or suspicious behavior faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Business Use Case
&lt;/h2&gt;

&lt;p&gt;Security is a critical part of running stable, reliable cloud infrastructure.  For teams running production workloads, even one exposed instance can lead to service disruptions, compliance issues, or worse.&lt;/p&gt;

&lt;p&gt;Using CLI commands to audit and lock down EC2 instances gives you a fast and scalable way to apply security best practices across environments without relying entirely on the management console.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;Security doesn’t have to be complicated, and even a few small changes can make a big impact.  Using the AWS CLI to manage security on EC2 instances lets you work faster, especially when you need to apply changes across multiple instances or environments.&lt;/p&gt;

&lt;p&gt;These three commands are a great starting point, but there is a long security checklist your company has to manage security over the entire infrastructure. You should be in the habit of reviewing your EC2 settings, secure what you can, always keep and eye on your cloud.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with using the AWS CLI.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Bash Script to Back Up and EC2 Instance</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Mon, 14 Apr 2025 19:31:46 +0000</pubDate>
      <link>https://dev.to/youngtech/bash-script-to-back-up-and-ec2-instance-4ck6</link>
      <guid>https://dev.to/youngtech/bash-script-to-back-up-and-ec2-instance-4ck6</guid>
      <description>&lt;p&gt;When you're managing EC2 instances in AWS, backups aren't optional, but a critical part of managing your cloud infrastructure. If you’re updating a server, applying patches, or making big configuration changes, having a fresh backup could save you from hours of troubleshooting if something goes wrong.&lt;/p&gt;

&lt;p&gt;Today, I’m going to walk you through a simple Bash script that uses the AWS CLI to create a backup of your EC2 instance without logging into the AWS Management Console. Whether you're managing one server or scaling up to dozens, this simple script can save you a lot of time and headaches down the road.&lt;/p&gt;

&lt;h2&gt;
  
  
  Index
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What This Script Does&lt;/li&gt;
&lt;li&gt;How to Run the EC2 Backup Script&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Open Your Terminal&lt;/li&gt;
&lt;li&gt;Create a New Script File&lt;/li&gt;
&lt;li&gt;Copy and Paste the Script into the File&lt;/li&gt;
&lt;li&gt;Save and Exit the File&lt;/li&gt;
&lt;li&gt;Make the Script Executable&lt;/li&gt;
&lt;li&gt;Run the Script&lt;/li&gt;
&lt;li&gt;Business Use Case&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What This Script Does:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Sets variables     - Defines your instance ID and region&lt;/li&gt;
&lt;li&gt;Generates a backup name - Creates a timestamped name like &lt;code&gt;Backup-2025-04-14-10-45-30&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Creates an AMI - Calls &lt;code&gt;aws ec2 create-image&lt;/code&gt; command using the AWS CLI&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;--no-reboot flag&lt;/code&gt; - Creates an AMI without rebooting the instance &lt;/li&gt;
&lt;li&gt;Creates a Success message - Prints confirmation message at the end&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important Notes:&lt;/strong&gt;&lt;br&gt;
This is a very simple script to demonstrate the possibilities of using bash scripting for backups, so it doesn't do everything:&lt;/p&gt;

&lt;p&gt;✅ --no-reboot: Skips rebooting the instance for faster backup.&lt;br&gt;
If you want a more consistent backup, remove &lt;code&gt;--no-reboot&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;✅ This only backs up the instance and its root volume.&lt;br&gt;
If you have additional EBS volumes attached, you’ll want to create snapshots for those too and that's a separate script.&lt;/p&gt;

&lt;p&gt;✅ The script doesn't automatically clean up old backups. You can later write another script to delete old AMIs if you want.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Run the EC2 Backup Script
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Checklist Before Running the Script:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure AWS CLI is installed - Check the version by running &lt;code&gt;aws --version&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Configure AWS CLI - Configure it by running &lt;code&gt;aws configure&lt;/code&gt; (set the access key, secret access key, and region)&lt;/li&gt;
&lt;li&gt;Make sure your AWS CLI region matches your EC2 instance region&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flz7i39s1bph3w1rwi9vq.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%2Flz7i39s1bph3w1rwi9vq.png" alt="Image description" width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Open Your Terminal
&lt;/h3&gt;

&lt;p&gt;If you're on Linux or Mac ➔ open Terminal.&lt;/p&gt;

&lt;p&gt;If you're on Windows ➔ open PowerShell, Command Prompt, or Git Bash (recommended).&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Create a New Script File
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;.sh&lt;/code&gt; Bash script file where you want it.&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt; &lt;code&gt;nano backup-ec2.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhlmc7o2xlswykff2keu.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%2Fbhlmc7o2xlswykff2keu.png" alt="Image description" width="638" height="111"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ This opens a new empty file for editing.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Copy and Paste the Script Into the File
&lt;/h3&gt;

&lt;p&gt;Paste this content:&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;# Check if an instance ID was provided&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-z&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Usage: &lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="s2"&gt; &amp;lt;instance-id&amp;gt;"&lt;/span&gt;
  &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# Set your variables&lt;/span&gt;
&lt;span class="nv"&gt;INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;                  &lt;span class="c"&gt;# Get the instance ID from the first argument&lt;/span&gt;
&lt;span class="nv"&gt;REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;                 &lt;span class="c"&gt;# &amp;lt;-- Replace with your AWS Region&lt;/span&gt;
&lt;span class="nv"&gt;BACKUP_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Backup-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%F-%H-%M-%S&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;   &lt;span class="c"&gt;# Backup name with timestamp&lt;/span&gt;

&lt;span class="c"&gt;# Create the AMI&lt;/span&gt;
aws ec2 create-image &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--instance-id&lt;/span&gt; &lt;span class="nv"&gt;$INSTANCE_ID&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$BACKUP_NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--no-reboot&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="nv"&gt;$REGION&lt;/span&gt;

&lt;span class="c"&gt;# Output success message&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Backup started for Instance ID &lt;/span&gt;&lt;span class="nv"&gt;$INSTANCE_ID&lt;/span&gt;&lt;span class="s2"&gt; with AMI name &lt;/span&gt;&lt;span class="nv"&gt;$BACKUP_NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Make sure you replace: REGION with your correct AWS region (like us-west-2, us-east-1)&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Save and Exit the File
&lt;/h3&gt;

&lt;p&gt;If using vim: Press &lt;strong&gt;Esc&lt;/strong&gt;, type &lt;code&gt;:wq&lt;/code&gt;, and press Enter.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Make the Script Executable
&lt;/h3&gt;

&lt;p&gt;You need to give permission to run the script&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;chmod +x backup-ec2.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhqtplb0bd0t2uzklg3zx.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%2Fhqtplb0bd0t2uzklg3zx.png" alt="Image description" width="800" height="194"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux Note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When the script file, &lt;strong&gt;backup-ec2.sh&lt;/strong&gt; was created, it was not an executable file shown listed as &lt;code&gt;-rw-rw-r--&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;After running the command, &lt;code&gt;chmod +x backup-ec2.sh&lt;/code&gt;, the script is now executable indicated by &lt;code&gt;-rwxrwxr-x&lt;/code&gt; and the script file is highlighted in &lt;strong&gt;green&lt;/strong&gt; to show that it has &lt;strong&gt;execute permissions&lt;/strong&gt; (x) set for the owner, group and others.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ Now the script can be executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Run the Script and Pass the Instance ID
&lt;/h3&gt;

&lt;p&gt;Now just run it!&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;./backup-ec2.sh i-00cb2dd8e85b84fe7&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx4jqzlu65kmyar9df71h.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%2Fx4jqzlu65kmyar9df71h.png" alt="Image description" width="800" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two things about this script:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;$1&lt;/code&gt; on the line &lt;code&gt;INSTANCE_ID="$1"&lt;/code&gt; allows you to pass the EC2 instance ID as an argument when you run the script so you don't have to add the instance ID to the script&lt;/li&gt;
&lt;li&gt;Will generate an &lt;strong&gt;Imageid&lt;/strong&gt; number&lt;/li&gt;
&lt;li&gt;If you don't give an instance ID when running script, it will display a helpful message reminding you the instance ID is missing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyt6crpslc6qumlvmc9sp.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%2Fyt6crpslc6qumlvmc9sp.png" alt="Image description" width="681" height="106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ The script will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Call AWS CLI to run the Linux command &lt;code&gt;aws ec2 create-image&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create an AMI backup of your EC2 instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Print a success message:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;Backup started **for **Instance ID **i-00cb2dd8e85b84fe7** **with **AMI name **Backup**-2025-04-14-19-23-57&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;if you want to find out which &lt;strong&gt;AMI image ID&lt;/strong&gt; an EC2 instance is using the AWS CLI, here's the command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;aws ec2 describe-instances&lt;/code&gt; \&lt;br&gt;
  &lt;code&gt;--instance-ids i-0123456789abcdef0&lt;/code&gt; \&lt;br&gt;
  &lt;code&gt;--query "Reservations[*].Instances[*].ImageId"&lt;/code&gt; \&lt;br&gt;
  &lt;code&gt;--output text&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;✅ Replace the &lt;code&gt;instance-ids&lt;/code&gt; with your actual EC2 Instance ID.&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%2Fm1mknh2fiuzlcm388eds.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%2Fm1mknh2fiuzlcm388eds.png" alt="Image description" width="800" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;describe-instances&lt;/code&gt; - Get all information about the EC2 instance&lt;br&gt;
&lt;code&gt;--instance-ids&lt;/code&gt; - Specify which instance you are checking&lt;br&gt;
&lt;code&gt;--query&lt;/code&gt;- Pull only the ImageId field &lt;br&gt;
&lt;code&gt;--output text&lt;/code&gt;    Display it in text&lt;/p&gt;

&lt;p&gt;Finally, you can also verify the AMI was created by signing on to the AWS Management Console and verify the AMI image was created.&lt;br&gt;
In the Management console, go to &lt;strong&gt;EC2 **and under **Images&lt;/strong&gt;, select &lt;strong&gt;AMIs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftwdles2zd8m1jscuvxr6.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%2Ftwdles2zd8m1jscuvxr6.png" alt="Image description" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Business Use Case
&lt;/h2&gt;

&lt;p&gt;If you have an EC2 instance with Amazon Linux, Apache, custom applications and configurations when you create an Amazon Machine Image (AMI) all of that is captured.  Later, you can launch new servers identical to that setup anywhere in the AWS cloud infrastructure. Most importantly, having an up-to-date Amazon Machine Images (AMIs) ensures you can quickly recover if something goes wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Summary
&lt;/h2&gt;

&lt;p&gt;There are more complex scripts you can write for backing up resources, but I just wanted to illustrate the power of scripting using Linux commands.  Automation is the name of the game, and cloud engineers are always looking for clean, fast and efficient ways automate to maintain consistency, minimize downtime risks, and streamline their disaster recovery processes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with using the AWS CLI.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Add or Update a Tag on an EC2 Instance Using AWS CLI</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Mon, 14 Apr 2025 03:13:15 +0000</pubDate>
      <link>https://dev.to/youngtech/add-or-update-a-tag-on-an-ec2-instance-using-aws-cli-3pbm</link>
      <guid>https://dev.to/youngtech/add-or-update-a-tag-on-an-ec2-instance-using-aws-cli-3pbm</guid>
      <description>&lt;p&gt;When you're managing AWS resources like EC2 instances, keeping things organized is key especially as your environment grows. One of the easiest and most effective ways to stay organized is by using tags. Tags let you add key-value pairs to your resources, making it easier to track, sort, and manage everything.&lt;/p&gt;

&lt;p&gt;Today, I’ll show you how to quickly add or update a tag on an EC2 instance using a simple AWS CLI command. It's quick and a habit that will make your cloud life a lot easier down the road.&lt;/p&gt;

&lt;p&gt;1. Add or Update a Tag on an EC2 Instance&lt;br&gt;
2. Business Use Case&lt;br&gt;
3. Summary&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Add or Update a Tag on an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;This command adds or updates a tag on an EC2 instance using AWS CLI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 create-tags&lt;/code&gt;\&lt;br&gt;
  &lt;code&gt;--resources i-0123456789abcdef0&lt;/code&gt; \&lt;br&gt;
  &lt;code&gt;--tags Key=Environment,Value=Production&lt;/code&gt; \ &lt;br&gt;
  &lt;code&gt;--region us-east-1&lt;/code&gt;   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw9zvkmrbm77akjnwo0pm.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%2Fw9zvkmrbm77akjnwo0pm.png" alt="Image description" width="792" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Just replace the instance ID and region with your own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 create-tags&lt;/code&gt; - Main AWS CLI command to add or update tags&lt;br&gt;
&lt;code&gt;--resources&lt;/code&gt;        - Specifies the EC2 instance (or multiple instances) you want to tag&lt;br&gt;
&lt;code&gt;--tags&lt;/code&gt;             - Defines the key and value for the tag&lt;br&gt;
&lt;code&gt;--region&lt;/code&gt;           - sets which AWS region you're working in&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%2F46nwd4syczsx3s9cmnx2.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%2F46nwd4syczsx3s9cmnx2.png" alt="Image description" width="800" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ If the tag &lt;strong&gt;already exists&lt;/strong&gt;, this command &lt;strong&gt;updates&lt;/strong&gt; it to the new value.&lt;br&gt;
✅ If the tag &lt;strong&gt;doesn't exist&lt;/strong&gt;, it &lt;strong&gt;creates it&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Business Use Case
&lt;/h2&gt;

&lt;p&gt;By tagging EC2 instances with keys like &lt;strong&gt;Environment=Production&lt;/strong&gt; or &lt;strong&gt;Owner=DevTeam&lt;/strong&gt;, companies can easily generate cost reports, enforce automation scripts, or quickly identify critical systems during incidents.  Without proper tagging, cloud environments can quickly become chaotic and expensive.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Summary
&lt;/h2&gt;

&lt;p&gt;In real-world cloud environments, tagging resources isn’t just a nice-to-have; it's a best practice. Tags help teams track costs, manage environments, enforce security policies, and even automate processes across hundreds or thousands of resources. Tagging may seem like a small detail, but it really adds up once you're managing dozens or hundreds of AWS resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Automate Your EC2 Setup Using AWS CLI and User Data</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Mon, 14 Apr 2025 00:49:03 +0000</pubDate>
      <link>https://dev.to/youngtech/automate-your-ec2-setup-using-aws-cli-and-user-data-3n84</link>
      <guid>https://dev.to/youngtech/automate-your-ec2-setup-using-aws-cli-and-user-data-3n84</guid>
      <description>&lt;p&gt;When I first dove into AWS services, spinning up an EC2 instance server felt like an accomplishment in itself. But the real thrill? Watching that server configure itself automatically with no manual tinkering required. That’s when working with EC2 instances truly starts to feel like magic.  &lt;/p&gt;

&lt;p&gt;In this article, we’ll build a basic Apache web server on an EC2 instance using AWS CLI and a simple Bash script. We’ll even verify that the webpage is live!&lt;/p&gt;

&lt;h2&gt;
  
  
  Index
&lt;/h2&gt;

&lt;p&gt;1. What You Will Build&lt;br&gt;
2. Tools You will Need&lt;br&gt;
3. User Data Script&lt;br&gt;
4. Launching the Instance with User Data&lt;br&gt;
5. Quick Steps to Follow&lt;br&gt;
6. A Few Pro Tips&lt;br&gt;
7. Business Use Case&lt;br&gt;
8. Summary&lt;/p&gt;
&lt;h2&gt;
  
  
  1. What You Will Build
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We’ll launch an EC2 instance that:&lt;/li&gt;
&lt;li&gt;Automatically installs an Apache webserver (httpd).&lt;/li&gt;
&lt;li&gt;Starts the Apache service.&lt;/li&gt;
&lt;li&gt;Creates a basic webpage (index.html).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This leaves the server ready for you to visit the public IP address and see the site live!&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Tools You Will Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS CLI installed and configured
(&lt;code&gt;sudo yum install aws-cli -y&lt;/code&gt; and &lt;code&gt;aws configure&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;An existing AWS Key Pair (for SSH, if needed) &lt;/li&gt;
&lt;li&gt;A Security Group that allows port 22 (SSH) and port 80 (HTTP) inbound&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  3. User Data Script
&lt;/h2&gt;

&lt;p&gt;Here's the basic script we'll use:&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;

yum update &lt;span class="nt"&gt;-y&lt;/span&gt;
yum &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; httpd
systemctl start httpd
systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;httpd
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;h1&amp;gt;Welcome to the World of Cloud Engineers!&amp;lt;/h1&amp;gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /var/www/html/index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;This Bash script:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updates packages&lt;/li&gt;
&lt;li&gt;Installs the Apache web server&lt;/li&gt;
&lt;li&gt;Starts and enables the web server&lt;/li&gt;
&lt;li&gt;Creates a basic HTML homepage&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Launching the Instance with User Data
&lt;/h2&gt;

&lt;p&gt;Here's the AWS CLI Command:&lt;br&gt;
&lt;code&gt;aws ec2 run-instances&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--image-id ami-0abcdef1234567890&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--count 1&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--instance-type t2.micro&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--key-name MyKeyPair&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--security-group-ids sg-0123456789abcdef0&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--subnet-id subnet-0123456789abcdef0&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--associate-public-ip-address&lt;/code&gt; \&lt;br&gt;
   &lt;code&gt;--user-data file://setup-apache.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Notice the important part:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--user-data file://setup-apache.sh&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;setup-apache.sh&lt;/code&gt; is a local file containing the script above.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;file://&lt;/code&gt; prefix tells AWS CLI to read the file and send it as &lt;strong&gt;base65-encoded user data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You use the &lt;code&gt;--associate-public-ip-address&lt;/code&gt; to request that AWS automatically assigns a public IP address to your new EC2 instance when you launch it into a subnet that does not automatically assign public IPs by default.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You don't "&lt;strong&gt;get&lt;/strong&gt;" the &lt;code&gt;--associate-public-ip-address&lt;/code&gt; option from AWS; it's a flag you add manually into your CLI command when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Quick Steps to Follow
&lt;/h2&gt;

&lt;p&gt;5.1 - Create your script file:&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;nano setup-apache.sh&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv7g7b0jxrmcvei0d1y4s.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%2Fv7g7b0jxrmcvei0d1y4s.png" alt="Image description" width="800" height="150"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paste the bash script above into the file and save it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5.2 - Make sure the file is saved in the same directory where you run your AWS CLI command.&lt;br&gt;
 5.3 Run the &lt;code&gt;aws ec2 run-instances&lt;/code&gt; command with &lt;code&gt;--user-data&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5hvcw9d3pi8z7y11ntyr.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%2F5hvcw9d3pi8z7y11ntyr.png" alt="Image description" width="729" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.4 Wait for the instance to launch and initialize.&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%2Flp1vhpyhbsy9w992osj8.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%2Flp1vhpyhbsy9w992osj8.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.5 Get the public IP:&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 describe-instances --query 'Reservations[*].Instances[*].PublicIpAddress' --output text&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl0dqrg3cwx3iz5kta4rl.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%2Fl0dqrg3cwx3iz5kta4rl.png" alt="Image description" width="800" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.6 Open your browser and visit:&lt;br&gt;
&lt;code&gt;http://&amp;lt;your-instance-public-ip&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;✅ You should see: "&lt;strong&gt;Welcome to the World of Cloud Engineers!&lt;/strong&gt;"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw0mghdnjmsx6fsn2we0z.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%2Fw0mghdnjmsx6fsn2we0z.png" alt="Image description" width="677" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. A Few Pro Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Keep your user data scripts simple especially if you’re just starting out.&lt;/li&gt;
&lt;li&gt;User data script only runs once the very first time the instance boots.&lt;/li&gt;
&lt;li&gt;If testing fails, check the instance's /var/log/cloud-init-output.log to debug.&lt;/li&gt;
&lt;li&gt;Make sure your security group allows HTTP traffic (port 80) or you won't see the webpage!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Business Use Case
&lt;/h2&gt;

&lt;p&gt;Instead of logging into the server every time to set things up manually, you can preload a script that runs the moment the instance boots for the first time. This saves time, reduces mistakes, and it falls in line with automation in the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Summary
&lt;/h2&gt;

&lt;p&gt;Using the AWS CLI and User Data field lets you automate an EC2 instance server setup without even logging into the instance.&lt;br&gt;
It’s a key feature to use for cloud engineers, DevOps, and anyone looking to build real-world cloud deployments.&lt;/p&gt;

&lt;p&gt;The Next time you launch an instance, give it a little brainpower using the User Data field, and save yourself a ton of setup time!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with using the AWS CLI.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>AWS Documentation: Your Essential Reference for Linux Command Lines</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Sun, 13 Apr 2025 07:10:26 +0000</pubDate>
      <link>https://dev.to/youngtech/aws-documentation-your-essential-reference-for-linux-command-lines-4bk2</link>
      <guid>https://dev.to/youngtech/aws-documentation-your-essential-reference-for-linux-command-lines-4bk2</guid>
      <description>&lt;p&gt;If you've ever tried to track down the exact syntax for an AWS CLI command and felt stuck, you're definitely not alone.  The AWS Documentation website is an invaluable resource for navigating the complexity of AWS. In this article, I'll demonstrate how to use it effectively with a real-life example: starting an EC2 instance using the AWS CLI. &lt;/p&gt;

&lt;p&gt;1. A Goldmine of Resources&lt;br&gt;
2. How to Quickly Find What You Need&lt;br&gt;
3. Why AWS Documentation Matters&lt;br&gt;
4. Summary&lt;/p&gt;

&lt;h2&gt;
  
  
  1. A Goldmine of Resources
&lt;/h2&gt;

&lt;p&gt;Not only will you find a full command library for working with AWS services, but you’ll also discover step-by-step instructions for building real-world projects. Want to host a WordPress blog on Amazon EC2? No problem, you'll find full instructions, sample commands, and best practices are right there.&lt;/p&gt;

&lt;p&gt;The AWS Documentation site has so much more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS service guides&lt;/li&gt;
&lt;li&gt;Whitepapers&lt;/li&gt;
&lt;li&gt;Best practice playbooks&lt;/li&gt;
&lt;li&gt;Sample code&lt;/li&gt;
&lt;li&gt;User guides&lt;/li&gt;
&lt;li&gt;CLI references&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s seriously a wealth of knowledge that many people overlook.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How to Quickly Find What You Need
&lt;/h2&gt;

&lt;p&gt;Here's a quick tip I use all the time: Let’s say you need to start an EC2 instance but can’t recall the command syntax. &lt;/p&gt;

&lt;p&gt;a. Just jump to your browser and type &lt;code&gt;aws cli reference&lt;/code&gt;. The first hit in your browser you see is &lt;strong&gt;AWS CLI Command Reference&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2daqhd0me7pt4rjh7pjo.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%2F2daqhd0me7pt4rjh7pjo.png" alt="Image description" width="514" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;b. On that page, scroll down to the &lt;strong&gt;Available Services&lt;/strong&gt; section.&lt;br&gt;
You'll see a huge list of all of the AWS Services.&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%2Famn9qfm9ld8epu3ni0ot.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%2Famn9qfm9ld8epu3ni0ot.png" alt="Image description" width="462" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;c. &lt;strong&gt;Pick your service:&lt;/strong&gt;&lt;br&gt;
Since there are so many services on a page like this, no need to scroll endlessly. Just press &lt;code&gt;CTRL + F&lt;/code&gt; and search for what you need. For example, in the search box at the top of the page, type &lt;strong&gt;ec2&lt;/strong&gt; to jump right to the EC2 Instance service.&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%2Fyldqrr8y4e7yi0phryu9.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%2Fyldqrr8y4e7yi0phryu9.png" alt="Image description" width="515" height="245"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;d. Click on the &lt;strong&gt;EC2&lt;/strong&gt; and then scroll to the &lt;strong&gt;Available Commands&lt;/strong&gt; section.&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%2F9nee03usg8pb44at0cxx.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%2F9nee03usg8pb44at0cxx.png" alt="Image description" width="532" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;e. Press &lt;code&gt;CTRL + F&lt;/code&gt; and search for what you need.  For example, type &lt;code&gt;start&lt;/code&gt; or &lt;code&gt;stop&lt;/code&gt; to jump right to the instance management commands.&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%2F75tti0lv1uw3h9netd7i.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%2F75tti0lv1uw3h9netd7i.png" alt="Image description" width="469" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;f. Click on the command link &lt;code&gt;start-instances&lt;/code&gt; and on that page, scroll down to the &lt;strong&gt;Examples&lt;/strong&gt; section to a sample command.&lt;br&gt;
Here you will find the syntax for starting an instance:&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F77xudtkcp3wa0xmvja5k.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%2F77xudtkcp3wa0xmvja5k.png" alt="Image description" width="790" height="76"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Terminal Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fue5aec9zd4u2ngejx588.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%2Fue5aec9zd4u2ngejx588.png" alt="Image description" width="505" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation and Use Case:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The command &lt;code&gt;aws ec2 start-instances&lt;/code&gt; initiates a stopped EC2 instance using its unique &lt;code&gt;instance-id&lt;/code&gt;. The output confirms the transition of the instance's state from &lt;code&gt;stopped&lt;/code&gt; to &lt;code&gt;pending&lt;/code&gt;. This ability is crucial for managing resources efficiently, especially in scenarios where cost-saving measures demand stopping instances during off-peak hours and restarting them as needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Why AWS Documentation Matters
&lt;/h2&gt;

&lt;p&gt;AWS Documentation is more than just a reference; it’s a lifesaver. For commands to manage your AWS Service, the website provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Command Syntax:&lt;/strong&gt; Clear examples like the one above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Detailed Descriptions:&lt;/strong&gt; Understand not just the "how" but also the "why."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Cases:&lt;/strong&gt; Learn practical applications to solve real-world problems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By leveraging this resource, you can simplify workflows, minimize errors, and enhance your productivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Summary
&lt;/h2&gt;

&lt;p&gt;While today I’m focusing on Linux commands, this is only a small piece of what’s available on the AWS Documentation website.  There’s a massive library of content for just about anything you want to do in AWS.&lt;/p&gt;

&lt;p&gt;Here’s the link: 👉 &lt;a href="https://docs.aws.amazon.com/" rel="noopener noreferrer"&gt;AWS Documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I visit it all the time.  Bookmark it, add it to your resources list, and start using it.  It’s one of the best ways to level up your AWS and Linux skills without getting overwhelmed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Managing EC2 Instances with the AWS CLI</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Sat, 12 Apr 2025 01:57:31 +0000</pubDate>
      <link>https://dev.to/youngtech/managing-ec2-instances-with-the-aws-cli-4l2k</link>
      <guid>https://dev.to/youngtech/managing-ec2-instances-with-the-aws-cli-4l2k</guid>
      <description>&lt;p&gt;As a Cloud or DevOps engineer, proficiency and automation are key to managing a cloud infrastructure. While the AWS Management Console is visually appealing and user-friendly, if there is a high workload it may get cumbersome managing dozens or more of instances. The AWS CLI is a great tool for managing  AWS Services directly from the command line.  &lt;/p&gt;

&lt;p&gt;In this article, I’ll walk you through how to manage EC2 instances using the AWS CLI. We’ll cover commands to launch, list, and terminate instances, explain their syntax, and discuss why CLI management is a valuable for your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Index
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Why use the AWS CLI Instead of the Management Console?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;1. Set Up AWS CLI on Amazon Linux&lt;br&gt;
2. Launch and EC2 Instance&lt;br&gt;
3. List All EC2 Instances&lt;br&gt;
4. Delete or Terminate an EC2 Instance&lt;br&gt;
5. Business Use Case: CLI Over Console&lt;br&gt;
6. Summary&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use the AWS CLI Instead of the Management Console?
&lt;/h2&gt;

&lt;p&gt;While the AWS Management Console is great for small workloads, as the cloud environment scales, using AWS CLI has significant advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency:&lt;/strong&gt; Perform complex actions in seconds, without navigating through multiple console screens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automation:&lt;/strong&gt; Easily integrate CLI commands into scripts for tasks that need to be repeated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; Manage multiple resources at once, like starting or stopping dozens of instances with a single command.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flexibility:&lt;/strong&gt; Access AWS from anywhere with a terminal, and there is no need to rely on a web interface.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Set Up AWS CLI on Amazon Linux
&lt;/h2&gt;

&lt;p&gt;Before diving into the EC2 commands, ensure that AWS CLI is installed and configured on your Amazon Linux machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install AWS CLI&lt;/strong&gt;&lt;br&gt;
Amazon Linux generally comes with AWS CLI pre-installed. If not, you can install it:&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%2F0ifjw0nuzfep4cp1fbn4.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%2F0ifjw0nuzfep4cp1fbn4.png" alt="Image description" width="800" height="109"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configure AWS CLI&lt;/strong&gt;&lt;br&gt;
After installation, configure your AWS credentials:&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%2Fvgeo4w2dr1wo5yel8p5g.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%2Fvgeo4w2dr1wo5yel8p5g.png" alt="Image description" width="800" height="131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You'll need to provide:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Access Key ID&lt;/li&gt;
&lt;li&gt;AWS Secret Access Key&lt;/li&gt;
&lt;li&gt;Default region (e.g., use-east-1)&lt;/li&gt;
&lt;li&gt;Output format (none)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Launch an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Start off by launching a new EC2 instance&lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt; &lt;br&gt;
&lt;code&gt;aws ec2 run-instances --image-id ami-00c1e19c6845d02f0 --count 1 --instance-type t2.micro --key-name us-east-kp6 --security-group-ids sg-00df97ec3b4d8bc5f --subnet-id subnet-0386d618164fbad2f --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=WebServer1}]'&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F054914gm2fmc2mfc10x2.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%2F054914gm2fmc2mfc10x2.png" alt="Image description" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this command, you will need the &lt;code&gt;AMI image id&lt;/code&gt;, &lt;code&gt;key pair&lt;/code&gt;, &lt;code&gt;security group id&lt;/code&gt; and the &lt;code&gt;subnet id&lt;/code&gt;. You can get these from an existing EC2 instance or you can run these commands in the AWS CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;aws ec2 describe-images --owners amazon --filters "Name=name,Values=amzn2-ami-hvm-*" --query "Images[*].[ImageId,Name]" --output table&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;aws ec2 describe-security-groups --query "SecurityGroups[*].[GroupId,GroupName]" --output table&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;aws ec2 describe-subnets --query "Subnets[*][SubnetId,AvailabilityZone]" --output table&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
--&lt;code&gt;image-id&lt;/code&gt;: The AMI ID to use for the instance. Replace AMI ID with your desired AMI.&lt;br&gt;
--&lt;code&gt;count&lt;/code&gt;: The number of instances to launch (set to 1 for a single instance).&lt;br&gt;
--&lt;code&gt;instance-type&lt;/code&gt;: The instance type (e.g., t2.micro for general-purpose usage).&lt;br&gt;
--&lt;code&gt;key-name&lt;/code&gt;: The name of your key pair for SSH access.&lt;br&gt;
--&lt;code&gt;security-group-ids&lt;/code&gt;: The security group(s) to associate with the instance.&lt;br&gt;
--&lt;code&gt;subnet-id&lt;/code&gt;: The subnet where the instance will be launched.&lt;br&gt;
--&lt;code&gt;tag-specifications&lt;/code&gt;: Assign tags to the instance (e.g., Name=MyInstance).&lt;br&gt;&lt;br&gt;
Assigning tags to instances is important because if you are working with multiple servers, tagging makes it easy to search for an instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
You’re provisioning a new web server or application instance and need it up and running quickly. This command handles everything from specifying the AMI to tagging the instance for easy identification.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. List All EC2 Instances
&lt;/h2&gt;

&lt;p&gt;After launching instances, you can review what's running on your account using the command below: &lt;br&gt;
&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,Tags[?Key=='Name'].Value|[0]]" --output table&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbhzdew6cl7gvlq2n2td0.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%2Fbhzdew6cl7gvlq2n2td0.png" alt="Image description" width="800" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
--&lt;code&gt;describe-instances&lt;/code&gt;: Retrieves details of all EC2 instances.&lt;br&gt;
--&lt;code&gt;query&lt;/code&gt;: Filters and formats the output to show Instance ID, state, and name tag.&lt;br&gt;
--&lt;code&gt;output&lt;/code&gt;: Specifies the format for output (table is used here for readability)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt;&lt;br&gt;
This command gives you a summary of all your instances, and also to check their status.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Delete or Terminate an EC2 Instance
&lt;/h2&gt;

&lt;p&gt;When an instance is no longer needed, terminate it to save costs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;aws ec2 terminate-instances --instance-ids i-0123456789abcdef0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftwf7j1aqxyobf2n84osr.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%2Ftwf7j1aqxyobf2n84osr.png" alt="Image description" width="800" height="71"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
--&lt;code&gt;terminate-instances&lt;/code&gt;: Permanently deletes the specified instance(s).&lt;br&gt;
--&lt;code&gt;instance-ids&lt;/code&gt;: The ID of the instance you want to terminate. Replace instance ID in the command with the actual instance ID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; &lt;br&gt;
You’ve created a temporary testing environment and now need to clean it up. Terminating instances ensures you’re not billed unnecessarily.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Business Use Case: CLI Over Console
&lt;/h2&gt;

&lt;p&gt;Here's why DevOps engineers love the AWS CLI for managing EC2 instances:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Faster Provisioning:&lt;/strong&gt; Scripts can be used to launch multiple instances at once, saving hours compared to the manual console process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automation:&lt;/strong&gt; Integrate CLI commands into CI/CD pipelines for automated deployments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost Optimization:&lt;/strong&gt; Quickly identify and terminate idle or underutilized instances, helping businesses save on AWS costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consistency:&lt;/strong&gt; Scripts ensure repeatable, error-free infrastructure deployment.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Imagine a scenario where your team needs to deploy a testing environment with 10 instances. A script can be written that launches them in seconds. Another script terminates them when done, saving time, reducing errors, and simplifying the workflow of the DevOps engineer.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Summary
&lt;/h2&gt;

&lt;p&gt;Managing EC2 instances via the AWS CLI is a must-have skill for DevOps engineers. Not only does it streamline repetitive tasks, but it also opens the door to powerful automation. With commands like run-instances, describe-instances, and terminate-instances, you can manage your infrastructure more effectively while minimizing costs and errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with using the AWS CLI.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Systemctl Basics: Managing Your Linux Services</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Thu, 10 Apr 2025 22:46:45 +0000</pubDate>
      <link>https://dev.to/youngtech/systemctl-basics-managing-your-linux-services-2akh</link>
      <guid>https://dev.to/youngtech/systemctl-basics-managing-your-linux-services-2akh</guid>
      <description>&lt;p&gt;Ever found yourself staring at your Linux terminal, wondering how to restart a service and make sense of those &lt;code&gt;systemctl&lt;/code&gt; commands? Whether it’s fixing a monitoring a system, troubleshooting, or just poking around your system, getting the hang of &lt;code&gt;systemctl&lt;/code&gt; is puts you in control of managing Linux services with ease.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Systemctl&lt;/code&gt; is a command-line tool used in Linux to control and manage the &lt;code&gt;systemd&lt;/code&gt; service manager. Think of &lt;code&gt;systemctl&lt;/code&gt; as a way to start, stop, restart, enable/disable, and check the status of services like, web servers, databases, networking, etc on a Linux machine. Go to the Linux man pages, &lt;code&gt;man systemctl&lt;/code&gt; to see all of the commands and options available.&lt;/p&gt;

&lt;h1&gt;
  
  
  Index
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Common Systemctl Commands to Know&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Check the Status of a Service&lt;/li&gt;
&lt;li&gt;Start or Stop a Service&lt;/li&gt;
&lt;li&gt;Enable or Disable a Service at Boot&lt;/li&gt;
&lt;li&gt;Restart a Service&lt;/li&gt;
&lt;li&gt;Advance Systemctl Tips&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Common Systemctl Commands to Know
&lt;/h2&gt;

&lt;p&gt;The most commonly used &lt;code&gt;systemctl&lt;/code&gt; commands by network engineers are to start, stop, restart and monitor Linux services. Run go to the Linux man pages, by running &lt;code&gt;man systemctl&lt;/code&gt; to see all of the options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the Status of a Service
&lt;/h2&gt;

&lt;p&gt;This command checks the status of a service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;systemctl status httpd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7smcl3ysdbm0seb1z89o.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%2F7smcl3ysdbm0seb1z89o.png" alt="Image description" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; - When a service is not running or you are troubleshooting, the status command is the first command you run to check a service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start or Stop a Service
&lt;/h2&gt;

&lt;p&gt;This command starts a service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;systemctl start httpd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2ywycf5dxoujlv9mi7l.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%2Fl2ywycf5dxoujlv9mi7l.png" alt="Image description" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; - If a service abruptly starts, you can quickly start the service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enable or Disable a Service at Boot
&lt;/h2&gt;

&lt;p&gt;This command enables a service.  When a service is enabled, it automatically starts when a server is rebooted. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt;  - &lt;code&gt;systemctl enable sshd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtmv8ignzwo08872o06f.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%2Fjtmv8ignzwo08872o06f.png" alt="Image description" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; - By enabling the sshd service, it allows you to remotely connect to your server over a network or remote terminal access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restart a Service
&lt;/h2&gt;

&lt;p&gt;This command restarts a service that is already running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;systemctl restart httpd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6laee8hy5jk5s00xujju.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%2F6laee8hy5jk5s00xujju.png" alt="Image description" width="798" height="274"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; - Restarting a service is different that starting a service.  When you make configuration changes to a service such as NGNIX or Apache, it has to be restarted for the changes to take effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advance Systemctl Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;View a specific service that is running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - `systemctl --type=service --state=running | grep "httpd"&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%2F7de1lpre82mgautchux8.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%2F7de1lpre82mgautchux8.png" alt="Image description" width="800" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; There are many services running and you want to quickly search for a specific service. This saves you time when troubleshooting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check for only service unit files and exclude other unit files. This command shows you which services will start at boot and you can spot disabled services you may want to enable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;systemctl list-unit-files --type=services&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd1fbuem7bjuftbaybndd.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%2Fd1fbuem7bjuftbaybndd.png" alt="Image description" width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; A fast way to check for only "service unit files" as oppose to all unit files when you are only interested in the Linux services. Quick filtering speeds up troubleshooting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checked for failed services. This is a good command for troubleshooting to check if services are not running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;systemctl --type-service --state--failed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffjvvjzwy5gjbw212t9cg.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%2Ffjvvjzwy5gjbw212t9cg.png" alt="Image description" width="800" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;For network engineers, the &lt;code&gt;systemctl&lt;/code&gt;command and important command for  monitoring and keeping critical services up and running. You can start, stop or restart these services in seconds, making troubleshooting and maintenance less stressful.  Plus, it lets you automate service startups after a reboot, saving you the problem of downtime. For anyone managing a network infrastructure, mastering this command is all about having control and staying ahead of the game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Linux Search Commands: Essential Tools for Incidence Response</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Thu, 10 Apr 2025 09:40:40 +0000</pubDate>
      <link>https://dev.to/youngtech/linux-search-commands-essential-tools-for-incidence-response-3cn5</link>
      <guid>https://dev.to/youngtech/linux-search-commands-essential-tools-for-incidence-response-3cn5</guid>
      <description>&lt;p&gt;Imagine this: a server in your production environment has been breached, and the security team suspects malware or rogue files have been installed. Speed is crucial. As an engineer, your ability to run detailed and precise Linux searches can make a world of difference in identifying, isolating, and removing the threat.&lt;/p&gt;

&lt;p&gt;Incident response involves a lot of steps, but in this article, I’ll focus on the critical role Linux searches play. I’ll walk you through some essential search commands that can help uncover suspicious files like newly created executables, recently modified files, and those with unusual extensions. Plus, I’ll share a bonus tip for generating a CSV report of your search results.&lt;/p&gt;

&lt;h1&gt;
  
  
  Index
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Why Mastering Linux Searches Matters&lt;/li&gt;
&lt;li&gt;Key Searches to Run During a Breach&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Finding Recently Modified Files&lt;/li&gt;
&lt;li&gt;Locating Newly Created Executables&lt;/li&gt;
&lt;li&gt;Identifying Files with Unusual Extensions&lt;/li&gt;
&lt;li&gt;Bonus Tip: Generate a CSV Report&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why Mastering Linux Searches Matters
&lt;/h2&gt;

&lt;p&gt;In a large-scale production environment, hundreds, if not thousands, of files are created or modified daily. Running imprecise searches can return overwhelming results, wasting valuable time. By mastering advanced Linux search commands, you can pinpoint the exact information you need during an incident response, saving time and mitigating risks effectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Searches to Run During a Breach
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Finding Recently Modified Files
&lt;/h2&gt;

&lt;p&gt;When dealing with a breach, one of the first steps is identifying files modified recently. This can help you detect suspicious activity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;find / -type f -mtime -1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffa5jrgyar6k64zgn59u4.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%2Ffa5jrgyar6k64zgn59u4.png" alt="Image description" width="800" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What It Does:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;find /&lt;/code&gt;: Starts searching from the root directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-type f&lt;/code&gt;: Limits the search to files only.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-mtime -1&lt;/code&gt;: Finds files modified in the last 24 hours.&lt;/p&gt;

&lt;p&gt;This search will return a lot of results because a lot if legitimate files can be generated in 24 hours, and it may be too broad of a search, but it's a place to start. &lt;br&gt;
If you wanted to search the log files modified in the last 24 hours, run the command &lt;code&gt;find /var/log/ -type f -mtime -1&lt;/code&gt;. This will return files in the log directory.&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%2Fjgc51vpscpkp0gymtmvz.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%2Fjgc51vpscpkp0gymtmvz.png" alt="Image description" width="690" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; If rogue files were added during the breach, this command helps identify them quickly. Be precise with your searches to avoid sifting through unrelated results.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Locating Newly Created Executables
&lt;/h2&gt;

&lt;p&gt;Newly created executables can be a major red flag. These might be scripts or binaries added by attackers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;find / -type f -perm /111 -ctime -1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr1csmyg5s3kbreyc4o44.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%2Fr1csmyg5s3kbreyc4o44.png" alt="Image description" width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What It Does:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-perm /111&lt;/code&gt;: Finds files with execute permissions (for user, group, or others).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-ctime -1&lt;/code&gt;: Filters files created in the last 24 hours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Helps you focus on executable files that could potentially be malicious programs.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Identifying Files with Unusual Extensions
&lt;/h2&gt;

&lt;p&gt;Attackers often hide malicious files using uncommon or suspicious extensions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - &lt;code&gt;find / -type f \( -name "*.sh" -o -name "*.pyc" -o -name ".tmp" \)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ye2q7fznh2b2zljytd6.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%2F6ye2q7fznh2b2zljytd6.png" alt="Image description" width="800" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What It Does:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-type f&lt;/code&gt;: Limits the search to files.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;\( ... \)&lt;/code&gt;: Groups multiple conditions.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-o&lt;/code&gt;: Acts as “OR” to search for multiple extensions like &lt;code&gt;.sh&lt;/code&gt;, &lt;code&gt;.pyc&lt;/code&gt;, and &lt;code&gt;.tmp&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Quickly locate files with extensions that don’t usually appear in your system but may indicate malicious intent.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Bonus Tip: Generate a CSV Report
&lt;/h2&gt;

&lt;p&gt;If you need to document your findings, you can export search results into a CSV file for easier analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command:&lt;/strong&gt; - `find /var/log -type f -mtime -1 -name "*.log" -exec ls -l {} \; | awk '{print $NF","$5","$6", "$7" "$8}' &amp;gt; incident_results.csv&lt;/p&gt;

&lt;p&gt;This command finds log files accessed in the last 24 hours and puts the output in a CSV file.&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%2Fbiccjqoach9fa65hpczr.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%2Fbiccjqoach9fa65hpczr.png" alt="Image description" width="800" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the command &lt;code&gt;cat incident_results.csv&lt;/code&gt; to view the contents of the CSV file.&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%2F4tw5f7gtdo46qvph726u.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%2F4tw5f7gtdo46qvph726u.png" alt="Image description" width="606" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What It Does:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-exec ls -l {}&lt;/code&gt;: Lists details about each file found.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;awk&lt;/code&gt;: Extracts the file name, size, and timestamp.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;gt; incident_results.csv&lt;/code&gt;: Redirects the output into a CSV file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Case:&lt;/strong&gt; Perfect for creating a structured report to share with your security team or to document the incident.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;When responding to a server breach, time is critical. The ability to perform precise, detailed searches on Linux servers is an invaluable skill for any engineer. By identifying suspicious files, you can help your team resolve incidents faster and more effectively. Having strong Linux search skills isn’t just about being technically proficient; it’s about being prepared when it matters most.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>The Linux (rm) Command: Simple, Powerful, and Dangerous</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Wed, 09 Apr 2025 05:54:17 +0000</pubDate>
      <link>https://dev.to/youngtech/the-linux-rm-command-simple-powerful-and-dangerous-9h4</link>
      <guid>https://dev.to/youngtech/the-linux-rm-command-simple-powerful-and-dangerous-9h4</guid>
      <description>&lt;p&gt;There’s a reason that Linux professionals emphasize caution when using the &lt;code&gt;rm&lt;/code&gt; command. It’s a very simple command, only two letters, but extremely powerful. If you’re not careful, a misplaced command could wipe out critical files or even an entire system. I want to share what I’ve learned about the &lt;code&gt;rm&lt;/code&gt; command, from the basics to best practices, because understanding this command well can save you a lot of trouble down the road.&lt;/p&gt;

&lt;h1&gt;
  
  
  Index
&lt;/h1&gt;

&lt;p&gt;1. What is the rm Command?&lt;br&gt;
2. Common rm Options&lt;br&gt;
3. The Dangers of the rm command&lt;br&gt;
4. Best Practices for Using rm&lt;br&gt;
5. Recommendations for Safe Use&lt;br&gt;
6. Business Use Cases&lt;br&gt;
7. Summary&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What is the rm Command?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;rm&lt;/code&gt; command stands for "remove." It’s used to delete files and directories in Linux. It’s a pretty straightforward command, but its power lies in the options you can use to make it more flexible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic Syntax&lt;/strong&gt;&lt;br&gt;
rm filename.txt - This removes a specified file from your system. For example, &lt;code&gt;rm filetest2.txt&lt;/code&gt; will delete filetest2.txt.&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%2F1bvj8cstgkvs6rtua05p.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%2F1bvj8cstgkvs6rtua05p.png" alt="Image description" width="800" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Common rm Options
&lt;/h2&gt;

&lt;p&gt;Here are some of the most commonly used (and most important!) options for &lt;code&gt;rm&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-r&lt;/code&gt;&lt;/strong&gt;: Recursively delete directories and their contents.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-f&lt;/code&gt;&lt;/strong&gt;: Force removal without prompting for confirmation.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;-i&lt;/code&gt;&lt;/strong&gt;: Interactive mode, asking for confirmation before every deletion (highly recommended).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
rm -ri foldername - This will prompt you for confirmation before removing the folder and its contents.  For example, &lt;code&gt;rm finance&lt;/code&gt; will delete the finance directory.&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%2Fgih8lhkz17wf5swhjxt4.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%2Fgih8lhkz17wf5swhjxt4.png" alt="Image description" width="738" height="141"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;rm -rvf foldername - Recursive + Force: removes everything without asking. For example, &lt;code&gt;rm -rvf inventory&lt;/code&gt; deletes the directory with contents without asking.&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%2Fe8ipcmyu0e1emf1xxax2.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%2Fe8ipcmyu0e1emf1xxax2.png" alt="Image description" width="800" height="118"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it Matters&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;-r&lt;/code&gt; option is necessary when you need to delete directories, but combining it with &lt;code&gt;-f&lt;/code&gt; can be risky. Always double-check your command when using these flags to avoid accidental deletions.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Dangers of the rm Command
&lt;/h2&gt;

&lt;p&gt;Here’s where things can go wrong:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running &lt;code&gt;rm *&lt;/code&gt; in the wrong folder can wipe out everything in that directory.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;rm -rf /&lt;/code&gt; can (and will!) delete your entire root filesystem. That means that the server will become inoperable, and if no backup, could be down for hours or even days.  The thing to understand about the rm command is that there is no undo. Once the files are removed, they’re gone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Best Practices for Using rm
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Always double-check your commands.&lt;/strong&gt; Pay close attention to the paths and options you’re using.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use the &lt;code&gt;-i&lt;/code&gt; option.&lt;/strong&gt; This interactive flag makes &lt;code&gt;rm&lt;/code&gt; a lot safer by prompting you before each deletion.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run a search first before deleting.&lt;/strong&gt; If you’re using &lt;code&gt;rm&lt;/code&gt; with search commands (like &lt;code&gt;find&lt;/code&gt;), run the search alone first to verify what will be deleted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example Workflow:&lt;/strong&gt;&lt;br&gt;
Say you want to delete all files modified on a specific date (April 29, 2025), excluding hidden files and folders. Here’s the process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 - Search:&lt;/strong&gt;&lt;br&gt;
   find . -not -path '&lt;em&gt;/.&lt;/em&gt;' -newermt "2025-04-29" ! -newermt "2025-04-30"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What It Does:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Searches the current directory (&lt;code&gt;.&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;Excludes hidden files and directories (&lt;code&gt;-not -path '*/.*'&lt;/code&gt;).
&lt;/li&gt;
&lt;li&gt;Finds files modified on April 29, 2025 (&lt;code&gt;-newermt&lt;/code&gt; flags).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2 - Delete (only after verifying the search):&lt;/strong&gt;&lt;br&gt;
   find . -not -path '&lt;em&gt;/.&lt;/em&gt;' -newermt "2025-04-29" ! -newermt "2025-04-30" -exec rm -rf {} +&lt;br&gt;
   &lt;strong&gt;What It Does:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adds &lt;code&gt;-exec rm -rf&lt;/code&gt; to delete the matched files and directories.
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Recommendations for Safe Use
&lt;/h2&gt;

&lt;p&gt;Using &lt;code&gt;rm&lt;/code&gt; responsibly requires a little extra effort, but it’s worth it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never combine search and delete in one step without testing.&lt;/strong&gt; Run the search first, and only add the delete command once you’re confident.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communicate with your team.&lt;/strong&gt; Before deleting anything in a shared environment, confirm with your team or a senior engineer.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backup first.&lt;/strong&gt; Whether it’s a snapshot, copy, or full backup, always have a fallback in case something goes wrong.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document your actions.&lt;/strong&gt; Log the commands you run and why, especially in production environments. Accountability is key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6. Business Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Log rotation&lt;/strong&gt; - Remove old logs from servers to free disk space.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data retention compliance&lt;/strong&gt; - Securely remove expired customer data after retention.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; - Delete sensitive files from servers during incident response.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  7. Summary
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;rm&lt;/code&gt; command is one of the most useful tools in Linux, but it’s also one of the most dangerous.  By taking the time to understand how it works and following best practices, you can avoid costly mistakes and handle deletions with confidence.  Remember: double-check, backup, and think twice before you delete especially in a production environment.&lt;br&gt;&lt;br&gt;
Using the &lt;code&gt;rm&lt;/code&gt; command responsibly is what makes a great cloud engineer stand out. It’s all about being careful and understanding the command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
    <item>
      <title>Attention to Detail in Linux Commands</title>
      <dc:creator>Yvonne</dc:creator>
      <pubDate>Tue, 08 Apr 2025 06:18:31 +0000</pubDate>
      <link>https://dev.to/youngtech/attention-to-detail-in-linux-commands-tackling-common-errors-7p5</link>
      <guid>https://dev.to/youngtech/attention-to-detail-in-linux-commands-tackling-common-errors-7p5</guid>
      <description>&lt;p&gt;During those early days when I was getting the hang of Linux, I frequently encountered two of many messages: "No such file or directory" and "Command not found." The cause of these errors was for two reasons: typos and not knowing where I was in the directory structure. Through trial and error, I discovered how attention to detail is crucial in Linux.&lt;/p&gt;

&lt;h3&gt;
  
  
  Index
&lt;/h3&gt;

&lt;p&gt;1. Introduction&lt;br&gt;
2. No such file for directory&lt;br&gt;
3. Command not found&lt;br&gt;
4. Permission denied&lt;br&gt;
5. Summary&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Introduction
&lt;/h2&gt;

&lt;p&gt;Paying attention to the little details in Linux makes a world of difference. As a cloud engineer, nailing the basics is absolutely essential as it’s the foundation for everything more advanced you’ll learn later on. It’s easy to overlook something small, but those tiny mistakes can have a big impact, especially in a live production environment. Being thorough and detail-oriented is what sets you apart and makes your job easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. No such file or directory
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Spacing issue, incorrect directory path, or missing directory.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br&gt;
          - Ensure there are no unnecessary spaces in your command. Linux is case-sensitive, so even a small mismatch trips it up.&lt;br&gt;
          - When creating multiple directories, use the &lt;em&gt;-p option&lt;/em&gt; with the mkdir command to prevent this error. For example; &lt;em&gt;mkdir -p jenkins/vs/v1/v2&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fza11b2fz6cosf1q21vit.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%2Fza11b2fz6cosf1q21vit.png" alt="No such file or directory" width="800" height="50"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Business Use Case:&lt;/strong&gt; Being able to create multiple directories speeds up directory setup for complex projects; it's a time saver.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Command not found
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; The package required for the command is not installed.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check if the command is installed. For example, to find out if apropos is installed, run the command "&lt;em&gt;which apropos&lt;/em&gt;" or "&lt;em&gt;command -v apropos&lt;/em&gt;"
If installed, you'll see an output like /usr/bin/apropos. If not, install the package associated with the command.
&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%2F8cglpa12zeuu57bf7oqg.png" alt="Image description" width="511" height="69"&gt;
&lt;strong&gt;Business Use Case:&lt;/strong&gt; Imagine troubleshooting missing tools during a production environment setup. You can quickly identify and install essential commands saving hours of downtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Permission denied
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; User is trying to access a file or execute a script and does not have the required permissions.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check that the user is in the Linux "Wheel" group&lt;/li&gt;
&lt;li&gt;Run the command with "sudo". For example to do an update, run "sudo yum install httpd".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the example below, the user tried to create a script file and was denied. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevsw6v4np84bub2519oz.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%2Fevsw6v4np84bub2519oz.png" alt="Image description" width="710" height="61"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user was also not in the "sudoers" file
&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%2Ffbg5rqgrrfqezbhzfjio.png" alt="Image description" width="800" height="67"&gt;
&lt;/li&gt;
&lt;li&gt;Add the user to the "Wheel" group. Run the command, "&lt;em&gt;sudo usermod -aG wheel username&lt;/em&gt;". The "Wheel" group in Linux controls who has sudo access.
&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%2F79k7mp4hsjpn95flreav.png" alt="Image description" width="661" height="34"&gt;
&lt;/li&gt;
&lt;li&gt;Check that user is added to the "Wheel" group. Run the command
&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%2Fyoh1tnl29ncf4g53x3cd.png" alt="Image description" width="446" height="58"&gt;
&lt;strong&gt;Business Use Case:&lt;/strong&gt; In collaborative environments, ensuring the right people have the correct permissions streamlines workflows without compromising security.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Summary
&lt;/h2&gt;

&lt;p&gt;I’m highlighting these common errors to show the importance of double-checking your commands and directory paths. Attention to detail can save time and prevent frustration in high-pressure environments.&lt;br&gt;
Linux can be unforgiving with errors, but it rewards you when you master the OS and become efficient in doing those critical tasks. By developing an eye for detail and employing simple troubleshooting techniques, you can tackle common errors with confidence. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/yvonneyoung/" rel="noopener noreferrer"&gt;Connect with me on LinkedIn&lt;/a&gt; to comment or share your experiences with Linux.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #RedHatEnterpriseLinux&lt;br&gt;
#CloudWhistler  #CloudEngineer  #Linux&lt;br&gt;
#DevOps #RedHat  #OpenSource&lt;br&gt;
#CloudComputing  #WomenInTech&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloudwhistler</category>
      <category>opensource</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
