How can I reboot lightsail instance using cloudwatch or something?

0

My lightsail instance used to stop working. So I want to reboot lightsail instance if CPU usage is over danger percent. I tried to create alarm in CloudWatch but I couldn't see Lightsail when choose metric. I checked region but it was correct. What is the issue? Or what should I do to implement this? Thank you in advance.

2 回答
0

Hello.

Lightsail does not output metrics to CloudWatch, so you cannot directly create alarms and run Lambda.
https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-resource-health-metrics.html

So, why not introduce CloudWatch Agent to Lightsail, create custom metrics, and run Lambda?
https://repost.aws/knowledge-center/lightsail-monitor-with-cloudwatch

profile picture
专家
已回答 2 个月前
0

Lightsail instances can slow down and appear as unresponsive when the instance consistently consumes more CPU than the Lightsail plan provides as a baseline. Lightsail uses burstable instance types that allow you to consume more CPU than your baseline for short periods of time. However, if an application continues to use more CPU beyond the plan's resources for long periods of time, the performance of the instance may suffer. This can happen for large or CPU intensive applications that run on a small plan size. We are working on ways to make it easier to diagnose when this issue is happening.

Here are two options on addressing the issue:

Scale up your instance If you find your instances are encountering this scenario, you can scale up your instance to the next plan size for improved performance. You can increase your plan size by taking a snapshot of your instance and then recreating a new, larger instance from your snapshot: https://lightsail.aws.amazon.com/ls/docs/en/articles/how-to-create-larger-instance-from-snapshot-using-console

Disable unnecessary resource consuming code You can try to pinpoint resource-intensive processes that are not essential to your application, but are consuming your CPU, and disable them. For example, in applications like WordPress, custom themes, WordPress plugins, or other processes may be unnecessarily consuming your CPU in the background. If these element are not essential, you can turn them off.

AWS
审核人员
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则