Skip to content

EC2 mac instance - keep awake

0

We are trying to use the ec2 instance to run a web server that calls some local mac apps. If we are connected via VNC to the machine it all works perfectly and very fast, but the moment we disconnect, the machine enters a low power state where everything is much slower. We tried everything to keep the computer awake but nothing seems to work (caffeinate, change energy settings...). Thanks in advance.

asked 2 years ago310 views
1 Answer
0

By default, EC2 instances enter a low-power state when inactive to optimize resource usage and cost. This reduces CPU performance and might explain the slowdown you're experiencing.

Solutions: A/ Disable Idle Sleep:

  1. Log in to the EC2 instance via SSH (not VNC).
  2. Edit the /etc/config/powermgmt/conf file (the path might vary depending on the Linux distribution).
  3. Set StandbyEnabled to false.

Please note : Disabling sleep can increase your EC2 instance's running costs.

B/ Use Instance Keep-Alive Mechanisms:

  1. Install the CloudWatch agent on your EC2 instance.
  2. Configure a scheduled task using the agent to run a simple command (e.g., echo "KeepAlive") periodically (e.g., every minute).
  3. This will prevent the instance from entering a low-power state.

Also note: a) Auto Scaling: If you have auto-scaling enabled for your EC2 instance, disabling sleep might prevent it from scaling down during low traffic periods.

b) Monitor CPU Usage: Use CloudWatch to monitor your EC2 instance's CPU usage. If the CPU utilization is consistently low, consider using a smaller instance type to optimize costs.

AWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.