How do I troubleshoot memory and CPU issues in Elastic Beanstalk?
"I want to know why my AWS Elastic Beanstalk CPU and memory usage is too high, and I want to troubleshoot issues."
"I want to know why my AWS Elastic Beanstalk CPU and memory usage is too high, and I want to troubleshoot issues.Short descriptionTo gain insight into your Elastic Beanstalk CPU and memory usage and troubleshoot issues, do the following:Configure the environment to collect metrics on memory and CPU usageAnalyze log files to troubleshoot memory and CPU usage issuesResolutionConfigure your environment to collect metricsTo gain insight into memory and CPU usage, do the following:Check the health of your Amazon Elastic Compute Cloud (Amazon EC2) instances with the Elastic Beanstalk health agent.Monitor your instances using Amazon CloudWatch.Turn on enhanced health reporting and monitoring, and then review the Environment health page for Amazon EC2 instance metrics.Turn on CloudWatch memory usage metrics in Amazon Linux 2 or Windows environments.Configure advanced health rules for your Elastic Beanstalk environment (such as CPU load averages).Analyze your log files to troubleshoot your memory and CPU issueAfter gathering data from your metrics, do the following:Review the log files from the instances in your Elastic Beanstalk environment.Analyze key log files (such as /var/log/messages), and then search for messages about high CPU or out-of-memory (OOM) events.Use your log file results to figure out why the process is consuming a high amount of CPU or memory.Note: For example, you might find a large number of requests in Apache access logs or NGINX access logs.If the issue is ongoing, then do the following:Connect to your Linux instance using SSH.Use the Linux top or free command to view details on CPU and memory consumption.Configure the ATOP monitoring tool. Review CPU and memory utilization stats.CPU-based command: atop -CMemory-based command: atop -mIf you don't find any errors, then the traffic load to your environment might have increased. To handle increased traffic, try the following:Scale up by increasing the instance type.Scale out to decrease the load per instance by increasing the size of the environment's Auto Scaling group.Follow"