<p style="text-align:justify;">Amazon Elastic Process Cloud (EC2) gives Elastic computing capacities in the cloud, permitting organizations to run applications with a degree of adaptability that customary servers can't coordinate. As a component of overseeing EC2 cases, monitoring and checking the cycles running on the server to guarantee smooth activity, keep up with security, and investigate issues is fundamental. Knowing how to check the running cycles is central for system managers, DevOps designers, and engineers operating in cloud conditions.</p><h2 style="text-align:justify;">Understanding Processes in EC2</h2><p style="text-align:justify;">Before exploring the strategies, it's critical to comprehend what cycles are. An interaction is a running project. Each interaction has an extraordinary Cycle ID (PID) and works inside its memory space. Processes can be system processes, similar to services essential for the operating system, or client processes, such as applications launched by the client.</p><p style="text-align:justify;">In an EC2 example, running cycles can consume CPU, memory, and I/O, affecting the case's presentation. Observing these cycles keeps up with ideal execution, avoids resource exhaustion, and detects malicious exercises.</p><h2 style="text-align:justify;">Importance of Monitoring Processes</h2><p style="text-align:justify;">Checking the process running on your EC2 instance is significant in light of multiple factors:</p><ul><li><strong>Performance Optimization:</strong> By following asset utilization, you can recognize bottlenecks, high memory utilization, and different failures.</li><li><strong>Troubleshooting:</strong> If your application is lazy or failing to meet expectations, dissecting the cycles can help you distinguish the underlying driver.</li><li><strong>Security:</strong> Dubious or obscure cycles might demonstrate malware or unapproved movement.</li><li><strong>Compliance:</strong> Contingent upon your industry, you might be expected to log or screen processes for the end goal of evaluating.</li></ul><h2 style="text-align:justify;">Methods to Check Running Processes on an EC2 Instance</h2><h3 style="text-align:justify;">Using SSH to Access Linux EC2 Instances</h3><p style="text-align:justify;">The most widely recognized method for checking processes on a Linux-based EC2 instance is to interface with it using SSH. When associated, a few command-line tools can be utilized to list and oversee processes.</p><h4 style="text-align:justify;">Step 1: SSH into the EC2 Instance</h4><p style="text-align:justify;">To connect to an EC2 instance using SSH, follow these steps:</p><pre><code class="language-plaintext">ssh -i /path/to/key.pem ec2-user@ec2-public-ip</code></pre><p style="text-align:justify;">Replace<i> /path/to/key.pem</i> with the path to your confidential key and <i>ec2-public-ip</i> with the public IP address of your EC2 occasion.</p><h4 style="text-align:justify;">Step 2: Using the <code>ps</code> Command</h4><p style="text-align:justify;">The ps order is one of the easiest and most familiar ways of posting running cycles in Linux. The basic syntax is:</p><pre><code class="language-plaintext">ps aux</code></pre><p style="text-align:justify;">This command gives a point-by-point rundown of every running interaction, with data, such as the client who began the cycle, computer chip use, memory use, PID, and order that started the interaction.</p><h4 style="text-align:justify;">Step 3: Using <code><i>top</i></code> Command</h4><p style="text-align:justify;">The top command gives a real-time, unique perspective on running cycles. It shows an arranged rundown of cycles by a central processor or memory utilization, permitting you to screen asset utilization progressively.</p><p style="text-align:justify;">To use the <code><i>top</i></code>, simply run:</p><pre><code class="language-plaintext">top</code></pre><p style="text-align:justify;">You can exit the <i>top</i> command by pressing <i>q</i>.</p><h4 style="text-align:justify;">Step 4: Using <code>htop</code> (Alternative to top)</h4><p style="text-align:justify;">The htop command is an upgraded top version with an intuitive UI. It gives various coded data and considers more straightforward interactions on the board. Nonetheless, it may not be introduced on your EC2 occasion.</p><p style="text-align:justify;">To install<i> </i>htop:</p><pre><code class="language-plaintext">sudo yum install htop # For Amazon Linux/RedHat sudo apt-get install htop # For Ubuntu/Debian</code></pre><p style="text-align:justify;">Once installed, run:</p><pre><code class="language-plaintext">htop</code></pre><h4 style="text-align:justify;">Step 5: Using pgrep Command</h4><p style="text-align:justify;">If you're searching for a particular cycle, the pgrep order can be utilized to look for processes by name. For example, to find the PID of Apache processes:</p><pre><code class="language-plaintext">pgrep apache2</code></pre><h4 style="text-align:justify;">Step 6: Using lsof to List Open Files</h4><p style="text-align:justify;">The lsof command lists open documents and the processes utilizing them. This helps identify which methods are utilizing explicit documents or organization associations.</p><p style="text-align:justify;">To list all open files:</p><pre><code class="language-plaintext">sudo lsof</code></pre><p style="text-align:justify;">To list open files for a specific process:</p><pre><code class="language-plaintext">sudo lsof -p <PID></code></pre><h2 style="text-align:justify;">Checking Processes on Windows EC2 Instances</h2><p style="text-align:justify;">For Windows-based EC2 instances, you can use Remote Desktop Protocol (RDP) to interface and the Task Manager or PowerShell to screen processes.</p><h3 style="text-align:justify;">Step 1: Connect via RDP</h3><p style="text-align:justify;">To connect to a Windows EC2 instance, open Remote Desktop Connection on your local machine and enter the public IP address of your instance.</p><h3 style="text-align:justify;">Step 2: Using Task Manager</h3><p style="text-align:justify;">Open Task Manager (Ctrl + Shift + Esc) to see running cycles when connected. The Processes tab outlines a CPU, memory, disk, and network used for each running interaction.</p><h3 style="text-align:justify;">Step 3: Using PowerShell</h3><p style="text-align:justify;">You can likewise utilize PowerShell to list processes on a Windows EC2 instance. To do this, open PowerShell and use the Get-Process command:</p><pre><code class="language-plaintext">Get-Process</code></pre><p style="text-align:justify;">This will display a list of all running processes, similar to the ps command in Linux.</p><h3 style="text-align:justify;">Step 4: Using WMIC</h3><p style="text-align:justify;">WMIC (Windows Management Instrumentation Command-line) is one more helpful asset to query processes:</p><pre><code class="language-plaintext">wmic process list brief</code></pre><p style="text-align:justify;">This will list running processes, their Processes, session IDs, and status.</p><h2 style="text-align:justify;">Using CloudWatch to Monitor EC2 Processes</h2><p style="text-align:justify;">Amazon CloudWatch is an observing service that can follow execution measurements like computer processor use, memory use, and disk action. While it doesn't straightforwardly screen processes, it can provide insight into the general asset utilization of your EC2 instance.</p><h3 style="text-align:justify;">Step 1: Enabling CloudWatch Monitoring</h3><p style="text-align:justify;">CloudWatch observing can be empowered through the AWS Management Console, SDKs, or CLI. However, you should be cautious when setting off notifications when resource use surpasses a specific edge, corresponding with explicit processes consuming excessive assets.</p><h3 style="text-align:justify;">Step 2: Using CloudWatch Logs Agent</h3><p style="text-align:justify;">The CloudWatch Logs agents can be installed on your EC2 instance to send log information (counting system logs and application logs) to CloudWatch. This can provide insight into what processes are running and any possible mistakes or issues.</p><h2>Useful Commands to check processes running on AWS EC2 instance</h2><figure class="table"><table><thead><tr><th><strong>Command</strong></th><th><strong>Purpose</strong></th><th><strong>Example</strong></th><th><strong>Usage</strong></th></tr></thead><tbody><tr><td><pre><code class="language-plaintext">ps aux</code></pre></td><td>Lists all running processes in snapshot view</td><td><pre><code class="language-plaintext">ps aux</code></pre></td><td>Check running processes with user info and memory usage</td></tr><tr><td><pre><code class="language-plaintext">top</code></pre></td><td>Real-time monitoring of system processes</td><td><pre><code class="language-plaintext">top</code></pre></td><td>View dynamic resource usage of processes</td></tr><tr><td><pre><code class="language-plaintext">htop</code></pre></td><td>Enhanced real-time process viewer</td><td><pre><code class="language-plaintext">htop</code></pre></td><td>Navigate, filter, and manage processes interactively</td></tr><tr><td><pre><code class="language-plaintext">pidof <name></code></pre></td><td>Finds the process ID (PID) of a specific app</td><td><pre><code class="language-plaintext">pidof apache2</code></pre></td><td>Get PID of a running service</td></tr><tr><td><pre><code class="language-plaintext">kill <PID></code></pre></td><td>Terminates a process by PID</td><td><pre><code class="language-plaintext">kill 1234</code></pre></td><td>End a specific process</td></tr><tr><td><pre><code class="language-plaintext">pgrep <name></code></pre></td><td>Lists PIDs of processes with a specific name</td><td><pre><code class="language-plaintext">pgrep nginx</code></pre></td><td>Find multiple processes by name</td></tr></tbody></table></figure><h2 style="text-align:justify;">Final Thoughts on Monitoring EC2 Processes</h2><p style="text-align:justify;">Checking processes on your EC2 instances is critical for execution advancement, investigation, and security. For Linux instances, instruments like ps, top, htop, and lsof give nitty-gritty knowledge into running cycles. For Windows instances, Task Manager and PowerShell offer process management capacities. Moreover, Amazon CloudWatch and third-party applications like Nagios and Datadog can assist with checking asset utilization and process activity. You can guarantee that your applications remain safe and secure by consistently checking the processes running on your EC2 instances.</p><p style="text-align:justify;">Read More</p><p style="text-align:justify;"><a href="https://devopsden.io/article/azure-devops-professionals-jobs-in-uk">https://devopsden.io/article/azure-devops-professionals-jobs-in-uk</a></p><p style="text-align:justify;">Follow us on</p><p style="text-align:justify;"><a href="https://www.linkedin.com/company/devopsden/">https://www.linkedin.com/company/devopsden/</a></p>