Setting up RAM monitoring on AWS - mtholyoke/JupyterHub-on-AWS GitHub Wiki
AWS has CPU usage graphs by default, but does not automatically provide RAM usage graphs. To monitor RAM, CloudWatch Agent must be installed on the instance.
One-time setup - create the IAM role
You must create an IAM role to use with CloudWatch Agent. This only needs to be done once for the organization - once it exists, it can be attached to multiple instances.
Adding RAM monitoring to an existing instance
- Starting at step 7 (we already have an instance), follow these directions to attach the IAM role to the instance.
Install CloudWatchAgent
- On the left bar in the EC2 console, click on Instances and select the EC2 Instance with the CloudWatchAgentServerRole IAM role.
ssh
to the EC2 instance- Follow the instructions to find the appropriate download link (ARM64 Ubuntu) and directions for installation.
- Essentially:
wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
- Perform step 5 in these instructions to configure the CloudWatch Agent. Use the answers given in the article - for any questions that aren't in the article, pick the default.
Start the CloudWatch Agent
- Start the CloudWatch Agent:
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
View the graphs
You're done! It does take a few minutes to get to the AWS console, so if you don't see anything immediately, don't panic.
- On the Amazon CloudWatch console page, select "All Metrics".
- Click CWAgent
- Click ImageID,InstanceID,InstanceType
- Select the Instance from the list below