How can the administrator accomplish this with the LEAST amount of effort?
Configure an AWS Lambda function in Python 3.7 to run every minute to capture the PID and send a notification.
Configure the procstat plugin to collect and send CPU metrics for the running processes.
Log in to the EC2 Linux instance using a .pem key each night and then run the top command.
Use the default Amazon CloudWatch CPU utilization metric to capture the PID in the CloudWatch dashboard.
Explanations:
While using AWS Lambda could automate the process, it would require custom code to capture the PID and monitor CPU usage. This would involve a significant amount of effort compared to other options.
The procstat plugin can collect detailed CPU metrics for running processes, providing the required information (PID) without additional manual intervention. This is an automated solution with minimal effort.
Manually logging into the EC2 instance each night and running the top command requires significant manual intervention and does not scale well for continuous monitoring.
CloudWatch CPU metrics provide overall CPU utilization data but do not include specific details about the individual processes (like PID) consuming CPU. Therefore, it cannot help identify the exact process causing the spikes.